QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

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; Hi, I'm new to the PSP homebrew programing scene, lucky not to C++ however, and I can't figure out for ...

Reply
 
LinkBack Thread Tools
Old 03-28-2006, 06:49 PM   #151
 
F.T.P.'s Avatar
 
Join Date: Feb 2006
Location: Arkhangelsk, Russia
Posts: 21
Trader Feedback: 0
Default

Hi, I'm new to the PSP homebrew programing scene, lucky not to C++ however, and I can't figure out for the life of me how to display one picture over the other withough erasing the first picture. If anyone could help it would be greatly appresiated.

Curently I have it set up as such.

Code:
    char buffer1[200];
    char buffer2[200];
    
    Image* bg;
    Image* set;
    
    sprintf(buffer1, "bg.png");
    bg = loadImage(buffer1);
    
    sprintf(buffer2, "set.png");
    set = loadImage(buffer2);
    
    sceDisplayWaitVblankStart();
    blitAlphaImageToScreen(0 ,0 ,480 ,272 ,bg ,0 ,0 );
    flipScreen();
    
    sceDisplayWaitVblankStart();
    blitAlphaImageToScreen(0 ,0 ,60 ,34 ,set ,60 ,34 );
    flipScreen();
As you can see I have it draw one picture and then draw the smaller, however, instead of drawind the second picture over the first, it just erases the first picture instead of drawing over it.

Sorry if this is noobish BTW.

Last edited by F.T.P.; 03-28-2006 at 06:52 PM..
F.T.P. is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-29-2006, 05:29 AM   #152

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

F.T.P.: Try this
Code:
 void printTextImage(int x, int y, const char* text, u32 color, Image* image)
but I'm not sure it will work, I just found it.
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-29-2006, 05:35 AM   #153
 
Join Date: Jan 2006
Posts: 10
Trader Feedback: 0
Default

F.T.P. you have 2 screen buffers, remove the flipScreen between your blitAlphaImageToScreen, you'll draw on the same screen buffer.
eppe is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-29-2006, 05:37 AM   #154
Mushroom Man
 
Psilocybeing's Avatar
 
Join Date: Sep 2005
Location: UK
Posts: 318
Trader Feedback: 0
Default

Quote:
Originally Posted by F.T.P.
Hi, I'm new to the PSP homebrew programing scene, lucky not to C++ however, and I can't figure out for the life of me how to display one picture over the other withough erasing the first picture. If anyone could help it would be greatly appresiated.

Curently I have it set up as such.

Code:
    char buffer1[200];
    char buffer2[200];
    
    Image* bg;
    Image* set;
    
    sprintf(buffer1, "bg.png");
    bg = loadImage(buffer1);
    
    sprintf(buffer2, "set.png");
    set = loadImage(buffer2);
    
    sceDisplayWaitVblankStart();
    blitAlphaImageToScreen(0 ,0 ,480 ,272 ,bg ,0 ,0 );
    flipScreen();
    
    sceDisplayWaitVblankStart();
    blitAlphaImageToScreen(0 ,0 ,60 ,34 ,set ,60 ,34 );
    flipScreen();
As you can see I have it draw one picture and then draw the smaller, however, instead of drawind the second picture over the first, it just erases the first picture instead of drawing over it.

Sorry if this is noobish BTW.
The graphics.c package uses double buffering, so when you flip the buffers(between displayed and hidden) the buffer that you were editing is now being displayed, and the buffer that was being displayed is now being edited. Writing to the first buffer will not write over to the second, so in essence you must re-draw the scene upon every flip.

Code:
    sceDisplayWaitVblankStart();
    blitAlphaImageToScreen(0 ,0 ,480 ,272 ,bg ,0 ,0 );
    blitAlphaImageToScreen(0 ,0 ,60 ,34 ,set ,60 ,34 );
    flipScreen();
