 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
BlackRogue
Joined: 25 Jun 2007 Posts: 2
|
Posted: Mon Jun 25, 2007 1:46 am Post subject: New Homebrew Programmer.... images |
|
|
| Code: | int main() {
char buffer[200];
Image* ourImage;
sprintf(buffer, "ourImage.png");
ourImage = loadImage(buffer);
if (!ourImage) {
//Image load failed
printf("Image load failed!\n");
} else {
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while (x < 480) {
while (y < 272) {
blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, 0, 0);
printf("image drawn");
y += 32;
}
x+=32;
y=0;
}
flipScreen();
}
sceKernelSleepThread();
return 0;
}
|
from psp-programming.com, i am starting to try get familiar with the dev tools and such but the one where it handles images, I copied and pasted the code, and yet, it freezes on my psp. Is there anything that looks odd in my main method? Please help me out with this... |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Jun 25, 2007 4:29 am Post subject: |
|
|
FIRST: If you have problems with code from psp-programming.com, you should ask your questions there.
SECOND:
| Code: |
while (x < 480) {
while (y < 272) {
blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, 0, 0);
printf("image drawn");
y += 32;
}
x+=32;
y=0;
}
|
This will just try to draw a 32x32 pixel part of the image to always the same position on screen. So it's quite useless.
THIRD: Make sure you set PSP_MODULE_INFO and PSP_THREAD_ATTR
FOURTH: You need to call sceKernelExitGame() at the point where you want to have the program quit, not sceKernelSleepThread() or else it will just infinitely sit waiting. _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
BlackRogue
Joined: 25 Jun 2007 Posts: 2
|
Posted: Mon Jun 25, 2007 12:07 pm Post subject: Testing it... |
|
|
the 0,0 positioning was when i commented everything out and just left the image draw in the code, but that had the same results.
There is other code defined for when the HOME button is selected so that handles correctly if i was to press HOME, YES, to exit.
And I already have module info defined but I can't google PSP_THREAD_ATTR - what is that? what are the attributes?
I dont know.... if you could give me a sample of a program that has images being used other than psp-programming.com i would greatly appreciate it so i could learn from looking at it. Thank you for your response though! |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Jun 25, 2007 1:08 pm Post subject: |
|
|
It was supposed to be PSP_MAIN_THREAD_ATTR
And there's hundreds of sample codes available spread all over psp-programming.com, especially in the forums. Just use the search function. You should easily be able to find some better code than that one.
PS: You need to init the GU if you want to use it, so you need at least call sceGuInit();
If you use graphics.c you also need to call graphicsInit once on startup, though it does nothing but set a flag - yeah it's immensely stupid. _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|