Re: [pygame] Seeing if this works...

2009-10-06 Thread Guy Anderson
Yeah I included a big enough background, and it works now.

Thanks.

On 10/5/09, Henrique Nakashima henrique.nakash...@gmail.com wrote:
 When you blit a sprite to the screen, it is not erased from where it
 was previously blitted. You gotta do it manually, blitting the
 background over everything then the sprite in its new position.

 Alternatively, to avoid blitting the whole screen every loop, you can
 only blit the part of the background which was covered by the sprite
 in the previous frame, patching it. This technique is called dirty
 rectangles. Actually, there is a module in pygame - which I never used
 myself - for doing that:
 http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.DirtySprite

 On Tue, Oct 6, 2009 at 00:33, Guy Anderson guy.a.ander...@gmail.com wrote:
 Well okay :)

 I'm currently working on a game that will utilize linear movement. I
 have successfully made it so that the sprite moves around with the
 arrow keys, but for some reason it leaves sort of a sprite-trail
 when moving; that is, the sprites from the previous positions don't
 clear. I've tried utilizing the clear and dirty commands from the
 pygame module, but I've been unsuccessful. If anyone could help me
 with this, it would be great.

 I am attaching the code with the sprite used.

 On 10/5/09, Luke Paireepinart rabidpoob...@gmail.com wrote:
 Works fine, Guy.Now on with the questions! :)
 Also, if your questions are not pygame-specific, please consider
 subscribing
 to the Python Tutor mailing list, there's a lot of cool guys over on that
 list who are happy to help with basic Python questions.

 On Tue, Oct 6, 2009 at 5:05 AM, Guy Anderson
 guy.a.ander...@gmail.comwrote:

 If this is annoying, I don't blame you. It's been years since I've
 been on a mailing list, though, so I'm trying to see how it all works
 out.

 I will have a basic programming question soon, though.






[pygame] Python IDE for windoz

2009-10-06 Thread pierrelafran...@sympatico.ca
Hi
I have administrator rights on a computor in a lab at work, until
tomorrow.  I would like install IDE for Python. What do you suggest me ?

I know, I may not write this question in the good room, but I just learn
this news, and after tomorrow, it will be too late to install Python.

Thanks
-- 
Pierre


Re: [pygame] Python IDE for windoz

2009-10-06 Thread Eric Pavey
I really enjoy Wing IDE
http://www.wingware.com/

Free to start, and once you learn more, the $$$ version is worth the money
IMO


[pygame] Depth Screenshot

2009-10-06 Thread Ian Mallett
Hello,

I'm trying to debug a weird FBO/depth problem, and it would be great to have
screenshots of the depth.  My current method does not work:

def ScreenSurf(rect=AUTO,type=RGB,framebuffer=0):
if rect == AUTO:
size = glGetFloatv(GL_VIEWPORT)
size = [int(round(size[2])),int(round(size[3]))]
rect = [0,0,size[0],size[1]]
glPixelStorei(GL_PACK_ROW_LENGTH,0)
glPixelStorei(GL_PACK_SKIP_ROWS,0)
glPixelStorei(GL_PACK_SKIP_PIXELS,0)
if type==RGBA:
glPixelStorei(GL_PACK_ALIGNMENT,4)
elif type==RGB:
glPixelStorei(GL_PACK_ALIGNMENT,1)
elif type==DEPTH:
glPixelStorei(GL_PACK_ALIGNMENT,2)
try:
data =
glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE)
print len(data)
except:
previous = glGetIntegerv(GL_READ_BUFFER)
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT+framebuffer)
data =
glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE)
glReadBuffer(previous)
if type==RGBA:
return pygame.image.fromstring(data,(rect[2],rect[3]),'RGBA',1)
elif type==RGB:
return pygame.image.fromstring(data,(rect[2],rect[3]),'RGB',1)
elif type==DEPTH:
#What goes here?

The surface that is returned is then saved (pygame.image.save()).

