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!

[TUT] Beginner C Programming Tutorials

This is a discussion on [TUT] Beginner C Programming Tutorials within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; In Tutorial 5 you get an implicit use of RGB. To fix the issue simply add the following to the ...

Reply
 
LinkBack Thread Tools
Old 10-06-2009, 08:33 AM   #31
 
Join Date: May 2008
Posts: 7
Trader Feedback: 0
Default

In Tutorial 5 you get an implicit use of RGB.

To fix the issue simply add the following to the list of defines;

#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
Yamagushi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-10-2009, 12:01 PM   #32

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by Yamagushi View Post
In Tutorial 5 you get an implicit use of RGB.

To fix the issue simply add the following to the list of defines;

#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
Thanks for pointing that out. I believe in the original tutorial I had a download link for the graphics.c that already included this definition. I'll add this in there now.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-10-2009, 04:09 PM   #33
The Cake Is A LIE
 
slasher101's Avatar
 
My Mood: Daring
Join Date: Oct 2008
Real First Name: Adam
Location: Melbourne, Australia
Just Played: Far Cry 2
Posts: 669
Blog Entries: 1
Trader Feedback: 0
Default

Stickied
__________________
I hate those monkeys ZOMG!
-~Slasher~-
slasher101 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-11-2009, 06:01 AM   #34
 
Join Date: Oct 2009
Real First Name: John
Location: UK
Just Played: Mario Kart 64
Posts: 1
Trader Feedback: 0
Default

Sorry but im a noob, I understand most except when you have to compile? Where do I gety Cygwin to compile with from?
hezware is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-11-2009, 06:29 AM   #35
Developer and Tutor.
 
FaT3oYCG's Avatar
 
My Mood: Happy
Join Date: Jul 2007
Real First Name: Craig
Location: Widnes, England
Just Played: Life.
Posts: 1,646
Trader Feedback: 0
Default

search for MinPSPW it is much easier to use and there is a tutorial here:
Beginning Programming Tutorials for Windows
__________________
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: is down for a while ... I'll bring a new one back soon.

Currently working on:
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? - A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
FaT3oYCG is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-11-2009, 09:43 PM   #36

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by FaT3oYCG View Post
search for MinPSPW it is much easier to use and there is a tutorial here:
Beginning Programming Tutorials for Windows
I'm currently using DevKitPSP. Which would be better, MinPSPW or DevKitPSP? Obviously nobody uses Cygwin anymore.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-11-2009, 10:41 PM   #37
The Cake Is A LIE
 
slasher101's Avatar
 
My Mood: Daring
Join Date: Oct 2008
Real First Name: Adam
Location: Melbourne, Australia
Just Played: Far Cry 2
Posts: 669
Blog Entries: 1
Trader Feedback: 0
Default

Wow man... DevKitPSP is like 5 years outdated.
__________________
I hate those monkeys ZOMG!
-~Slasher~-
slasher101 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-16-2009, 10:44 AM   #38

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by slasher101 View Post
Wow man... DevKitPSP is like 5 years outdated.
Meh, it's only 2 and a half years old. It works for what I want to do, so I'm not really compelled to install MinPSPW. The PSP scene was better 2 years ago anyway, therefore using DevKitPSP is better.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2009, 03:43 PM   #39
 
Join Date: Oct 2009
Real First Name: V. Bogdan
Location: Romania
Just Played: PSP-Fanatik
Posts: 4
Trader Feedback: 0
Default

Quote:
Originally Posted by Access_Denied View Post
Hello, and welcome to the newest tutorial. Today, I'll be teaching you how to make a menu. I realize that I said this would be a sound tutorial, but it's not. I'm investigating MP3 decoding, this way, I can use my own code, rather than use someone else's. So, this tutorial is all about a menu. It'll be quick, clean and easy to understand. So, let's get to it. We'll be using the graphics library again, so put those four files in your project folder.


Code:
#include <pspkernel.h>
#include <pspcallbacks.h>
#include <pspctrl.h>
#include "graphics.h"
 
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
 
PSP_MODULE_INFO("Menu Example",0,1,1);
...


Finally, use an old Makefile from the image tutorial, then compile and run. If all goes well, you should have a working example. To make clickable items, do something like this:

if((pad.Buttons & PSP_CTRL_CROSS) && (select == 9)) {
//blah blah, this will exit the game, since menuItems[9] = "Exit"
}

See you in the next tutorial.

Code:
Administrator@power ~/projects/meniu
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o graphics.o framebuffer.o -lpsp
gu -lpng -lz -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet
 -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkern
el -o image.elf
main.o: In function `main':
main.cpp:(.text+0x84): undefined reference to `initGraphics()'
main.cpp:(.text+0xdc): undefined reference to `fillScreenRect(unsigned int, int,
 int, int, int)'
main.cpp:(.text+0x114): undefined reference to `printTextScreen(int, int, char c
onst*, unsigned int)'
main.cpp:(.text+0x15c): undefined reference to `printTextScreen(int, int, char c
onst*, unsigned int)'
main.cpp:(.text+0x1a8): undefined reference to `flipScreen()'
main.cpp:(.text+0x1e8): undefined reference to `flipScreen()'
collect2: ld returned 1 exit status
make: *** [image.elf] Error 1
Here is what i get. Makefile is from Images.
pentagram is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-02-2009, 02:24 PM   #40

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by pentagram View Post
Code:
Administrator@power ~/projects/meniu
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o graphics.o framebuffer.o -lpsp
gu -lpng -lz -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet
 -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkern
el -o image.elf
main.o: In function `main':
main.cpp:(.text+0x84): undefined reference to `initGraphics()'
main.cpp:(.text+0xdc): undefined reference to `fillScreenRect(unsigned int, int,
 int, int, int)'