__________________
[URL=http://www.othala.co.uk]Othala[/URL] [B]o[/B] [URL=http://www.entheogendefencefund.org.uk/]Save the shroom![/URL]

[CENTER][URL=http://www.othala.co.uk/travellerBlog][IMG]http://www.othala.co.uk/graphics/travBanner.png[/IMG][/URL][/CENTER]
Psilocybeing is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-29-2006, 06:43 AM   #155

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

Does anyone know the command to activate usb ( I found the example in the sdk but somehow it didnt work form me...). Cause I want to activate it when I press 'X'. If anyone wold give me an example it would be great. Thanks in advance.

Edit: Nevermind I just got it to compile. Too bad that I just lost my USB-cable =S

Last edited by SodR; 03-29-2006 at 11:58 AM..
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-29-2006, 08:24 PM   #156
 
F.T.P.'s Avatar
 
Join Date: Feb 2006
Location: Arkhangelsk, Russia
Posts: 21
Trader Feedback: 0
Default

Damn, that helped alot. Thanks you guys.
F.T.P. is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-30-2006, 12:32 PM   #157
 
Devun_06's Avatar
 
Join Date: Feb 2006
Posts: 338
Trader Feedback: 0
Default

Have anyone ever notice that when printing text to the screen whether over a picture or not, if the xcoord is <0 of the screen... nothing is printed at all?

Would someone mind telling me what can be done about this?
I'm currently using: printTextScreen(,,,)

Last edited by Devun_06; 03-30-2006 at 12:35 PM..
Devun_06 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-31-2006, 01:40 PM   #158
 
Join Date: Dec 2005
Posts: 32
Trader Feedback: 0
Default

Hey, how could I disable 'Home' -button, so nothing would happen if you press it, or how could I get my program to straight exit when pressing 'Home'? I tried one method, and when you press 'Home', that stupid "Do you want to quit program" -popup comes to the screen, but after a second it will get me back to XMB. So how could I disable that "Do you want to quit program" -popup showing up at all?

EDIT: Got it working, no problems anymore

Last edited by MiiKKiZ; 03-31-2006 at 01:48 PM..
MiiKKiZ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-31-2006, 03:49 PM   #159
 
Devun_06's Avatar
 
Join Date: Feb 2006
Posts: 338
Trader Feedback: 0
Talking

If you're getting the XMB return system then I guess your running 1.5. I've never tried overriding the original home key feature, but I think this might help.

SceCtrlData Pad;
sceCtrlReadBufferPositive (&Pad,1);
if(Pad.Buttons & PSP_CTRL_HOME){sceKernelE xitGame();}
Devun_06 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-01-2006, 09:27 AM   #160

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

I have not tested it my self but if you code that nothing will happen when you press home, like this:
SceCtrlData Pad;
sceCtrlReadBufferPositive (&Pad,1);
if(Pad.Buttons & PSP_CTRL_HOME)

I think it will work as it were disabled. At least you can always try.
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-02-2006, 09:52 PM   #161
Art

Bush Programmer
 
Art's Avatar
 
Join Date: Nov 2005
Posts: 3,557
Trader Feedback: 0
Default

Hi Guys, just a little Q re C syntax.

I have some variables in a buffer that represent ASCII values that I
would like to print to screen as ASCII.
I can print them as decimal values like so:
printf("variable is: %d",data[0]);

So if I have the ASCII character '0' in the buffer, it will print as:
variable is: 48

which is it's decimal value. What do I need to replace the %d with for ASCII?
Cheers, Art.
Art is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-02-2006, 09:54 PM   #162
 
Join Date: Jan 2006
Posts: 4,288
Trader Feedback: 0
Default

%c I believe. If I'm right, I read it here: http://irc.essex.ac.uk/www.iota-six....ming_intro.asp
soccerPMN is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-02-2006, 10:00 PM   #163
Art

Bush Programmer
 
Art's Avatar
 
Join Date: Nov 2005
Posts: 3,557
Trader Feedback: 0
Default

Yep, I Googled it and came back to answer myself
Thanx
Art is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-02-2006, 10:01 PM   #164
 
Join Date: Jan 2006
Posts: 4,288
Trader Feedback: 0
Default

No prob. You know You can also do other things, like %02x for showing the value in a 2 character hex form, and %08x for 8 char...
soccerPMN is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-05-2006, 12:48 AM   #165

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

hmmm....Soccer, thats what you told me for hex, and its true, looked it up and everything... use %02x to only use/get the hex in 2 character/byte form...
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-06-2006, 12:17 PM   #166
 
Join Date: Apr 2006
Location: Northampton, England
Posts: 59
Trader Feedback: 0
Default

Hi everyone, i'm trying to make a png photo viewer with music in the background. Can anybody please help.

Code:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdio.h>
#include <psppower.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include "mp3player.h"
#include "graphics.h"

PSP_MODULE_INFO("images and music", 0, 1, 1);
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define printf pspDebugScreenPrintf

/* Exit callbacks */
int exit_callback(int arg1, int arg2, void *common) {
    sceKernelExitGame();
    return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
    int cbid;
    
    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    sceKernelSleepThreadCB();
    
    return 0;
}

/* Sets up the callback thread and returns its id */
int SetupCallbacks(void) {
    int thid = 0;
    
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if(thid >= 0) {
            sceKernelStartThread(thid, 0, 0);
            }
            
return thid;
}

int main(void) {
    SetupCallbacks();
    initGraphics();
    SceCtrlData pad;
    int i;
    int j;
    int selComponent = 0;
    int selComponent2 = 0;
    char buffer[200];
    char image[5];
    char music[5];
    Image* ourImage;
    pspAudioInit();
        
        while(1) {
             sceCtrlReadBufferPositive(&pad, 1);

if(selComponent == 0) {
image == "1.png";
} else if(selComponent == 1) {
image == "2.png";
} else if(selComponent == 2) {
image == "3.png";
} else if(selComponent == 3) {
image == "4.png";
} else if(selComponent == 4) {
image == "5.png";
}

if(selComponent2 == 0) {
music == "1.mp3";
} else if(selComponent2 == 1) {
music == "2.mp3";
} else if(selComponent2 == 2) {
music == "3.mp3";
} else if(selComponent2 == 3) {
music == "4.mp3";
} else if(selComponent2 == 4) {
music == "5.mp3";
}

             
if(pad.Buttons & PSP_CTRL_UP) {
               if(selComponent > 0) {
                               selComponent--;
                               }
                               for(i=0; i<10; i++) {
                                        sceDisplayWaitVblankStart();
}
} else if(pad.Buttons & PSP_CTRL_DOWN) {
       if(selComponent < 4) {
                       selComponent++;
                       }
                       for(i=0; i<10; i++) {
                                sceDisplayWaitVblankStart();
                                }
}

if(pad.Buttons & PSP_CTRL_LEFT) {
               
if(selComponent2 > 0) {
                       selComponent2--;
                       }
                       for(j=0; j<10; j++) {
                                sceDisplayWaitVblankStart();
                                }
if(pad.Buttons & PSP_CTRL_RIGHT) {
               
if(selComponent2 > 1) {
                       selComponent2++;
                       }
                       for(j=0; j<10; j++) {
                                sceDisplayWaitVblankStart();
                                }

                                    }


printf("Image viewer (with added music!)");
sprintf(buffer, image);

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, 480, 272, ourImage, x, y);
y += 272;
}

x += 480;
y = 0;
}

MP3_Init(1);
MP3_Load(music);
MP3_Play();

while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
break;
} else if(pad.Buttons & PSP_CTRL_CIRCLE) {
MP3_Pause();
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}

MP3_Stop();
MP3_FreeTune();


flipScreen();

for(i=0; i<1; i++) {
         sceDisplayWaitVblankStart();
         }
         }
         return 0;
}
Any help would be greatly appreciated.
code-zero is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 09:57 AM   #167

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

