Some code questions

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
TheHorst
Posts: 12
Joined: Thu Apr 13, 2006 10:11 pm

Some code questions

Post by TheHorst »

first: i´ve tried the search ....

how do i play more than one mp3 at the same time? how do i start a second thread for the second mp3?

second question ...
how can i use button input, while this code executes:

Code: Select all

	sprintf(buffer, "gfx/questions/question%04d.png", question);
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 480, 272, ourImage, 0, 0);
	freeImage(ourImage);

	sprintf(buffer, "gfx/balken/balken01.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken02.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken03.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken04.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken05.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken06.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken07.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken08.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken09.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken10.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken11.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken12.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken13.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);

	sprintf(buffer, "gfx/balken/balken13.png");
	ourImage = loadImage(buffer);
	blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
	flipScreen();
	freeImage(ourImage);
	sceKernelDelayThread(2000000);
tanks in advance ...
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

I don't know about the sound (haven't done sound yet) but to get button input from that you can make your own sleep code and call a controller function from that

pseudo code:
draw image
starttime = get time
while ( current time - starttime < X ) {
parseKeys();
sceKernelDelayThread(200); //give a little time to sleep
}
TheHorst
Posts: 12
Joined: Thu Apr 13, 2006 10:11 pm

Post by TheHorst »

Giuliano wrote:I don't know about the sound (haven't done sound yet) but to get button input from that you can make your own sleep code and call a controller function from that

pseudo code:
draw image
starttime = get time
while ( current time - starttime < X ) {
parseKeys();
sceKernelDelayThread(200); //give a little time to sleep
}
thanks, good for my brain, solved that prob!
Post Reply