The issue is that in the case of depth, data is of length x*y.  In the case
of RGB color, it is 3*rect[2]*rect[3].  In the case of RGBA, it is
4*rect[2]*rect[3].  PyGame doesn't know how to convert it (there's no
pygame.image.fromstring(data,size,'R',1), for instance).  What's a decent
way to save the depth as an image?

Thanks,
Ian


Re: [pygame] Depth Screenshot

2009-10-06 Thread RB[0]
I would suggest PIL - don't have the exact functions for it off the top of
my head though...

On Tue, Oct 6, 2009 at 9:43 PM, Ian Mallett geometr...@gmail.com wrote:

 Hello,

 I'm trying to debug a weird FBO/depth problem, and it would be great to
 have screenshots of the depth.  My current method does not work:

 def ScreenSurf(rect=AUTO,type=RGB,framebuffer=0):
 if rect == AUTO:
 size = glGetFloatv(GL_VIEWPORT)
 size = [int(round(size[2])),int(round(size[3]))]
 rect = [0,0,size[0],size[1]]
 glPixelStorei(GL_PACK_ROW_LENGTH,0)
 glPixelStorei(GL_PACK_SKIP_ROWS,0)
 glPixelStorei(GL_PACK_SKIP_PIXELS,0)
 if type==RGBA:
 glPixelStorei(GL_PACK_ALIGNMENT,4)
 elif type==RGB:
 glPixelStorei(GL_PACK_ALIGNMENT,1)
 elif type==DEPTH:
 glPixelStorei(GL_PACK_ALIGNMENT,2)
 try:
 data =
 glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE)
 print len(data)
 except:
 previous = glGetIntegerv(GL_READ_BUFFER)
 glReadBuffer(GL_COLOR_ATTACHMENT0_EXT+framebuffer)
 data =
 glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE)
 glReadBuffer(previous)
 if type==RGBA:
 return pygame.image.fromstring(data,(rect[2],rect[3]),'RGBA',1)
 elif type==RGB:
 return pygame.image.fromstring(data,(rect[2],rect[3]),'RGB',1)
 elif type==DEPTH:
 #What goes here?

 The surface that is returned is then saved (pygame.image.save()).

 The issue is that in the case of depth, data is of length x*y.  In the case
 of RGB color, it is 3*rect[2]*rect[3].  In the case of RGBA, it is
 4*rect[2]*rect[3].  PyGame doesn't know how to convert it (there's no
 pygame.image.fromstring(data,size,'R',1), for instance).  What's a decent
 way to save the depth as an image?

 Thanks,
 Ian



Re: [pygame] Python IDE for windoz

2009-10-06 Thread Thadeus Burgess
Look into Eclipse + Pydev, or Aptana + Pydev, or Netbeans 6.7 (has python
beta)

-Thadeus




On Tue, Oct 6, 2009 at 8:03 PM, Eric Pavey warp...@gmail.com wrote:

 I really enjoy Wing IDE
 http://www.wingware.com/

 Free to start, and once you learn more, the $$$ version is worth the money
 IMO



[pygame] ANN: Humerus 2.1

2009-10-06 Thread Greg Ewing

Humerus 2.1 is now available:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/Humerus-2.1.0.zip

Online documentation:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/Humerus-2.1.0/doc/

In this version, the code for handling levels has been separated out
into a new pair of classes. This makes it easier to use Humerus for
games that don't have levels.

What is Humerus?


Humerus is a companion to the Albow widget library for PyGame. It provides a
framework for games made up of a sequence of levels, including user interface
and back-end logic for saving and restoring game state, loading levels, and
sundry other details. There is also optional support for a built-in level
editor, including code for loading and saving levels to be edited, and asking
whether to save modified levels.

Albow can be found here:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/


Re: [pygame] 10 bits per color

2009-10-06 Thread Greg Ewing

James Paige wrote:

So by that measure, average human eyes should not be able to tell the 
difference between RGB888 and RGB101010


There could conceivably be an advantage in terms of
dynamic range to using more bits, if the display
device is capable of it. You could get the same
effect using some kind of logarithmic encoding
instead of a linear one, but that would complicate
image processing.

--
Greg