code-zero: Maybe you should tell us what the problem is instead of yout posting your source. Doesn't it compile? If so what error code? Or at which point does your program crash?? We need more info
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 12:29 PM   #168

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

code-zero, there are multiple resons why it might not work... 1 being you initalized the MP3 playing in a loop, along with 2 infinite loops as well lol.. . Why not post your problems complying? Oh and it also looks like you are just copying and pasting from Yeldarbs *tuts*, 'ourImage'? SelComponent? blitting the backround/image with a loop for know reason? (remove the > and < junk, just do blitAlphaImageToScreen(0, 0, 480, 272, ourImage, 0, 0)<- that will blit ourImage to the co-ordinates of 0, 0 and the ourImage's dimensions are 480x272 in this) There are some more problems in theree, but ill let you debug to get used to having too.
__________________

Last edited by SG57; 04-07-2006 at 12:32 PM..
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 12:34 PM   #169
 
Join Date: Apr 2006
Location: Northampton, England
Posts: 59
Trader Feedback: 0
Default

I went through yeldarbs tuts, but I used the same variables to try and make it a little easier to understand, and I didn't copy and paste. I printed it off and typed it, .
code-zero is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2006, 05:05 AM   #170

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

I'm having problem installing PSPGL on my PC. I downloaded pspgl using svn (svn co svn://svn.ps2dev.org/psp/trunk/pspgl ) and that works just fine. But how am I supposed to install it?? The readme is like a riddle, why cant it just tell me what to do? I tryed to just go into the dir (cd pspgl) and type "make". After that alot of text rolls on the screen and after like a half a minute I get this error:
Code:
[Alotofdirnameshere]/TEMP/ccimwEpb.s: Assembler messages:
[Alotofdirnameshere]/TEMP/ccimwEpb.s: "Error: Illegal operands 'vmidt.q m700'
make: *** [glLoadIdentity.o] Error 1
I have tryed to re-download pspgl a couple of times but I get the same error everytime. Worth to notice is that almost every line of the text that rolls by before the error looks like this:
Code:
 psp-gcc -std=gnu99 -g -Wall -Wmissing-prototypes -Os -G0
 -fsingle-precision-constant -I. -I /usr/local/pspdev/psp/include -I 
/usr/local/pspdev/psp/include funit-at-a-time -MD -MF .deps/[Filename].d -c
 [Filename].c
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2006, 06:33 AM   #171

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Meh, I need help with blitting an image to the screen. Code:

Code:
#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 MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define printf pspDebugScreenPrintf

PSP_MODULE_INFO("Button Basher", 0, 1, 1);


/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
          int cbid;

          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);

          sceKernelSleepThreadCB();

          return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
          int thid = 0;

          thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
          if(thid >= 0) {
                    sceKernelStartThread(thid, 0, 0);
          }

          return thid;
}

