Talk:SDL Wii/tutorial

From WiiBrew
Jump to navigation Jump to search

Lazy Foo Productions

He once made a C++-based SDL tutorial that looks suspiciously similar to this... --Amitron94 16:56, 15 November 2009 (UTC)

Wiimote buttons

What's the best way to use the Wiimote with WPAD_ScanPads or with Wiimote SDL joystick mapping? Because in your tutorial you are using WPAD's functions. Thanks, Crayon 16:21, 26 May 2009 (UTC)

Well, I don't know. Never tried it with SDL joystick mapping and I dont know how I can use it. If somebody can explain how to use joystick mapping I may add it in my tutorials. GabberNL 18:09, 26 May 2009 (UTC)
Thanks, it could be great to include it in your tutorials if you find out how to use SDL joystick mapping. -Crayon 19:15, 26 May 2009 (UTC)
If you want a joystick example, you can check the UAE Wii menu code here (until line 718). The SDL page describes the button mappings. It only shows the DPAD and buttons, but the rest is available in the man-pages. --SimonKagstrom 13:04, 27 May 2009 (UTC)
Thanks, I'll check that later -Crayon 17:46, 27 May 2009 (UTC)

GabberNL, I tried to use WPAD_ButtonsDown in my SDL game but only WPAD_ButtonsHeld seems to work (like in your tutorial). Do I need to do something special to make WPAD_ButtonsDown work? -Crayon 17:46, 27 May 2009 (UTC)

Well, does it compile? Because when I try it, it does compile so I think it will also work on the Wii (haven't tested it). Have you declared down the right way? like:
u32 down = WPAD_ButtonsDown(0);

GabberNL 18:25, 27 May 2009 (UTC)

That's exactly what I've tried, it's working in my non SDL game Wii-Tac-Toe. Every thing is compiling correctly, it's just not working with my SDL program! -Crayon 21:26, 27 May 2009 (UTC)
So it compiles with no problems. Thats good. What happens on the Wii? Does it give a code dump? Maybe you could paste here the source code so I can look into it. That would be much easier. GabberNL 11:06, 28 May 2009 (UTC)
When pressing a button on the Wiimote nothing happen, so no code dump. When I change WPAD_ButtonsHeld to WPAD_ButtonsDown in my code it stops working, so my code is should be fine. I'm going to try with simpler code, just in case it's something elsewhere in the code that as an effect on the Wiimote. -Crayon 12:54, 28 May 2009 (UTC)

Cannot compile the template

I copied the template and all the sdl includes with the libs and dependencies into the libogc folder. I tried to compile it using programmers notepad.

This is the output:

> "make" 
template.c

linking ... SDL_template.elf

c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wii_main.o): In function `main':

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:68: undefined reference to `MOUSE_Init'

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:69: undefined reference to `KEYBOARD_Init'

c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiievents.o): In function `PumpEvents':

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:64: undefined reference to `KEYBOARD_GetEvent'

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:65: undefined reference to `MOUSE_GetEvent'

collect2: ld returned 1 exit status

make[1]: *** [/c/devkitPro/examples/wii/SDL_template/SDL_template.elf] Error 1

"make": *** [build] Error 2

> Process Exit Code: 2

> Time Taken: 00:02
I think this is because the most recent build needs to be used with the svn version of libogc. If you don't want to update libogc, download an older version of SDL, like this one: http://sdl-wii.googlecode.com/files/SDL%20Wii%2004-23-2009.zip -Crayon 18:31, 1 June 2009 (UTC)
Thanks Crayon, it worked. I made about 4 or 5 games on SDL for the pc last year. I think I'll port them to the wii now. --Sal3000 18:56, 1 June 2009 (UTC)
How do I update to the latest svn version of libogc? Can anyone confirm that this will work? Thanks. Charlatan 22:04, 17 June 2009 (UTC)
I also tried to update libogc to the latest svn version, but that still didn't solve the problem. It gave me alot more errors. So I uninstalled Devkit and all of his components and reinstalled it with this SDL version: [1] (the older one..) GabberNL 09:08, 18 June 2009 (UTC)

SDL_mixer to play modules?

Thanks for your tutorials. Do you (or anyone else) have a tutorial or example code for using SDL_mixer to play MOD/XM/IT/etc. files? I've found that gcmodplay doesn't play MODs properly. I'm hoping that SDL_mixer works better. Thanks in advance. Charlatan 04:12, 25 June 2009 (UTC)

Cannot find a working combination

there seems to be big problems with getting sdl-wii working - i tried downloading devkitpro and the precompiled sdl (didn't work), updated libogc and sdl-wii to the latest svn builds (didn't work), kept the updated libogc and tried both of the older sdl-wii builds (04-23 and 05-13) - also didn't work, and gave me the same messages seen above. who the heck is daryl? what gives? some people clearly have found a way to make this work, why is it so inconsistent? Madmanguruman 02:53, 26 July 2009 (UTC)

The latest svn of everything works. Yes, I know, it would be nice if the latest releases of both libogc and SDL Wii worked together. But, alas it's not the case. The piece you're probably missing is to change your makefile. Take a look at Super Mario War Wii's Makefile or other such projects. --Tantric 06:19, 26 July 2009 (UTC)
nope - grabbed the super mario war makefile - still gettting SDL_main linker errors. severely frustrating that it "should" work, or it "works for person x" but the steps needed to actually make it work are either missing a critical step or are a function of chance more than anything... Madmanguruman 13:24, 26 July 2009 (UTC)
Sorry, programming is not a "function of chance". If it is...then you need to learn how to program! If you're getting an error about SDL_main it's probably the common SDL error people get (not specific to the Wii), caused by not having int main(int argc, char *argv[]) defined, but rather some variant of that instead. --Tantric 17:09, 26 July 2009 (UTC)
the source code i used is 100% copied and pasted from this tutorial, and it does not follow the convention you describe. clearly something else is awry, because (1) i doubt the author would post impossible-to-compile code, and (2) changing the code to match what you (and many others online) have described does not fix the issue. please do not confuse my unfamiliarity with this toolchain for a lack of programming ability - the function of chance i was referring to is in configuring the toolchain and sdl_wii libs...Madmanguruman 21:16, 26 July 2009 (UTC)
What is the exact error message you're getting? Or better yet, you could go onto #wiidev on EFNet if you're still having troubles. --Tantric 21:46, 26 July 2009 (UTC)
Got everything going. Thanks for the help. I made an installation help page which has some more details, hope some can make use of it. SDL Wii/installation help Madmanguruman 02:37, 28 July 2009 (UTC)

Initializing libfat

I did this tutorial, and it worked, but every time I would try to expand upon it, my code would fail. I could not open any files (neither for reading nor for writing) This confused the heck out of me, because the tutorial already reas a file with: SDL_LoadBMP("sd:/apps/SDL/background.bmp"); and that part worked fine. What I did not realize is that SDL apparently does its own libfat init. To be able to access files manually, I also had to add #include <fat.h> and fatInitDefault(); --James Paige 16:04, 24 January 2010 (UTC)