Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: fun_bidoux on July 25, 2008, 03:03:50 PM

Title: Direct access to the screen
Post by: fun_bidoux on July 25, 2008, 03:03:50 PM
Hello,

I would like to know if their is any way to get a direct access to the screen like in SDL (SDL_Surface->pixels) because i'm trying to port a game that I made  in C.

Thank,
Title: Re: Direct access to the screen
Post by: gnu on July 25, 2008, 03:27:33 PM
I don't think so. You'll have to use lcd_drawpixel().
Title: Re: Direct access to the screen
Post by: fun_bidoux on July 25, 2008, 04:54:31 PM
Ok... thank,

Title: Re: Direct access to the screen
Post by: mcuelenaere on July 30, 2008, 04:13:23 AM
There is, if you're not in a plugin you can directly access
Code: [Select]
lcd_framebuffer[y][x] but I believe this isn't accessible from within a plugin (and probably you're wanting to make one).

edit:
Ok, I was wrong :)
As the people below me explain you can access it from rb->lcd_framebuffer[][]
Title: Re: Direct access to the screen
Post by: shotofadds on July 30, 2008, 04:19:45 AM
You can do the same thing from a plugin, using rb->lcd_framebuffer.
Title: Re: Direct access to the screen
Post by: linuxstb on July 30, 2008, 04:22:27 AM
rb->lcd_framebuffer[] is what you need.  Various plugins use it.

It's important to note that this isn't the actual screen though - just an in-RAM copy of what is being displayed on the LCD.  To transfer the data to the LCD, call rb->lcd_update() or rb->lcd_update_rect()

It's also important to note that the format of the data in this array is device-dependent, so  if you want to bypass the graphics API in this way, you'll need different drawing code for different devices.  I don't think there's any documentation on the different lcd formats, but looking at firmware/export/lcd.h and firmware/drivers/lcd-*.c should help (as well as looking at other plugins).