Difference between revisions of "Talk:SDL Wii"
(→Image) |
|||
Line 19: | Line 19: | ||
Thanks, [[User:GabberNL|GabberNL]] 14:25, 28 April 2009 (UTC) | 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 == |
Revision as of 15:17, 13 May 2009
![]() Archives |
/Archive 1 |
How to port?
Hi. How do I port games with this? Would I be able to port e.g. SuperTux? What is need and what is to do? Ehhhm, I just read I should use my good old friend google to find out. --Woku 13:07, 12 January 2009 (UTC)
To port a game, you must first have its source code. Then change the events that use the keyboard or the mouse and replace them with wiimote controls from wiiuse. --Sal3000 11:20, 24 April 2009 (UTC)
- Someone should write a more thorough tutorial! There's still lots of SDL stuff people could port. --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. 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, GabberNL 14:25, 28 April 2009 (UTC)
- ===Update===
I used this function:
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;
}
And applied the loaded image to a new surface with this function:
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 );
}
But when i try to compile it it sais it doesnt have the length of the image. Can somebody help me?
GabberNL 14:17, 13 May 2009 (UTC)
__static_initialization_and_destruction_0 error
When my program is about to begin linking it gets this error:
File:main.o: In function `__static_initialization_and_destruction_0': j:/D0g_Engine/source/main.cpp:11: undefined reference to `Timer::Timer()' main.o: In function `SDL_main': j:/D0g_Engine/source/main.cpp:15: undefined reference to `cGFXCore::cGFXCore()' j:/D0g_Engine/source/main.cpp:22: undefined reference to `cObjectController::cObjectController()' j:/D0g_Engine/source/main.cpp:25: undefined reference to `initInput()'
And so on...
So in short, basically every function/class I've defined doesn't appear to exist to the linker, this code compiles fine for Windows so is there a setting in the makefile or something else I missed to avoid this?
Thanks in advance, Doogie 10:31, 3 May 2009 (UTC)