You are not logged in.
hey there, i got the problem that i just wanted to spin an image.
i've tried to let it fade in and out that works well, but after i inserted the simple 4 lines of code for spinning it, it spins my image then it let it fade out and then right before exiting the program i get just a whole screen in red green etc with image corruption thats it... it just hangs there.
if i delete the 4 lines from spinning it works well again...
//fading in the background image for(i=0;i<=0xff;i+=4){ GRRLIB_FillScreen(bgcolor); GRRLIB_DrawImg((640 - tex_bg.w) / 2, (480 - tex_bg.h) / 2, tex_bg, 0, 1, 1, 0xFFFFFF00|i); GRRLIB_Render(); } //spin the image for(i=0;i<=8000;i+=40){ GRRLIB_DrawImg((640 - tex_bg.w) / 2, (480 - tex_bg.h) / 2, tex_bg, i, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); }
Offline
Hey, could you tell what is the type of i? Is it an int or something else?
Make your code faster by calculating those things outside the loop.
* (640 - tex_bg.w) / 2
* (480 - tex_bg.h) / 2
Since it's doing weird stuff after this piece of code, could you paste the code after those lines.
Offline
yea you are right its an int declared before.
//mount SD Card SDCard_Init(); //initialize SD: if (!fatInitDefault()) { GRRLIB_Printf(20,50,tex_console,fontcolor,1,"FAT could not be initialized!"); GRRLIB_Printf(20,60,tex_console,fontcolor,1,"restarting..."); GRRLIB_Render(); sleep(5); WIILIGHT_TurnOff(); SDCard_deInit(); //Return to System Menu, exit(0); would be HBC SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } char cfgpath[256]; //Open dol File and check exist sprintf(cfgpath, DolPath); exeFile = fopen (cfgpath ,"rb"); //if nothing found exiting if (exeFile==NULL) { GRRLIB_Printf(20,50,tex_console,fontcolor,1,"Can't open DOL File..."); GRRLIB_Printf(20,60,tex_console,fontcolor,1,"Path strings are %s.", strcmp(cfgpath, DolPath) ? "not equal" : "equal"); GRRLIB_Printf(20,70,tex_console,fontcolor,1,"restarting..."); GRRLIB_Render(); fclose (exeFile); sleep(5); WIILIGHT_TurnOff(); SDCard_deInit(); //Return to System Menu, exit(0); would be HBC SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } int pos = ftell(exeFile); fseek(exeFile, 0, SEEK_END); int size = ftell(exeFile); fseek(exeFile, pos, SEEK_SET); //return to previous position exeBuffer = malloc(size); fread( exeBuffer, 1, size, exeFile); fclose(exeFile); //Check if valid elf file: s32 res; res = valid_elf_image(exeBuffer); if(res == 1) { //elf ok! -> Load entry point of elf file: void (*ep)(); ep = (void(*)())load_elf_image(exeBuffer); // code from geckoloader u32 level; __IOS_ShutdownSubsystems (); _CPU_ISR_Disable (level); __exception_closeall (); ep(); _CPU_ISR_Restore (level); } else { //Elf not valid, load dol: //Stuff for arguments struct __argv argv; bzero(&argv, sizeof(argv)); argv.argvMagic = ARGV_MAGIC; argv.length = strlen(DolPath) + 2; argv.commandLine = malloc(argv.length); if (!argv.commandLine) { GRRLIB_Printf(20,50,tex_console,fontcolor,1,"Error creating arguments, couldn't allocate memory for commandLine."); GRRLIB_Printf(20,60,tex_console,fontcolor,1,"restarting..."); GRRLIB_Render(); sleep(5); WIILIGHT_TurnOff(); SDCard_deInit(); //Return to System Menu, exit(0); would be HBC SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } strcpy(argv.commandLine, DolPath); argv.commandLine[argv.length - 1] = '\x00'; argv.argc = 1; argv.argv = &argv.commandLine; argv.endARGV = argv.argv + 1; //fading out the background image for(i=0xff;i>=0;i-=4){ GRRLIB_FillScreen(bgcolor); GRRLIB_DrawImg((640 - tex_bg.w) / 2, (480 - tex_bg.h) / 2, tex_bg, 0, 1, 1, 0xFFFFFF00|i); GRRLIB_Render(); } run_dol(exeBuffer, &argv); } } SDCard_deInit(); GRRLIB_Exit(); //very important to clean up free(tex_bg.data); free(tex_console.data); return 0;
thats the code after that.
so im fading in with grrlib and fading out at the end.
and meanwhile i would like to add some effects or just try it out with grrlib
Offline
I know it nothing to do with your problem, but why don't you do the spinning and the fading at the same time?
Something like this:
for(i=0;i<=0xff;i+=4){ GRRLIB_FillScreen(bgcolor); GRRLIB_DrawImg((640 - tex_bg.w) / 2, (480 - tex_bg.h) / 2, tex_bg, i*10, 1, 1, 0xFFFFFF00|i); GRRLIB_Render(); }
Not sure if this might have get rid of your problem by fluke too
Offline