Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am building a matrix out of addressable pixels and it will be run by a Pi (over the ethernet bus). The matrix will be 75 pixels wide and 20 pixels tall. As a side project, I thought it would be neat to run pong on it. I've seen some python based pong tutorials for Pi, but the problem is that they want to pass the data out to a screen via pygame.display function.

I have access to pass pixel information using a memory map block, so is there anyway to do that with pygame instead of passing it out the video port?

In case anyone is curious, this was the pong tutorial I was looking at: Pong Tutorial

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Pygame uses a memory map and pygame.display.flip() and pygame.display.update() are the functions that update the display itself.

You just have to call pygame.display.get_surface(), to get the screen map as a surface.

share|improve this answer
    
Thanks. So instead of doing something like pygame.display.update(). I could do something like screen = pygame.display.get_surface(), draw my screens like normal, and then pass the "screen" to my memory map reading app, right? –  toozie21 Jun 6 '14 at 18:06
    
Yes that should work. You also have screen.get_view() and screen.get_buffer() functions in case you need to access raw pixel data. –  pmoleri Jun 6 '14 at 18:16
    
So the raw pixels are the RGB values for each individual pixel? That would be great if so because an RGB triplet is ultamately what I need to pass along I think. –  toozie21 Jun 6 '14 at 18:51
    
Yes, it's byte data so you have to figure out how every color is stored. You also have other options like: pygame.org/docs/ref/pixelcopy.html to obtain a 3D array (row, column, color). –  pmoleri Jun 6 '14 at 23:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.