You are not logged in.
Issue #1: I'm creating custom images for the menu selection of my game. They're saved in non-interlaced PNG format. Dimensions are 280x48. The problem is, when I run them through WiiBuilder 1.0 to convert them to *.h files, it gives me the message: Warning: not a multiple of 4. If I add the image.h file to my DevKitPro project, it will compile, but when I run the game, the new images just come out as garbled pixels. Anyone know how to fix this?
Issue #2: In an attempt to make a quick and easy way to fade images in and out (for splash/menu purposes), I made some modifications to my v3.0 GRRLIB.c and GRRLIB.h files.
Here are the mods I made to GRRLIB.c:
inline void GRRLIB_DrawImg_FadeInOut(u16 width, u16 height, u8 data[], float scaleX, f32 scaleY, u16 speed) { GRRLIB_DrawImg_FadeIn(width, height, data, scaleX, scaleY, speed); GRRLIB_DrawImg_FadeOut(width, height, data, scaleX, scaleY, speed); } inline void GRRLIB_DrawImg_FadeIn(u16 width, u16 height, u8 data[], float scaleX, f32 scaleY, u16 speed) { alpha=0; for (alpha=0 ; alpha < 255 ; ) { GRRLIB_DrawImg((640-width)/2, (480-height)/2, width, height, data, 0, scaleX, scaleY, alpha ); GRRLIB_Render(); alpha = alpha + speed; } } inline void GRRLIB_DrawImg_FadeOut(u16 width, u16 height, u8 data[], float scaleX, f32 scaleY, u16 speed) { alpha=0; for (alpha=255 ; alpha > 0 ; --alpha) { GRRLIB_DrawImg((640-width)/2, (480-height)/2, width, height, data, 0, scaleX, scaleY, alpha ); GRRLIB_Render(); alpha = alpha - speed; } }
Here are the mods to GRRLIB.h:
inline void GRRLIB_DrawImg_FadeInOut(u16 width, u16 height, u8 data[], float scaleX, f32 scaleY, u16 speed); inline void GRRLIB_DrawImg_FadeIn(u16 width, u16 height, u8 data[], float scaleX, f32 scaleY, u16 speed); inline void GRRLIB_DrawImg_FadeOut(u16 width, u16 height, u8 data[], float scaleX, f32 scaleY, u16 speed);
Here is the code that draws my images in my Menu.cpp file:
void fade_in() { // Starts black, then fades out GRRLIB_DrawImg_FadeInOut(640,480,tex_black,1,1,1); // Fades in splash image GRRLIB_DrawImg_FadeInOut(640,480,tex_splash,1,1,1); GRRLIB_Render(); // Draws title and menu images GRRLIB_DrawImg(0,0,640,480,tex_title,0,1,1,255); GRRLIB_DrawImg(212,230,216,68,tex_newgame_up,0,1,1,255); GRRLIB_DrawImg(212,308,216,68,tex_options_up,0,1,1,100); GRRLIB_DrawImg(212,286,216,68,tex_hbc_up,0,1,1,255); GRRLIB_Render(); }
My problem is, the Splash image only stays on the screen for approx 1-3 seconds before it loads the main title screen and menu buttons. Is there a way to display the splash for maybe 5 seconds total time before changing to the title screen? It's just changing too fast. I tried changing my speed variable from 1 to say 0.5, but when I do this, it doesn't load the image at all.
Any help is much appreciated.
Offline
Issue #1: Are you really sure the width and height of your image is 280x48? Because if WiiBuilder is reporting this warning that's strange and the effect on the screen seems like the size not being a multiple of 4.
Issue #2:
// Starts black, then fades out
GRRLIB_DrawImg_FadeInOut(640,480,tex_black,1,1,1);
// Fades in splash image
GRRLIB_DrawImg_FadeInOut(640,480,tex_splash,1,1,1);
GRRLIB_Render(); // YOU DON'T NEED TO CALL RENDER HERE, LAST COMMAND IN FADE WAS RENDER
Just put that block of code in a loop to make it stay on the screen longer:
// Draws title and menu images GRRLIB_DrawImg(0,0,640,480,tex_title,0,1,1,255); GRRLIB_DrawImg(212,230,216,68,tex_newgame_up,0,1,1,255); GRRLIB_DrawImg(212,308,216,68,tex_options_up,0,1,1,100); GRRLIB_DrawImg(212,286,216,68,tex_hbc_up,0,1,1,255); GRRLIB_Render();
Offline
Thanks for the help, Crayon. The warning I was getting in WiiBuilder has been fixed. I just had to redo my images until their dimensions were multiples of 4. So they're working now.
As for the fading image issue, I was able to get it to display pretty close to the timing I wanted by changing the code to this:
// Starts black, then fades out GRRLIB_DrawImg(0,0,640,480,tex_black,0,1,1,255); GRRLIB_Render(); // Fades in splash image GRRLIB_FillScreen(0xFF000000); GRRLIB_DrawImg_FadeInOut(640,480,tex_splash,1,1,1);
The fade is apparently alot slower when viewed on the actual Wii, as opposed to testing it in the Dolphin emulator.
Offline
what what what ?? you says that is possible to run GRRLIB_stuff in dolphin ??? please post a little howto from downloading dolphin to run homebrew
thx
Offline
NoNameNo wrote:
what what what ?? you says that is possible to run GRRLIB_stuff in dolphin ??? please post a little howto from downloading dolphin to run homebrew
thx
There's really nothing special to it. I probably forgot to mention you have no input control, unless you're using an XBOX360 pad, in which case I've not tested, cus I'm not cool enough to own a 360. Really, the only thing I use Dolphin for is to make sure a project will even load. Makes it easier/faster when testing something or trying out tutorials.
Other than that, I've noticed I have better luck loading GRRLIB stuff when using Dolphin_r2276 instead of Dolphin_r2630. I uploaded a copy of the version I use, if anyone wants it (link below). One other thing, sometimes you'll get an error when loading a .dol that says: Failed to grab 1 GB of contiguous memory!
Don't worry about it, just reload Dolphin and load your .dol again and it should be fine. The screenshot below was taken after compiling the xane01 example source that comes with GRRLIB 4.0, then ran in Dolphin_r2276. Below the screenshot is a link to download Dolphin from my megaupload.
Screenshot of Dolphin
Download: http://www.megaupload.com/?d=8JJ1ZUSW
Offline