int main() {
	char buffer[200];
	Image* menubg;

	pspDebugScreenInit();
	SetupCallbacks();
	initGraphics();

	sprintf(buffer, "menubg.png");
	menubg = loadImage(buffer);

	if (!menubg) {
			//Image load failed
			printf("Image load failed! Please email youleben@gmail.com!\n");
	} else {
		int x = 0;
		int y = 0;
		sceDisplayWaitVblankStart();
		while (x < 480) {
			while (y < 272) {
				blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y);
			x = 0;
                              y = 0;
                    }
			flipScreen();
		}
	}
	sceKernelSleepThread();
	return 0;
}
It compiles successfully but when I view it on my PSP it does not show. Just a black screen. it doesnt crash by PSP though. I can go back to the eloader.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 07:44 AM   #172
 
Join Date: Feb 2006
Posts: 13
Trader Feedback: 0
Default

At first, you dont need this:
while (x < 480) {
while (y < 272) {
blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y);
x = 0;
y = 0;
}
flipScreen();
}


you just have to write:

blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y);
flipscreen();


you kopie the code, or?, try to understand why you dont need the 2 while sharpens.

and now to your problem, i think you need a larger buffer, so test it with 20000 or more
alivecrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 08:08 AM   #173

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Nvm I fixed it I somehow got yeldarbs MSN and he helped me I just need to find a tut on how to make a menu now
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 01:51 PM   #174

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

