C/C++ Programming Help Thread
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I'm aware of that, my concern is with the mipmaps having to load and create multiple textures (as is my ...
-
12-21-2008, 07:31 PM #9361I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm aware of that, my concern is with the mipmaps having to load and create multiple textures (as is my understanding, one for each square under the image size, hence why mipmapped images actually work I believe?).
Saying that, if I pad out the images once loaded, and not as they are being loaded, the same process can be used on each image, irrespective of it being a bmp, jpg, png or some other obscure image format. I hadn't thought of that angle.
-Aura
-
12-21-2008, 07:33 PM #9362QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
it would probably make life easier for supporting multiple image formats if you only had to worry about actually loading the image
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
12-22-2008, 12:09 PM #9363QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Hey everybody. Can someone help me? I'm making something in C++ (just for myself, not a release) but I'm stuck. I have a mp3-player now but you have to put a music file named music.mp3 in the ms0:/music folder, but how can you let the player detect mp3 files automatically in a certain map or on the whole memory stick? This is my code (was included with in the psp/sdk folder, i'm just learning some things):
Code:#include <pspkernel.h> #include <pspdebug.h> #include <pspctrl.h> #include <pspdisplay.h> #include <stdio.h> #include <pspaudio.h> #include <pspmp3.h> #include <psputility.h> PSP_MODULE_INFO("Mp3Test", 0, 0, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER); PSP_HEAP_SIZE_KB(-1024); #define MP3FILE "ms0:/MUSIC/music.mp3" #define printf pspDebugScreenPrintf static int isrunning = 1; int exit_callback(int arg1, int arg2, void *common) { isrunning = 0; return 0; } int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } int SetupCallbacks(void) { int thid = 0; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if (thid >= 0) sceKernelStartThread(thid, 0, 0); return thid; } char mp3Buf[16*1024] __attribute__((aligned(64))); short pcmBuf[16*(1152/2)] __attribute__((aligned(64))); #define ERRORMSG(...) { char msg[128]; sprintf(msg,__VA_ARGS__); error(msg); } void error( char* msg ) { SceCtrlData pad; pspDebugScreenClear(); pspDebugScreenSetXY(0, 0); printf(msg); printf("Press X to quit.\n"); while (isrunning) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CROSS) break; sceDisplayWaitVblankStart(); } sceKernelExitGame(); } int fillStreamBuffer( int fd, int handle ) { char* dst; int write; int pos; int status = sceMp3GetInfoToAddStreamData( handle, &dst, &write, &pos); if (status<0) { ERRORMSG("ERROR: sceMp3GetInfoToAddStreamData returned 0x%08X\n", status); } // Seek file to position requested status = sceIoLseek32( fd, pos, SEEK_SET ); if (status<0) { ERRORMSG("ERROR: sceIoLseek32 returned 0x%08X\n", status); } // Read the amount of data int read = sceIoRead( fd, dst, write ); if (read < 0) { ERRORMSG("ERROR: Could not read from file - 0x%08X\n", read); } if (read==0) { return 0; } status = sceMp3NotifyAddStreamData( handle, read ); if (status<0) { ERRORMSG("ERROR: sceMp3NotifyAddStreamData returned 0x%08X\n", status); } return (pos>0); } int main(int argc, char *argv[]) { SceCtrlData pad; pspDebugScreenInit(); pspDebugScreenClear(); SetupCallbacks(); sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(0); int status = sceUtilityLoadModule(PSP_MODULE_AV_AVCODEC); if (status<0) { ERRORMSG("ERROR: sceUtilityLoadModule(PSP_MODULE_AV_AVCODEC) returned 0x%08X\n", status); } status = sceUtilityLoadModule(PSP_MODULE_AV_MP3); if (status<0) { ERRORMSG("ERROR: sceUtilityLoadModule(PSP_MODULE_AV_MP3) returned 0x%08X\n", status); } int fd = sceIoOpen( MP3FILE, PSP_O_RDONLY, 0777 ); if (fd<0) { ERRORMSG("ERROR: Could not open file '%s' - 0x%08X\n", MP3FILE, fd); } status = sceMp3InitResource(); if (status<0) { ERRORMSG("ERROR: sceMp3InitResource returned 0x%08X\n", status); } SceMp3InitArg mp3Init; mp3Init.mp3StreamStart = 0; mp3Init.mp3StreamEnd = sceIoLseek32( fd, 0, SEEK_END ); mp3Init.unk1 = 0; mp3Init.unk2 = 0; mp3Init.mp3Buf = mp3Buf; mp3Init.mp3BufSize = sizeof(mp3Buf); mp3Init.pcmBuf = pcmBuf; mp3Init.pcmBufSize = sizeof(pcmBuf); int handle = sceMp3ReserveMp3Handle( &mp3Init ); if (handle<0) { ERRORMSG("ERROR: sceMp3ReserveMp3Handle returned 0x%08X\n", handle); } fillStreamBuffer( fd, handle ); status = sceMp3Init( handle ); if (status<0) { ERRORMSG("ERROR: sceMp3Init returned 0x%08X\n", status); } int channel = -1; int samplingRate = sceMp3GetSamplingRate( handle ); int numChannels = sceMp3GetMp3ChannelNum( handle ); int lastDecoded = 0; int volume = PSP_AUDIO_VOLUME_MAX; int numPlayed = 0; int paused = 0; int lastButtons = 0; int loop = 0; while (isrunning) { sceDisplayWaitVblankStart(); pspDebugScreenSetXY(0, 0); printf("MP3-PSP By Malliet\n\n"); printf("Playing '%s'...\n", MP3FILE); printf(" %i Hz\n", samplingRate); printf(" %i kbit/s\n", sceMp3GetBitRate( handle )); printf(" %s\n", numChannels==2?"Stereo":"Mono"); printf(" %s\n\n", loop==0?"No loop":"Loop"); int playTime = samplingRate>0?numPlayed / samplingRate:0; printf(" Playtime: %02i:%02i\n", playTime/60, playTime%60 ); printf("\n\n\nPress CIRCLE to Pause/Resume playback\nPress TRIANGLE to reset playback\nPress CROSS to switch loop mode\nPress SQUARE to stop playback and quit\n"); if (!paused) { if (sceMp3CheckStreamDataNeeded( handle )>0) { fillStreamBuffer( fd, handle ); } short* buf; int bytesDecoded; int retries = 0; for (;retries<1;retries++) { bytesDecoded = sceMp3Decode( handle, &buf ); if (bytesDecoded>0) break; if (sceMp3CheckStreamDataNeeded( handle )<=0) break; if (!fillStreamBuffer( fd, handle )) { numPlayed = 0; } } if (bytesDecoded<0 && bytesDecoded!=0x80671402) { ERRORMSG("ERROR: sceMp3Decode returned 0x%08X\n", bytesDecoded); } if (bytesDecoded==0 || bytesDecoded==0x80671402) { paused = 1; sceMp3ResetPlayPosition( handle ); numPlayed = 0; } else { if (channel<0 || lastDecoded!=bytesDecoded) { if (channel>=0) sceAudioSRCChRelease(); channel = sceAudioSRCChReserve( bytesDecoded/(2*numChannels), samplingRate, numChannels ); } numPlayed += sceAudioSRCOutputBlocking( volume, buf ); } } sceCtrlPeekBufferPositive(&pad, 1); if (pad.Buttons!=lastButtons) { if (pad.Buttons & PSP_CTRL_CIRCLE) { paused ^= 1; } if (pad.Buttons & PSP_CTRL_TRIANGLE) { sceMp3ResetPlayPosition( handle ); numPlayed = 0; } if (pad.Buttons & PSP_CTRL_CROSS) { loop = (loop==0?-1:0); status = sceMp3SetLoopNum( handle, loop ); if (status<0) { ERRORMSG("ERROR: sceMp3SetLoopNum returned 0x%08X\n", status); } } if (pad.Buttons & PSP_CTRL_SQUARE) { break; } lastButtons = pad.Buttons; } } if (channel>=0) sceAudioSRCChRelease(); status = sceMp3ReleaseMp3Handle( handle ); if (status<0) { ERRORMSG("ERROR: sceMp3ReleaseMp3Handle returned 0x%08X\n", status); } status = sceMp3TermResource(); if (status<0) { ERRORMSG("ERROR: sceMp3TermResource returned 0x%08X\n", status); } status = sceIoClose( fd ); if (status<0) { ERRORMSG("ERROR: sceIoClose returned 0x%08X\n", status); } sceKernelExitGame(); return 0; }
-
12-22-2008, 12:17 PM #9364QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
sceIoD* functions.
Use them to read a folder or whatever and get the files within.
-
12-22-2008, 12:19 PM #9365QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I'm a beginner in C++ Davee so can you explain me how to use that function.
-
12-22-2008, 12:22 PM #9366I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
If you do a search on ps2dev's forums for dirents, you'll probably find a good example of a file browser, but instead of printing a list of files, simply feed them into a loop to check extentions and play.
Of course, theres more work than that, but it should give you a starting point.Code://Psudo typedef struct { int count; char loc[256]; } _fileBrowser fileBrowser; getFileList(fileBrowser); for(int loop = 0; loop < fileBrowser.count; loop++) { //code to check extention is mp3 if(extention == mp3) { //play mp3 file } else { // check again } }
-Aura
-
12-22-2008, 12:28 PM #9367QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I shall check the ps2dev's forum then:P But thanks for giving me a starting point;)
-
12-23-2008, 12:44 AM #9368xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
n00b question
ive compiled my idstorage.prx but i wanna know how to access and use the functions in it, any advice would help =D
!~SlasheR~!
-
12-23-2008, 03:23 AM #9369I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Build a stub file. You've created your exports right? In bash type psp-build-exports -s [export file] and you'll recieve a stub file.
Then, all you need to do is link your stub file into the makefile of your app and you SHOULD be able to call all those functions. You'll need to make sure you've started all the modules which are required (such as the module in question and any the functions are dependant on). If you get any errors check the SDK documentation under PSP_KERNEL_ERRORS (I think) and see if you can make sense of it, if not post back.
-Aura
-
12-23-2008, 06:35 AM #9370QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Never mind. It works now
-
12-23-2008, 06:37 AM #9371QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
We can't help you if we don't know whats going wrong ;)
Edit:
Seriously, you should be smart enough to figure that out. I'm not going to tell you whats wrong. It tells you EXACTLY whats not right and gives you a line reference.
-
12-23-2008, 03:05 PM #9372xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
thx 4 replying but i cant figure out how to link it into my makefile
i ran psp-build-exports -s test.exp and got test.S
now how do i link that?
srry if i sound nooby but im just a begginer
!~SlasheR~!
-
12-23-2008, 03:21 PM #9373
You put the test.o in your makefile and make a test.h as a header for the functions.
I gone and made that one power spoofer and that gay cheat device.
-
12-23-2008, 03:28 PM #9374xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
no i want to link "test.S" into my MakeFile
-
12-23-2008, 03:32 PM #9375QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
-
12-23-2008, 03:38 PM #9376xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i did and
:Argh:Code:$ make psp-gcc -I. -IC:/PSP/pspdev/psp/sdk/include -O2 -G0 -Wall -lpsppower -L. -LC:/PSP/pspdev/psp/sdk/li b main.o prx\\main.o -lpsppower -lpspwlan -lpspnand_driver -lpspgu -lpng -lz -lm -lpspdebug -lpspd isplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpspu tility -lpspuser -lpspkernel -o hello.elf prx\main.o:(.rodata.sceModuleInfo+0x0): multiple definition of `module_info' main.o:(.rodata.sceModuleInfo+0x0): first defined here main.o: In function `check_mobo': main.c:(.text+0x58): undefined reference to `ReadKey' main.c:(.text+0x68): undefined reference to `ReadKey' collect2: ld returned 1 exit status make: *** [hello.elf] Error 1
--EDIT--
Fixed =) didnt know you had 2 have test.S in the same dir
-=Double Post Merge =-
srry that worked but how do i reference them
do i do:
or:Code:int ReadKey();
thanks for all your helpl so farCode:extern int ReadKey();

!~SlasheR~!Geändert von slasher101 (12-23-2008 um 11:51 PM Uhr) Grund: Automerged Doublepost
-
12-24-2008, 07:16 AM #9377QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Does somebody know where I can find the UMD functions such as starting the umd etc?
[spoiler=My Releases So Far]
PSP_Operator v2.0 Final (and earlier; stopped with this one)
Mario's Road v2.0 (working on 2.5:D)
UMD_Operator v0.0.2 (and earlier; stopped with this one)
PSP-Quiz v0.1 (working on v0.2 already:D)
[/spoiler]
-
12-24-2008, 07:49 AM #9378Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
pspumd.h

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
12-24-2008, 09:42 AM #9379QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
yeah i already found that out, but thanks anyway. Btw that's the include right? So how can i start umd etc. If i press on a button?
EDIT: Never mind; found it here: http://psp.jim.sh/pspsdk-doc/Geändert von malliet (12-24-2008 um 10:03 AM Uhr)
-
12-24-2008, 10:55 AM #9380Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Reading the header will tell you everything you need to know ...
-
12-24-2008, 05:17 PM #9381
Achievements:
- Registriert seit
- Dec 2008
- Beiträge
- 3
- Points
- 2.052
- Level
- 27
- Downloads
- 0
- Uploads
- 0
Help what m i doing wrong with this collision code
#include <stdio.h>
#include <oslib/oslib.h>
#include <math.h>
//necessary to create eboot
psp_module_info("oslib sample", 0, 1, 1);
psp_main_thread_attr(thre ad_attr_user | thread_attr_vfpu);
//declaration of the pointers of our images
osl_image *background,*a,*b;
// based of ravines
int collision(int ax, int ay, int awidth, int aheight, int bx, int by, int bwidth, int bheight)
int hit(){
if ((ax >= bx && ax <= (bx+bwidth)) && (ay >= by && ay <= (by+bheight)))
{
hit = 1;
}
if (((ax+awidth) >= bx && (ax+awidth) <= (bx+bwidth)) && (ay >= by && ay <= (by+bheight))) {
hit = 1;
}
if ((ax >= bx && ax <= (bx+bwidth)) && ((ay+aheight) >= by && (ay+aheight) <= (by+bheight))) {
hit = 1;
}
if (((ax+awidth) >= bx && (ax+awidth) <= (bx+bwidth)) && ((ay+aheight) >= by && (ay+aheight) <= (by+bheight))) {
hit = 1;
}
return hit;
}
int main(int argc, char **argv)
{
//initialization of the oslib library
oslinit(0);
//initialization of the graphics mode
oslinitgfx(osl_pf_8888, 1);
oslinitconsole(); //text
oslsettransparentcolor(rg b(255,0,255));
//loads our images into memory
a = oslloadimagefile("a.png", osl_in_ram, osl_pf_5551);
b = oslloadimagefile("b.png", osl_in_ram, osl_pf_5551);
background = oslloadimagefile("backgro und.png", osl_in_ram, osl_pf_5551);
//stuff
a->x =ax;
a->y =ay;
b->x =bx;
b->y =by;
//position
a->x =100;
a->y =249;
b->x=300;
b->y=245;
//main while loop
while (!osl_quit)
{
//to be able to draw on the screen
oslstartdrawing();
//clear the screen
oslcls();
//initiate the psp's buttons
oslreadkeys();
osldrawimage(background);
osldrawimage(a);
osldrawimage(b);
if(hit==1)oslprintf_xy(10 ,10,"collision is positive");
if(hit==0)oslprintf_xy(30 0,10,"collision is negative");
if(osl_keys->held.right) a->x+=1;
if(osl_keys->held.left) a->x-=1;
if(osl_keys->held.up) a->y-=1;
if(osl_keys->held.down) a->y+=1;
//ends drawing mode
oslenddrawing();
//synchronizes the screen
oslsyncframe();
}
//terminate the program
oslendgfx();
oslquit();
return 0;
}
-
12-24-2008, 05:25 PM #9382QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
12-24-2008, 06:01 PM #9383
Achievements:
- Registriert seit
- Dec 2008
- Beiträge
- 3
- Points
- 2.052
- Level
- 27
- Downloads
- 0
- Uploads
- 0
still no use...
i get this from the debugger.
-
12-24-2008, 07:35 PM #9384QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
well, from looking at your code above, and the error's your getting, your forgetting that c++ is case sensitive...
anywho, i'm heading off to bed1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
12-24-2008, 07:45 PM #9385
Achievements:
- Registriert seit
- Dec 2008
- Beiträge
- 3
- Points
- 2.052
- Level
- 27
- Downloads
- 0
- Uploads
- 0
that happended when i pasted it here.the cases changed, must have had capslock on or something.
OK I GOT IT TO COMPLIE..BUT STILL NO COLLISION..Y Y Y Y Y Y ?????
#include <stdio.h>
#include <oslib/oslib.h>
#include <math.h>
//Necessary to create eboot
PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THRE AD_ATTR_USER | THREAD_ATTR_VFPU);
//declaration of the pointers of our images
OSL_IMAGE *background,*A,*B;
int collided;
int hit;
int Ax=100, Ay = 100, Awidth = 32, Aheight = 32, Bx = 200, By = 100, Bwidth = 32, Bheight = 32;
int collision(int Ax, int Ay, int Awidth, int Aheight, int Bx, int By, int Bwidth, int Bheight){
int hit=0;
if ((Ax >= Bx && Ax <= (Bx+Bwidth)) && (Ay >= By && Ay <= (By+Bheight)))
{
hit = 1;
}
if (((Ax+Awidth) >= Bx && (Ax+Awidth) <= (Bx+Bwidth)) && (Ay >= By && Ay <= (By+Bheight))) {
hit = 1;
}
if ((Ax >= Bx && Ax <= (Bx+Bwidth)) && ((Ay+Aheight) >= By && (Ay+Aheight) <= (By+Bheight))) {
hit = 1;
}
if (((Ax+Awidth) >= Bx && (Ax+Awidth) <= (Bx+Bwidth)) && ((Ay+Aheight) >= By && (Ay+Aheight) <= (By+Bheight))) {
hit = 1;
}
return hit;
}
int main(int argc, char **argv)
{
//Initialization of the Oslib library
oslInit(0);
//Initialization of the graphics mode
oslInitGfx(OSL_PF_8888, 1);
oslInitConsole(); //Text
oslSetTransparentColor(RG B(255,0,255));
//loads our images into memory
A = oslLoadImageFile("A.png", OSL_IN_RAM, OSL_PF_5551);
B = oslLoadImageFile("B.png", OSL_IN_RAM, OSL_PF_5551);
background = oslLoadImageFile("backgro und.png", OSL_IN_RAM, OSL_PF_5551);
//stuff
A->x =Ax;
A->y =Ay;
B->x =Bx;
B->y =By;
//position
A->x =100;
A->y =100;
B->x=200;
B->y=100;
//main while loop
while (!osl_quit)
{
//To be able to draw on the screen
oslStartDrawing();
//Clear the screen
oslCls();
//initiate the PSP's buttons
oslReadKeys();
oslDrawImage(background);
oslDrawImage(A);
oslDrawImage(B);
if(hit==1)oslPrintf_xy(10 ,10,"collision is positive");
if(collision(Ax, Ay, Awidth, Aheight, Bx, By, Bwidth, Bheight)) {
collided = 1;}
if(collided==1) {
oslPrintf_xy(10,30,"colli sion is +");}
if(osl_keys->held.right) A->x+=1;
if(osl_keys->held.left) A->x-=1;
if(osl_keys->held.up) A->y-=1;
if(osl_keys->held.down) A->y+=1;
//Ends drawing mode
oslEndDrawing();
//Synchronizes the screen
oslSyncFrame();
}
//Terminate the program
oslEndGfx();
oslQuit();
return 0;
}Geändert von NEW09 (12-24-2008 um 10:04 PM Uhr)
-
12-25-2008, 12:43 AM #9386QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Does somebody know how to automatically detect mp3 files on the mem stick or a map and display a list with the mp3 files?
-
12-25-2008, 12:55 AM #9387QJ Gamer Blue
- Registriert seit
- Sep 2005
- Ort
- Chigasaki, Japan
- Beiträge
- 226
- Points
- 4.980
- Level
- 45
- Downloads
- 0
- Uploads
- 0
What do you expect? You effectively call the collision function with constants. You probably want to pass in A->x, A->y, and B->x, B->y as the object locations.
Also, the collision function looks a bit convoluted. You should only need 4 equations:
hit = (ax+aw >= bx) && (ay+ah >= by) && (bx+bw >= ax) && (by+bh >= ay)
HTHGeändert von kuroneko (12-25-2008 um 01:16 AM Uhr)
-
12-25-2008, 01:10 AM #9388QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
-
12-25-2008, 01:39 AM #9389xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
from prx?
plz help !~SlasheR~!Code:extern int ReadKey(); or int ReadKey();
-
12-25-2008, 02:10 AM #9390QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@malliet:
look into the dirent.h library, should be what you need
@slasher:
test both ways and see, don't ask until you've tested1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been


LinkBack URL
About LinkBacks

Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum