Line 11: |
Line 11: |
| : Someone should write a more thorough tutorial! There's still lots of SDL stuff people could port. --[[User:Tantric|Tantric]] 15:34, 24 April 2009 (UTC) | | : Someone should write a more thorough tutorial! There's still lots of SDL stuff people could port. --[[User:Tantric|Tantric]] 15:34, 24 April 2009 (UTC) |
| :: As someone who just finished re-writing a great portion of SDL-Wii I think you're a great candidate! ;) Seriously though I would love to see a good tutorial or even just an API reference written. I am madly reading the main SDL tutorial in the hope of figuring out if I can attempt to port the Intellivision emulator jzInTV to the Wii, a programme that thankfully already uses SDL. My biggest problem, aside from never using SDL before, is emulation of the 12+ button keypad. Anyway bring on a good tutorial / reference it would certainly help me in my quest - if I ever really start it. [[User:Ensign R|Ensign R]] 02:07, 1 May 2009 (UTC) | | :: As someone who just finished re-writing a great portion of SDL-Wii I think you're a great candidate! ;) Seriously though I would love to see a good tutorial or even just an API reference written. I am madly reading the main SDL tutorial in the hope of figuring out if I can attempt to port the Intellivision emulator jzInTV to the Wii, a programme that thankfully already uses SDL. My biggest problem, aside from never using SDL before, is emulation of the 12+ button keypad. Anyway bring on a good tutorial / reference it would certainly help me in my quest - if I ever really start it. [[User:Ensign R|Ensign R]] 02:07, 1 May 2009 (UTC) |
− |
| |
− | == Image ==
| |
− |
| |
− | Hello,
| |
− |
| |
− | I just managed SDL to work on my wii, and i've made a little program with controller input. I've made it so, that it will show a red background when i push on the right button. What i want is to show a photo when i press the right button. How can i do that? Do I need to include SDL_image? And what's the function i have to use?
| |
− |
| |
− | Thanks, [[User:GabberNL|GabberNL]] 14:25, 28 April 2009 (UTC)
| |
− |
| |
− | :===Update===
| |
− | I used this function:
| |
− |
| |
− | <source lang="cpp">
| |
− | SDL_Surface *load_image( std::string filename )
| |
− | {
| |
− | //Temporary storage for the image that's loaded
| |
− | SDL_Surface* loadedImage = NULL;
| |
− |
| |
− | //The optimized image that will be used
| |
− | SDL_Surface* optimizedImage = NULL;
| |
− |
| |
− | //Load the image
| |
− | loadedImage = SDL_LoadBMP( filename.c_str() );
| |
− |
| |
− | //If nothing went wrong in loading the image
| |
− | if( loadedImage != NULL )
| |
− | {
| |
− | //Create an optimized image
| |
− | optimizedImage = SDL_DisplayFormat( loadedImage );
| |
− |
| |
− | //Free the old image
| |
− | SDL_FreeSurface( loadedImage );
| |
− | }
| |
− |
| |
− | //Return optimized image
| |
− | return optimizedImage;
| |
− | }
| |
− | </source>
| |
− |
| |
− | And applied the loaded image to a new surface with this function:
| |
− |
| |
− | <source lang="cpp">
| |
− | void apply_surface ( int x, int y, SDL_Surface* source, SDL_Surface* destination )
| |
− | {
| |
− | //Make a temporary rectangle to hold the offsets
| |
− | SDL_Rect offset;
| |
− |
| |
− | //Give the offsets tot the rectangle
| |
− | offset.x = x;
| |
− | offset.y = y;
| |
− |
| |
− | //Blit the surface
| |
− | SDL_BlitSurface( source, NULL, destination, &offset );
| |
− | }
| |
− | </source>
| |
− |
| |
− | But when i try to compile it it sais it doesnt have the length of the image. Can somebody help me?
| |
− |
| |
− | [[User:GabberNL|GabberNL]] 14:17, 13 May 2009 (UTC)
| |
| | | |
| == __static_initialization_and_destruction_0 error == | | == __static_initialization_and_destruction_0 error == |