Quote:
Originally Posted by kozine
Nvm I fixed it I somehow got yeldarbs MSN and he helped me I just need to find a tut on how to make a menu now
Since im feeling nice today, i just throguh together a quick Simple Menu Tutorial. I uploaded it as a .txt since PSPU doesnt like C source files

Anyway, i have included one of those copyright Comments at the top, so if you copy and paste, then youd have to include something about it. Instead just read it, get an idea of how it works, and then make your own. Very simple.

P.S. If something is wrong in it, forgive me since i just throguh it together to help some new devlopers out since i too had a hard time with a menu.

your welcome.
Attached Files
File Type: txt Basic Menu Navigation.txt‎ (3.7 KB, 52 views)
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 01:52 PM   #175

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

ty so much I can carry on now XD
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 02:05 PM   #176

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Sorry for double post!

Im gettin eally annoyed with this oggplayer LIB. Here is a screenshot of my compiling error:



Code:

Code:
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <pspaudiolib.h>
#include <pspaudio.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <psputils.h>
#include <psptypes.h>
#include <psppower.h>
#include <pspiofilemgr.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"

//Ogg include
#include "ogg/ivorbisfile.h"
#include "oggplayer.h"

#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define printf pspDebugScreenPrintf

PSP_MODULE_INFO("Button Basher", 0, 1, 1);


/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
          int cbid;

          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);

          sceKernelSleepThreadCB();    

          return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
          int thid = 0;

          thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
          if(thid >= 0) {
                    sceKernelStartThread(thid, 0, 0);
          }

          return thid;
}

int main() {
  
	char buffer[200];
	Image* menubg;

	pspDebugScreenInit();
	SetupCallbacks();
	initGraphics();
    pspAudioInit();
    
    //Initialize OGG port
  OGG_Init(1);
  //Load OGG file
  OGG_Load("sounds/menu.ogg");
  //Play the loaded file
  OGG_Play();
  
	sprintf(buffer, "menubg.png");
	menubg = loadImage(buffer);

	if (!menubg) {
			//Image load failed
			printf("Image load failed! Please email youleben@gmail.com!\n");
	} else {
		int x = 0;
		int y = 0;
		sceDisplayWaitVblankStart();
		blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y);
                    }
  
			flipScreen();
		
	sceKernelSleepThread();
	return 0;
}
I would like it so the sound keeps repeating and never stops.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 07:40 PM   #177

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

Its noi doubt you either dont ahve the OGGlib installed/not including then OGGlib/do not have the OGG lib in the makefile. But o have it repeat and never stop, look at the .h file of it and a protoyp will be in there for something similar.
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-16-2006, 02:32 PM   #178
 
Join Date: Jan 2006
Posts: 4,288
Trader Feedback: 0
Default

SG57, do you know SDL or a good tutorial of one? I'm interested in learning it, for menus mostly.
soccerPMN is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-17-2006, 11:35 AM   #179
Mindless Fanboy
 
Join Date: Mar 2006
Posts: 1,907
Trader Feedback: 0
Default

how do i create barriers for a character? such as walls. how would i make a whole image impossible for a character to go inside? like a buildings walls. thank you!
FLai is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-20-2006, 12:25 PM   #180

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Default

sorry unsure where else to post this but when i'm trying to get c to work i notice it is trying to dl from a website heres the full error

--15:23:54-- ftp://ftp.gnu.org/pub/gnu/binutils/b...-2.16.1.tar.gz
(try: 6) => `binutils-2.16.1.tar.gz'
Connecting to ftp.gnu.org|199.232.41.7| :21... failed: Connection timed out.
Retrying.

anyway around this would be much appreciated=-)
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
c or c , c++ , c/c++ , code , coding , c_language , programming , psp , psp programming , thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 03:47 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us