main.cpp:(.text+0x114): undefined reference to `printTextScreen(int, int, char c
onst*, unsigned int)'
main.cpp:(.text+0x15c): undefined reference to `printTextScreen(int, int, char c
onst*, unsigned int)'
main.cpp:(.text+0x1a8): undefined reference to `flipScreen()'
main.cpp:(.text+0x1e8): undefined reference to `flipScreen()'
collect2: ld returned 1 exit status
make: *** [image.elf] Error 1
Here is what i get. Makefile is from Images.
Sorry I didn't get back to you, I'm not here that often. But it seems like your problem would be that you are using main.cpp instead of main.c. I've never used C++ for the PSP, so I don't exactly know what has to be changed in order for it to work. (I'm guessing you need to add libraries and whatnot.)
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-03-2009, 04:16 AM   #41
The Cake Is A LIE
 
slasher101's Avatar
 
My Mood: Daring
Join Date: Oct 2008
Real First Name: Adam
Location: Melbourne, Australia
Just Played: Far Cry 2
Posts: 669
Blog Entries: 1
Trader Feedback: 0
Default

Quote:
Originally Posted by Access_Denied View Post
Sorry I didn't get back to you, I'm not here that often. But it seems like your problem would be that you are using main.cpp instead of main.c. I've never used C++ for the PSP, so I don't exactly know what has to be changed in order for it to work. (I'm guessing you need to add libraries and whatnot.)

Your main is main.cpp
and graphics is only graphics.c

Thats why
__________________
I hate those monkeys ZOMG!
-~Slasher~-
slasher101 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-07-2009, 10:52 AM   #42
 
Join Date: Oct 2009
Real First Name: V. Bogdan
Location: Romania
Just Played: PSP-Fanatik
Posts: 4
Trader Feedback: 0
Default

How to return to the main menu ?

Code:
if((pad.Buttons & PSP_CTRL_CROSS) && (select == 0)) {

	
MY CODE

    }
printf("\n Apasati O pentru a reveni la meniu."); 
	
	if(pad.Buttons & PSP_CTRL_CROSS)
	return main();
	
	
	sceKernelSleepThread();
	


}
Something wrong?
pentagram is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-07-2009, 11:52 PM   #43

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

Quote:
Originally Posted by pentagram View Post
How to return to the main menu ?

Code:
if((pad.Buttons & PSP_CTRL_CROSS) && (select == 0)) {

	
MY CODE

    }
printf("\n Apasati O pentru a reveni la meniu."); 
	
	if(pad.Buttons & PSP_CTRL_CROSS)
	return main();
	
	
	sceKernelSleepThread();
	


}
Something wrong?
if your following his tutorials than he's left a crucial point out of the menu tutorial, which is state's, honestly these tutorials seem to go in different directions from one to the next after the 5th tutorial(i.e. player movement->arrays and loops?, copy files(heck, why copy files?)-> if/else/switch?!, from my glimpse over them, they should not be taken as ordered tutorials but more as independent tutorials)

however, here is an idea of what you must do:

Code:
#define MAINMENU 0
#define GAME 1
int main(int argc, char **argv){
    int GameState = MAINMENU;
    while(1){
        if(GameState==MAINMENU){
           //Menu code here
           if(/*Start Game if statement here*/) GameState=GAME;
        }else if(GameState==GAME){
             //Game Code
             if(/*return to menu if statement here*/) GameState=MAINMENU;
        }
    }
    return 0;
}
game states is very important to understand when making a game
__________________
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
Old 11-08-2009, 09:23 AM   #44
 
_df_'s Avatar
 
Join Date: May 2007
Posts: 121
Trader Feedback: 0
Default

the problem he has is he is doing "return main();" in the middle of his code...
__________________
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

"Did IQ's just drop sharply while I was away?" (Ripley)
_df_ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-08-2009, 07:08 PM   #45

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

Quote:
Originally Posted by _df_ View Post
the problem he has is he is doing "return main();" in the middle of his code...
that too, but i'm going on the fact that he's following the menu tutorial, which from reading it, it makes no connection is explaing how to enter into your game from the menu(and return to the menu), but simple how to make a menu that you can go up and down through
__________________
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
Old 11-09-2009, 09:07 AM   #46
 
Join Date: Oct 2009
Real First Name: V. Bogdan
Location: Romania
Just Played: PSP-Fanatik
Posts: 4
Trader Feedback: 0
Default

Thanks for advices !

I`ve done it!
pentagram is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-14-2009, 01:54 PM   #47

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by slicer4ever View Post
that too, but i'm going on the fact that he's following the menu tutorial, which from reading it, it makes no connection is explaing how to enter into your game from the menu(and return to the menu), but simple how to make a menu that you can go up and down through
I never wrote a tutorial on how to switch from game to menu. Honestly, it's not that hard.

void game() {

if(buttons)
menu();

}

void menu() {
while(!done) {
//code
}
//breaks back to game() after loop in completed
}

You'll simply go right back to the game after menu is finished. If you need something more advanced than that, you'll have to use a bit of common sense and programming knowledge.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-16-2009, 12:28 AM   #48

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

Quote:
Originally Posted by Access_Denied View Post
I never wrote a tutorial on how to switch from game to menu. Honestly, it's not that hard.
and yet, someone asked a question about how to do it...
__________________
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
Old 11-22-2009, 06:46 PM   #49

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Quote:
Originally Posted by slicer4ever View Post
and yet, someone asked a question about how to do it...
Right, because every question not only deserves to be answered, but to be answered in extreme detail.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
beginner , programming , tut , tutorials

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 10:46 AM.



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