psp coding tutorial lesson 4 help? (Solved)

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

Moderators: cheriff, TyRaNiD

Post Reply
ravenlife
Posts: 4
Joined: Thu Apr 27, 2006 10:05 am

psp coding tutorial lesson 4 help? (Solved)

Post by ravenlife »

alright guys.

im just learning how to do all this - im currently on the 4th lesson http://www.scriptscribbler.com/psp/tuto ... sson04.htm

im having a problem though

as far asa i can tell - i have done everything that it says in the tutorial - but upon compiling i get the following messages
Image

anybody give me a boot in the right direction with this - ive spent two hours looking at it now - and nothings jumping out at me.
thanks

RavenLife

Code: Select all

//test picture shit - mughahahah

#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"

#define printf pspDebugScreenPrintf
#define MAX&#40;X, Y&#41; &#40;&#40;X&#41; > &#40;Y&#41; ? &#40;X&#41; &#58; &#40;Y&#41;&#41;

PSP_MODULE_INFO&#40;"Image Display Program", 0, 1, 1&#41;;
/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41; &#123;
          sceKernelExitGame&#40;&#41;;
          return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41; &#123;
          int cbid;

          cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
          sceKernelRegisterExitCallback&#40;cbid&#41;;

          sceKernelSleepThreadCB&#40;&#41;;

          return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41; &#123;
          int thid = 0;

          thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
          if&#40;thid >= 0&#41; &#123;
                    sceKernelStartThread&#40;thid, 0, 0&#41;;
          &#125;

          return thid;
&#125;

int main&#40;&#41; &#123;
          char buffer&#91;200&#93;;
          Image* ourImage;
          
pspDebugScreenInit&#40;&#41;;
SetupCallbacks&#40;&#41;;
initGraphics&#40;&#41;;
// all of the above was a setup for the following program

sprintf&#40;buffer, "ourImage.png"&#41;;
ourImage = loadImage&#40;buffer&#41;;
//the following four lines checks to see if the image has loaded
          if &#40;!ourImage&#41; &#123;
                    //Image load failed
                    printf&#40;"Image load failed!\n"&#41;;
          &#125; else &#123;
// if there were no errors the following 3 lines will execute
                    int x = 0;
                    int y = 0;
                    sceDisplayWaitVblankStart&#40;&#41;;
                    
//loop through the entire screen. The screen is 480 pixels wide and 272 pixels high&#58;
                    while &#40;x < 480&#41; &#123;
                              while &#40;y < 272&#41; &#123;
//display image
                                        blitAlphaImageToScreen&#40;0 ,0 ,32 , 32, ourImage, x, y&#41;;
                                        y += 32;
                              &#125;
                              x += 32;
                              y = 0;
                    &#125;
//now to write to the screen &#40;flipping&#41;
                    flipScreen&#40;&#41;;
          &#125;

//shut down the program - allowing us to see the end product
          sceKernelSleepThread&#40;&#41;;
          return 0;
&#125;

Last edited by ravenlife on Thu Apr 27, 2006 8:22 pm, edited 1 time in total.
cheriff
Regular
Posts: 258
Joined: Wed Jun 23, 2004 5:35 pm
Location: Sydney.au

Post by cheriff »

error: graphics.h: No such file or directory
You are telling gcc that the file graphics.h (which contains definitions for all Image related things, i guess) is in the SAME directory as main.c. Looks to me like this isnt the case.
Dunno where that file is, or where it's supposed to be.. But that's your problem. If it's included with the sdk (in /usr/local/pspdev/psp/sdk/include) then you need to use #include <graphics.h> instad of the ""'s
Damn, I need a decent signature!
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

My AIM is Yeldarb2k3, and my e-mail is Yeldarb [at] Barbdwyer [dot] com.
Why not ask the author of the 'tutorial' instead of people who aren't even connected to that site?

Does he even visit these forums?
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Reads carefully the tutorial n°4 :)
You have to download this file and unzip it in the folder where is your main.c
ravenlife
Posts: 4
Joined: Thu Apr 27, 2006 10:05 am

Post by ravenlife »

Why not ask the author of the 'tutorial' instead of people who aren't even connected to that site?
because i dont have aim - seems as this is psp dev discussion - i thought you guys would be more helpful anyway - as i realised it was something i had done wrong - rather than the tut being wrong.

i was right
You are telling gcc that the file graphics.h (which contains definitions for all Image related things, i guess) is in the SAME directory as main.c. Looks to me like this isnt the case.
and
You have to download this file and unzip it in the folder where is your main.c
i'd downloaded and unzipped - but upon finishing my main.c i moved it to projects so i could navigate to it with cygwin - didnt even think to move the files i downloaded.

obviously very noobish of me. so i apologise for that.

thank you for all your help though

RavenLife
Post Reply