GP2X minimal library v0.BWritten by rlyeh, © 2005. Please check readme for licensing and other conditions. Summary | Written by rlyeh, © 2005. | | | | This type definition is used to blit bitmaps and/or sprites into screen. | | This type definition is used to create a custom font. | | | | | | | | This macro retrieves or sets a value into a shared address; it works for both 920T and 940T cores. | | | | Internal variable which holds current conversion between desired ticks and GP2X ticks. | | This struct allows you to work directly with YUV video layer. | | This struct allows you to work directly with RGB video layer. | | | | This function halts the program until a vertical sync is done. | | This function halts the program until an horizontal sync is done. | | This function sets the Gamma correction value for the whole display. | | This function sets the dithering values for all the video layers. | | This function sets the contrast/brigness values for the YUV/OSD layers. | | This function shows or hides the cursor. | | This function updates the cursor coordinates. | | This function sets the alpha blending of both background and foreground cursor colors. | | This function sets the shape, size, colour and alpha blending of the cursor. | | This function displays the minimal logo watermarked at bottom right of screen. | | This function sets the palettized color entry C to a given triad of R,G,B components. | | This function returns the 16bits color for a given triad of R,G,B components. | | This function returns the 16bits color for a given triad of R,G,B components. | | This function updates the whole 8 bits palette into screen. | | This function sets the colorkey transparent value for all RGB colorkeyed regions. | | This function adjusts a given resolution to fit the whole display (320,240). | | This function flips video buffers. | | This function enables, disables and sets screen up to four RGB windows. | | This function returns a YUY2 (Cr0/Y1/Cb0/Y0) 32bits color pixel from a given R,G,B triad. | | This function adjusts a given resolution to fit the whole display (320,240). | | This function flips video buffers. | | This function enables, disables and sets up screen to four YUV parts. | | | | | | This function halts the program for a given delay in gp2x_ticks units. | | | | This function is automatically called by the library, and expects a sound buffer to be filled in. | | This function sets the sound volume. | | This function pauses and unpauses the sound. | | This function pauses the secondary ARM 940T coprocessor. | | This function halts the 920T code until the 940T has finished all its tasks. | | This function executes a 940T command. | | This function sets the 940T program, and launchs it. | | This function sets the 940T program, and launchs it. | | | | | | | | | | This function printfs a string into the RGB layer. | | This function allows you to set your own fixed gp2x_font. | | This function sets up the whole library. | | This function unsets the whole library and returns to GP2X menu. |
gp2x_rectThis type definition is used to blit bitmaps and/or sprites into screen. It contains the following public fields { x,y,w,h,solid,*data; } Note- Set and use the fields manually.
- gp2x_blitter_rect expects the gp2x_rect to be filled ok.
Fields| x | Horizontal coordinate in pixels. | | y | Vertical coordinate in pixels. | | w | Width size in pixels. | | h | Height size in pixels. | | solid | 0 for transparent sprites (black is transparent). 1 for solid rects. | | data | pointer to your sprite/rect data. |
See alsogp2x_blitter_rect
gp2x_fontThis type definition is used to create a custom font. It contains the following public fields { x,y,w,h,fg,bg,solid,*data; } Note- Use gp2x_printf_init to set the variables into a gp2x_font struct. Do not set them manually.
Fields| w | Width of each character, in pixels. | | h | Height of each character, in pixels. | | fg | Foreground font color. | | bg | Background font color (when solid is not 0). | | solid | When 1, background font color is used. When 0, transparent background font is used. | | data | Pointer to your font bitmap. |
See alsogp2x_printf, gp2x_printf_init
GP2X joystick valuesThis enumeration contains all the possible values which gp2x_joystick_read may return. Constants| GP2X_UP | joystick up | | GP2X_DOWN | joystick down | | GP2X_LEFT | joystick left | | GP2X_RIGHT | joystick right | | GP2X_PUSH | joystick push | | GP2X_L | button L | | GP2X_R | button R | | GP2X_A | button A | | GP2X_B | button B | | GP2X_X | button X | | GP2X_Y | button Y | | GP2X_START | button START | | GP2X_SELECT | button SELECT | | GP2X_VOL_DOWN | button volume down (-) | | GP2X_VOL_UP | button volume up (+) |
See alsogp2x_joystick_read
gp2x_dualcore_data(address)This macro retrieves or sets a value into a shared address; it works for both 920T and 940T cores. Memory map for our shared area for the current libraryrange 0x00000000-0x00000FFF (4 kb) is reserved range 0x00001000-0x00007FFF (8 kb) is free, and non-cacheable range 0x00008000-0x00F00000 (15 Mb) is free, and cacheable UsageTo be written See alsogp2x_dualcore_pause, gp2x_dualcore_sync, gp2x_dualcore_exec
gp2x_ticksInternal variable which holds current conversion between desired ticks and GP2X ticks. Note- Do not modify this variable directly. Use gp2x_init instead.
See alsogp2x_timer_read, gp2x_timer_delay
gp2x_video_YUV| gp2x_video_layer gp2x_video_YUV[4] |
This struct allows you to work directly with YUV video layer. It contains three pointers which are updated in each gp2x_video_YUV_flip call. There are for YUV regions, each one with its own framebuffer. Each framebuffer orientation is top-left (common orientation). Contains| screen8 | 08 bits pointer to the hidden video surface. | | screen16 | 16 bits pointer to the hidden video surface. | | screen32 | 32 bits pointer to the hidden video surface. This is the default pointer when working in Y/Cb/Cr video mode. |
NoteExamplegp2x_video_YUV[1].screen32[160+120*320]=gp2x_video_YUV_color(255,255,255); //write white at (160,120) gp2x_video_YUV_flip(1);
gp2x_video_RGB| gp2x_video_layer gp2x_video_RGB[1] |
This struct allows you to work directly with RGB video layer. It contains three pointers which are updated in each gp2x_video_RGB_flip call. There is a single RGB region, with a single framebuffer. The framebuffer orientation is top-left (common orientation). Contains| screen8 | 08 bits pointer to the hidden video surface. This is the default pointer when working in palettized video mode. | | screen16 | 16 bits pointer to the hidden video surface. This is the default pointer when working in hicolor video mode. | | screen32 | 32 bits pointer to the hidden video surface. |
NoteExamplegp2x_video_RGB[0].screen16[160+120*320]=gp2x_video_RGB_color15(255,255,255, 0); //write white at (160,120) gp2x_video_RGB_flip(0);
or...
gp2x_video_RGB_color8(255,255,255, 1); gp2x_video_RGB_setpalette(); gp2x_video_RGB[0].screen8[160+120*320]=1; //write white at (160,120) gp2x_video_RGB_flip(0);
gp2x_video_waitvsync| void gp2x_video_waitvsync( | void | ) |
|
This function halts the program until a vertical sync is done. See alsogp2x_video_waithsync
gp2x_video_waithsync| void gp2x_video_waithsync( | void | ) |
|
This function halts the program until an horizontal sync is done. See alsogp2x_video_waitvsync
gp2x_video_setgammacorrection| void gp2x_video_setgammacorrection( | float | gamma | ) |
|
This function sets the Gamma correction value for the whole display. Parameters| gamma (0.00 .. 2.00) | from 0.00 (darkest) to 2.00 (brightest). |
Default
gp2x_video_setdithering| void gp2x_video_setdithering( | int | mode | ) |
|
This function sets the dithering values for all the video layers. Note- This function only works when merging layers of different bits per pixel.
Parameters| mode (0,1,2) | set mode to 0 for 2x2 dithering, 1 for 4x4 dithering, and 2 to disable dithering. |
Default- mode is set to 0 (2x2 dithering).
gp2x_video_setluminance| void gp2x_video_setluminance( | int | contrast, | | int | brightness | ) |
|
This function sets the contrast/brigness values for the YUV/OSD layers. Parameters| contrast (0..7) | adjusts contrast where as 0=1.00, 1=1.125... 7=1.875 are contrast values. | | brightness (0..255) | adjusts brightness. |
Default- contrast is set to 0
- brightness is set to 0
gp2x_video_cursor_setalpha| void gp2x_video_cursor_setalpha( | int | FG_A, | | int | BG_A | ) |
|
This function sets the alpha blending of both background and foreground cursor colors. Parameters| FG_A (0..15) | Foreground alpha blending value. | | BG_A (0..15) | Background alpha blending value. |
Default- FG_A and BG_A both are set to 15 (100% solid, no transparency).
See alsogp2x_video_cursor_show, gp2x_video_cursor_move, gp2x_video_cursor_setup
gp2x_video_cursor_setup| void gp2x_video_cursor_setup( | unsigned | char | * | src, | | | int | | size, | | unsigned | char | | FG, | | | int | | FG_R, | | | int | | FG_G, | | | int | | FG_B, | | | int | | FG_A, | | unsigned | char | | BG, | | | int | | BG_R, | | | int | | BG_G, | | | int | | BG_B, | | | int | | BG_A | ) |
|
This function sets the shape, size, colour and alpha blending of the cursor. Parameters| *src | pointer to a data area containing the cursor shape. each byte in the area corresponds to a pixel in the cursor shape. you can define your own foreground (FG), background (BG) and transparent (any other else) colors. | | size (8,16,32,64) | square size of the cursor shape. | | FG (0..255) | byte which identifies foreground pixels in your *src area. Usually set to 1. | | FG_R (0..255) | red component for your foreground shape color | | FG_B (0..255) | green component for your foreground shape color | | FG_G (0..255) | blue component for your foreground shape color | | FG_A (0..15) | alpha blending for foreground shape color | | BG (0..255) | byte which identifies foreground pixels in your *src area. Usually set to 0 or 2. | | BG_R (0..255) | red component for background shape color | | BG_B (0..255) | green component for background shape color | | BG_G (0..255) | blue component for background shape color | | BG_A (0..15) | alpha blending for background shape color |
Default- The default cursor holds an arrow sprite of 16 pixels. Its foreground color defaults to white, and background one to black. There is no transparency set for the default cursor.
See alsogp2x_video_cursor_show, gp2x_video_cursor_move, gp2x_video_cursor_setalpha
gp2x_video_logo_enable| void gp2x_video_logo_enable( | int | yes | ) |
|
This function displays the minimal logo watermarked at bottom right of screen. Adding this logo to your application makes rlyeh (me) happier and glad with you :-) Note- Note that this function uses the cursor layer to work, so you cannot display a cursor and the minimal logo at same time.
Parameters| yes (0,1) | 1 enables logo. 0 disables it. |
Default- yes is set to 0. Logo is disabled by default.
gp2x_video_RGB_color8| void gp2x_video_RGB_color8 ( | int | R, | | int | G, | | int | B, | | int | C | ) |
|
This function sets the palettized color entry C to a given triad of R,G,B components. All color changes will get updated at next gp2x_video_RGB_setpalette call. NoteParameters| C (0..255) | Palettized color entry to change | | R (0..255) | Red component | | G (0..255) | Green component | | B (0..255) | Blue component |
See alsogp2x_video_RGB_setpalette
gp2x_video_RGB_color15| unsigned short gp2x_video_RGB_color15( | int | R, | | int | G, | | int | B, | | int | A | ) |
|
This function returns the 16bits color for a given triad of R,G,B components. It returns a short in 5515:RGAB format. Parameters| R (0..255) | Red component | | G (0..255) | Green component | | B (0..255) | Blue component | | A (0,1) | General purpose boolean value. Usually sets to 0. |
gp2x_video_RGB_color16| unsigned short gp2x_video_RGB_color16( | int | R, | | int | G, | | int | B | ) |
|
This function returns the 16bits color for a given triad of R,G,B components. It returns a short in 565:RGB format. Parameters| R (0..255) | Red component | | G (0..255) | Green component | | B (0..255) | Blue component |
gp2x_video_RGB_setcolorkey| void gp2x_video_RGB_setcolorkey( | int | R, | | int | G, | | int | B | ) |
|
This function sets the colorkey transparent value for all RGB colorkeyed regions. Notes- This R,G,B triad uses 0..15 units instead of 0..255.
- All regions marked as 0x10 will transparent those pixels which match the given R,G,B triad.
Parameters| R (0..15) | red component | | G (0..15) | green component | | B (0..15) | blue component |
DefaultSee alsogp2x_video_RGB_setwindows
gp2x_video_RGB_setscaling| void gp2x_video_RGB_setscaling( | int | W, | | int | H | ) |
|
This function adjusts a given resolution to fit the whole display (320,240). Notes- Draw at (0,0) coordinates always, whatever resolution you are working with.
- Call this function once. Do not call this function in every frame.
Parameters| W (1..) | virtual width in pixels to scale to 320. | | H (1..) | virtual height in pixels to scale to 240. |
Default- (W,H) are set to (320,240).
gp2x_video_RGB_flip| void gp2x_video_RGB_flip( | int | layer | ) |
|
This function flips video buffers. It updates pointers located at gp2x_video_RGB struct too. The current pointers will point to the hidden display until a new gp2x_video_RGB_flip() call is done. Note- This function does not wait for the vertical/horizontal retraces. You should use gp2x_video_waitvsync or gp2x_video_waithsync if needed.
- RGB has one layer, one region and four windows. Everything works merged in the same layer.
- It is a mistake confusing ‘layer’, ‘region’, ‘part’ and ‘window’. They are not the same.
Parameters| layer (0) | RGB layer to flip. Note that currently there is support for RGB layer 0 only. |
See alsogp2x_video_YUV_flip
gp2x_video_RGB_setwindows| void gp2x_video_RGB_setwindows( | int | window0, | | int | window1, | | int | window2, | | int | window3, | | int | x, | | int | y | ) |
|
This function enables, disables and sets screen up to four RGB windows. Notes- You can disable a window by setting a negative value.
- Any positive value will cause the window to be alpha blended (0..0x0F), to act as a sprite (0x10), or to be solid (0x11).
- Alpha values are in 0..15 range. Think about it like a 0% to 100% blending in steps of 6.25%.
- gp2x_video_RGB_setcolorkey sets the transparent pixel color for all regions.
Parameters| window0 (-1..17) | -1 to disable window0, 0..0xF for alpha blending window0, 0x10 for transparent window0, 0x11 for solid window0 | | window1 (-1..17) | -1 to disable window1, 0..0xF for alpha blending window1, 0x10 for transparent window1, 0x11 for solid window1 | | window2 (-1..17) | -1 to disable window2, 0..0xF for alpha blending window2, 0x10 for transparent window2, 0x11 for solid window2 | | window3 (-1..17) | -1 to disable window3, 0..0xF for alpha blending window3, 0x10 for transparent window3, 0x11 for solid window3 | | x,y ((0,0)..(320,240)) | Screen coordinate which breaks resolution into 4 regions. Check diagrams below for a few examples. |
+-------+-------+ (x,y) = (160,120) +-----------+---+ (x,y) = (240,180) +---------------+ (x,y) = (319,239) | | | | | | | | | 0 | 1 | | | | | | | | | | 0 | 1 | | | +-------P-------+ | | | | 0 | | | | | | | | | | 2 | 3 | +-----------P---+ | | | | | | 2 | 3 | | | +-------+-------+ +-----------+---+ +---------------P
+-------+-------+ (x,y) = (160,239) +---------------+ (x,y) = (0,239) +---------------+ (x,y) = (0,120) | | | | | | | | | | | | | 1 | | | | | | | | | 0 | 1 | | 1 | P---------------+ | | | | | | | | | | | | | 3 | | | | | | | | +-------P-------+ P---------------+ +---------------+
P---------------+ (x,y) = (0,0) +---+-----------+ (x,y) = (80,60) +-------P-------+ (x,y) = (160,0) | | | 0 | 1 | | | | | | +---P-----------+ | | | | | | | | | | | | 3 | | | | | 2 | 3 | | | | 2 | 3 | | | | | | | | | | | | | | | | | | | | +---------------+ +---+-----------+ +-------+-------+
+---------------P (x,y) = (319,0) +---------------+ (x,y) = (319,120) | | | | | | | 0 | | | | | | 2 | +---------------P | | | | | | | 2 | | | | | +---------------+ +---------------+ etc...
Default- (window0,window1,window2,window3) are set to (0x11,-1,-1,-1).
- (x,y) are set to (319,239).
See alsogp2x_video_RGB_setcolorkey
gp2x_video_YUV_color| unsigned long gp2x_video_YUV_color( | int | R, | | int | G, | | int | B | ) |
|
This function returns a YUY2 (Cr0/Y1/Cb0/Y0) 32bits color pixel from a given R,G,B triad. Parameters| R (0..255) | red component | | G (0..255) | green component | | B (0..255) | blue component |
CreditsRobBrown
gp2x_video_YUV_setscaling| void gp2x_video_YUV_setscaling( | int | region, | | int | W, | | int | H | ) |
|
This function adjusts a given resolution to fit the whole display (320,240). Notes- Draw at (0,0) coordinates of each framebuffer always, whatever resolution you are working with.
- Call this function once. Do not call this function in every frame.
Parameters| region (0..3) | YUV region (0..3) | | W (1..) | virtual width in pixels to scale to 320. | | H (1..) | virtual height in pixels to scale to 240. |
Default- (W,H) are set to (320,240) for each region.
gp2x_video_YUV_flip| void gp2x_video_YUV_flip( | int | region | ) |
|
This function flips video buffers. It updates pointers located at gp2x_video_YUV struct too. The current pointers will point to the hidden display until a new gp2x_video_YUV_flip() call is done. Note- This function does not wait for the vertical/horizontal retraces. You should use gp2x_video_waitvsync or gp2x_video_waithsync if needed.
- YUV has 2 layers (A/B), 4 regions and no windows.
- It is a mistake confusing ‘window’, ‘region’, ‘part’ and ‘layer’. They are not the same.
Parameters| region (0..3) | YUV layer to flip |
See alsogp2x_video_RGB_flip
gp2x_video_YUV_setparts| void gp2x_video_YUV_setparts( | int | part0, | | int | part1, | | int | part2, | | int | part3, | | int | x, | | int | y | ) |
|
This function enables, disables and sets up screen to four YUV parts. Notes- You can disable a region by setting a negative value.
- Any positive value will active the region, and force mirroring or not.
Parameters| part0 (-1..3) | -1 disables part0, 0 sets no mirroring, 1 sets vertical mirroring, 2 sets horizontal mirroring, 3 sets both mirrors | | part1 (-1..3) | -1 disables part1, 0 sets no mirroring, 1 sets vertical mirroring, 2 sets horizontal mirroring, 3 sets both mirrors | | part2 (-1..3) | -1 disables part2, 0 sets no mirroring, 1 sets vertical mirroring, 2 sets horizontal mirroring, 3 sets both mirrors | | part3 (-1..3) | -1 disables part3, 0 sets no mirroring, 1 sets vertical mirroring, 2 sets horizontal mirroring, 3 sets both mirrors | | x,y ((0,0)..(320,240)) | Screen coordinate which breaks resolution into 4 parts. Check diagrams below for a few examples. |
+-------+-------+ (x,y) = (160,120) +-----------+---+ (x,y) = (240,180) +---------------+ (x,y) = (319,239) | | | | | | | | | 0 | 1 | | | | | | | | | | 0 | 1 | | | +-------P-------+ | | | | 0 | | | | | | | | | | 2 | 3 | +-----------P---+ | | | | | | 2 | 3 | | | +-------+-------+ +-----------+---+ +---------------P
+-------+-------+ (x,y) = (160,239) +---------------+ (x,y) = (0,239) +---------------+ (x,y) = (0,120) | | | | | | | | | | | | | 1 | | | | | | | | | 0 | 1 | | 1 | P---------------+ | | | | | | | | | | | | | 3 | | | | | | | | +-------P-------+ P---------------+ +---------------+
P---------------+ (x,y) = (0,0) +---+-----------+ (x,y) = (80,60) +-------P-------+ (x,y) = (160,0) | | | 0 | 1 | | | | | | +---P-----------+ | | | | | | | | | | | | 3 | | | | | 2 | 3 | | | | 2 | 3 | | | | | | | | | | | | | | | | | | | | +---------------+ +---+-----------+ +-------+-------+
+---------------P (x,y) = (319,0) +---------------+ (x,y) = (319,120) | | | | | | | 0 | | | | | | 2 | +---------------P | | | | | | | 2 | | | | | +---------------+ +---------------+ etc...
Default- (part0,part1,part2,part3) are set to (-1,-1,-1,-1).
- (x,y) are set to (319,239).
gp2x_blitter_rect| void ( | * | gp2x_blitter_rect | )(gp2x_rect *r) |
|
This function blits a gp2x_rect into screen. NoteThis function does not perform any clipping. Parameters
gp2x_joystick_read| unsigned long gp2x_joystick_read( | void | ) |
|
This function returns the active GP2X joystick values. NoteCall this function once per frame keep your joystick values updated. UsageIn order to detect simultaneous values you will have to mask the value. See alsoGP2X joystick values Exampleunsigned long pad=gp2x_joystick_read();
if(pad&GP2X_R) if(pad&GP2X_L) ... //both L and R are pressed.
gp2x_sound_frame| extern void gp2x_sound_frame( | void | * | blah, | | void | * | buffer, | | int | | samples | ) |
|
This function is automatically called by the library, and expects a sound buffer to be filled in. Notes- This function is not included in the library itself.
- Supply this function in your own program.
- Do not call this function directly.
Parameters| *blah | unused in this release. | | *buffer | pointer to store the sound data. | | samples | number of samples, NOT bytes. |
ExamplesCheck samples section.
gp2x_sound_volume| void gp2x_sound_volume( | int | L | /*0..100*/, | | int | R | /*0..100*/ | ) |
|
This function sets the sound volume. Parameters| L (0..100) | volume percentage for the left channel | | R (0..100) | volume percentage for the right channel |
Note- A higher percentage than 100 will distort your sound.
Default- L is set to 100.
- R is set to 100.
See alsogp2x_sound_pause Creditssnaff
gp2x_sound_pause| void gp2x_sound_pause( | int | yes | ) |
|
This function pauses and unpauses the sound. Parameters| yes (0,1) | set it to 1 to enable pause (mute sound), and 0 to disable pause (play sound). |
See alsogp2x_sound_volume
gp2x_dualcore_pause| void gp2x_dualcore_pause( | int | yes | ) |
|
This function pauses the secondary ARM 940T coprocessor. Note- Call this function only from your 920T program.
Parameters| yes (0,1) | set it to 1 to enable pause (halt 940T), and 0 to disable pause (run 940T). |
See alsogp2x_dualcore_sync, gp2x_dualcore_exec, gp2x_dualcore_data(address)
gp2x_dualcore_launch_program| void gp2x_dualcore_launch_program( | unsigned | long | * | area, | | unsigned | long | | size | ) |
|
This function sets the 940T program, and launchs it. Note- Call this function only from your 920T program.
Parameters| *area | pointer to the 940T raw binary. | | size (1..) | size of 940T raw binary, in bytes. |
See alsogp2x_dualcore_launch_program_from_disk, gp2x_dualcore_launch_subprogram(name)
gp2x_dualcore_launch_program_from_disk| void gp2x_dualcore_launch_program_from_disk( | const | char | * | file, | | unsigned | long | | offset, | | unsigned | long | | size | ) |
|
This function sets the 940T program, and launchs it. Note- Call this function only from your 920T program.
Parameters| *file | string to the file which contains the 940T raw binary. | | offset (0..) | amount of bytes to skip at the beginning of the file. | | size (1..) | size of 940T raw binary, in bytes. |
See alsogp2x_dualcore_launch_program, gp2x_dualcore_launch_subprogram(name)
gp2x_dualcore_declare_subprogram(name)
gp2x_dualcore_launch_subprogram(name)
gp2x_printf| void gp2x_printf( | | gp2x_font | * | f, | | | int | | x, | | | int | | y, | | const | char | * | format, | | | | | ... | ) |
|
This function printfs a string into the RGB layer. Note- This function does not perform any clipping.
Parameters| *f | gp2x_font or NULL. NULL will use the default 6x10 font. | | x (0..320) | Horizontal coordinate for the given string If x is negative, gp2x_printf() will continue on last known horizontal position. | | y (0..240) | Vertical coordinate for the given string If y is negative, gp2x_printf() will continue on last known vertical position. | | format | C formatted standard string. |
See alsogp2x_printf_init Examplea=1; gp2x_printf(NULL, 0, 0,"Hello %dst world\n",a); gp2x_printf(NULL,-1,-1,"Hello %dnd world\n",++a);
...it outputs...
Hello 1st world (at top-left of screen) Hello 2nd world (under the previous line)
gp2x_printf_init| void gp2x_printf_init( | gp2x_font | * | f, | | int | | w, | | int | | h, | | void | * | data, | | int | | fg, | | int | | bg, | | int | | solid | ) |
|
This function allows you to set your own fixed gp2x_font. Parameters| *f | Pointer to a gp2x_font struct. | | w (1..) | Width of each character, in pixels. | | h (1..) | Height of each character, in pixels. | | *data | Pointer to your font bitmap. | | fg | Foreground font color. | | bg | Background font color (when solid is not 0). | | solid (0,1) | When 1, background font color is used. When 0, transparent background font is used. |
See alsogp2x_printf
gp2x_init| void gp2x_init( | int | ticks_per_second, | | int | bpp, | | int | rate, | | int | bits, | | int | stereo, | | int | Hz, | | int | solid_font | ) |
|
This function sets up the whole library. Notes- You have to call this function before any other function.
- If you are merging both SDL and Minimal Library in your project, you will have to call gp2x_init after any SDL_Init() / SDL_SetVideoMode() / SDL_CreateRGBSurface() call.
Parameters| ticks_per_second (1..7372800) | sets internal gp2x_ticks. Eg, set it to 1000 to work in milliseconds. | | bpp (8,15,16) | sets the bits per pixel video mode | | rate (11025,22050,44100) | sets the sound frequency rate | | bits (16) | sets the sound bits. GP2X supports 16 bits only. | | stereo (0,1) | sets the stereo mode. 1 for stereo, 0 for mono. | | Hz (unused) | sets sound poll frequency, in hertzs. Unused in this release. | | solid_font (0,1) | sets default 6x10 font to have solid background or not. |
See alsogp2x_deinit
gp2x_deinitThis function unsets the whole library and returns to GP2X menu. Note- You can exit() your program, or call this function directly.
See alsogp2x_init
|