Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 08, 2012, 06:53:31 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: 1 [2] 3 4 5
Print
Author Topic: [Tutorial] Full Game Part 1 - Menu  (Read 31491 times)
Insert_Witty_Name
Global Moderator
Hero Member
*

Karma: +149/-17
Offline Offline

Posts: 1602
1141.66 points

View Inventory
Send Money to Insert_Witty_Name

View Profile WWW
« Reply #15 on: June 03, 2006, 12:25:12 PM »

Quote from: "whazilla"

there's a space on the end of eatch line in u'r Makefile ... made my cygwin crash on dir ...


Ahh yes, that's how it goes from text that is copy/pasted from the forum.
Logged

Coder formerly known as:

Check out my homebrew & C tutorials at http://insomniac.0x89.org
Last updated 6th Oct 06 - Tutorial 2 added.


faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #16 on: June 04, 2006, 04:19:08 AM »

Inso can i have some help with this ?
Cant figure out how i should start the media player, or the music, im kinda confused.

I have done all the int above so no worries about that, but i dont know
how i chose the media player and then the ps2 dvd, and music player or even the credits.



Code:

        while(1) {
      sceCtrlReadBufferPositive(&pad, 1);
     
     
//*************************************
//If Intro fails to load printf ERROR

    if(!Intro_Music_1) {
    printf("ERROR, MP3 Load Failed,\n");
    }  
   
//********************************
//Intro Image And Music
   MP3_Play();
       
     
     if(pad.Buttons != lastpad.Buttons) {
      lastpad = pad;

      if(pad.Buttons & PSP_CTRL_CROSS)
      {
        if (On_Menu_1 == 1)
           {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 1;
           On_Select_Menu_2 = 0;
           Select_Setting = 1;
           }
        else if (On_Select_Menu_1 == 1)
        {
           On_Menu_1 = 0;
           On_Select_Menu_1 = ;
           On_Select_Menu_2 = 1;
           Select_Setting = 1;
 
        }
       
        else if (On_Select_Menu_2 == 1)
        {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 0;
           On_Select_Menu_2 = 0;
           Select_Setting = 1;
        }
       
      }


// Circle
      if(pad.Buttons & PSP_CTRL_CIRCLE)
      {
        if (On_Select_Menu_1 == 1)
           {
           On_Menu_1 = 1;
           On_Select_Menu_1 = 0;  
           On_Select_Menu_2 = 0;                
           }
           
        if (On_Select_Menu_2 == 1)
           {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 1;
           On_Select_Menu_2 = 0;      
           }
      }

// Up
      if(pad.Buttons & PSP_CTRL_UP)
      {
        if (On_Select_Menu_1 == 1)
           {
           Select_Setting--;
           if (Select_Setting < 1)
           Select_Setting = 1;
           }
           
        if (On_Select_Menu_2 == 1)
           {
           Select_Setting--;
           if (Select_Setting < 1)
           Select_Setting = 1;
           }  
      }
     
     
// Down
      if(pad.Buttons & PSP_CTRL_DOWN)
      {
       if (On_Select_Menu_1 == 1)
           {
           Select_Setting++;
           if (Select_Setting > 3)
           Select_Setting = 3;
           }
       if (On_Select_Menu_2 == 1)
           {
           Select_Setting++;
           if (Select_Setting > 3)
           Select_Setting = 3;
           }  
      }
    }
   
//**********************************************************************************
//blit images
//**********************************************************************************

    blit(0, 0 , 480, 272, Intro_1, 0, 0);
    Show_The_Time();

//**********************************************************************************
//On_Menu_1
//**********************************************************************************
    if (On_Menu_1 == 1)
    {
    printTextScreen(170, 140, "Start App", RGB( 0, 0, 0));
    }
//**********************************************************************************
//On_Select_Menu_1
//**********************************************************************************  
    else if (On_Select_Menu_1 == 1)
    {
      if (Select_Setting == 1)
      {
       Color_1 = RGB(191, 0, 0);
       Color_2 = RGB(0, 0, 0);
       Color_3 = RGB(0, 0, 0);
      }
      else if (Select_Setting == 2)
      {
       Color_1 = RGB(0, 0, 0);
       Color_2 = RGB(191, 0, 0);
       Color_3 = RGB(0, 0, 0);
      }
      else if (Select_Setting == 3)
      {
       Color_1 = RGB(0, 0, 0);
       Color_2 = RGB(0, 0, 0);
       Color_3 = RGB(191, 0, 0);
      }

    printTextScreen(170, 140, "Media Player",    Color_1);
    printTextScreen(170, 150, "Credits",         Color_2);
    printTextScreen(170, 160, "Exit to Eloader", Color_3);
}

//**********************************************************************************
//On_Select_Menu_2
//**********************************************************************************
    else if (On_Select_Menu_2 ==1)
    {
      if (Select_Setting == 1)
      {
       Color_1 = RGB(191, 0, 0);
       Color_2 = RGB(0, 0, 0);
      }
      else if (Select_Setting == 2)
      {
       Color_1 = RGB(0, 0, 0);
       Color_2 = RGB(191, 0, 0);
      }
    printTextScreen(5, 10,  "Music Player",  Color_1);
    printTextScreen(5, 10, "PS2 DVD Player", Color_2);    
}
     
     
     
    sceDisplayWaitVblankStart();
    flipScreen();

    }



Logged

faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #17 on: June 04, 2006, 04:35:24 AM »

or it it like this(i have added some Select_settings) then can i chose the setting with this ?


Code:

        while(1) {
      sceCtrlReadBufferPositive(&pad, 1);
     
     
//*************************************
//If Intro fails to load printf ERROR

    if(!Intro_Music_1) {
    printf("ERROR, MP3 Load Failed,\n");
    }  
   
//********************************
//Intro Image And Music
   MP3_Play();
       
     
     if(pad.Buttons != lastpad.Buttons) {
      lastpad = pad;

      if(pad.Buttons & PSP_CTRL_CROSS)
      {
        if (On_Menu_1 == 1)
           {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 1;
           On_Select_Menu_2 = 0;
           Select_Setting = 1;
           }
        else if (On_Select_Menu_1 == 1)
        {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 0;
           On_Select_Menu_2 = 1;
           Select_Setting = 1;
           Select_Setting = 2;
           Select_Setting = 3;
        }
       
        else if (On_Select_Menu_2 == 1)
        {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 0;
           On_Select_Menu_2 = 0;
           Select_Setting = 1;
           Select_Setting = 2;
        }
       
      }


// Circle
      if(pad.Buttons & PSP_CTRL_CIRCLE)
      {
        if (On_Select_Menu_1 == 1)
           {
           On_Menu_1 = 1;
           On_Select_Menu_1 = 0;  
           On_Select_Menu_2 = 0;                
           }
           
        if (On_Select_Menu_2 == 1)
           {
           On_Menu_1 = 0;
           On_Select_Menu_1 = 1;
           On_Select_Menu_2 = 0;      
           }
      }

// Up
      if(pad.Buttons & PSP_CTRL_UP)
      {
        if (On_Select_Menu_1 == 1)
           {
           Select_Setting--;
           if (Select_Setting < 1)
           Select_Setting = 1;
           }
           
        if (On_Select_Menu_2 == 1)
           {
           Select_Setting--;
           if (Select_Setting < 1)
           Select_Setting = 1;
           }  
      }
     
     
// Down
      if(pad.Buttons & PSP_CTRL_DOWN)
      {
       if (On_Select_Menu_1 == 1)
           {
           Select_Setting++;
           if (Select_Setting > 3)
           Select_Setting = 3;
           }
       if (On_Select_Menu_2 == 1)
           {
           Select_Setting++;
           if (Select_Setting > 3)
           Select_Setting = 3;
           }  
      }
    }
   
//**********************************************************************************
//blit images
//**********************************************************************************

    blit(0, 0 , 480, 272, Intro_1, 0, 0);
    Show_The_Time();

//**********************************************************************************
//On_Menu_1
//**********************************************************************************
    if (On_Menu_1 == 1)
    {
    printTextScreen(170, 140, "Start App", RGB( 0, 0, 0));
    }
//**********************************************************************************
//On_Select_Menu_1
//**********************************************************************************  
    else if (On_Select_Menu_1 == 1)
    {
      if (Select_Setting == 1)
      {
       Color_1 = RGB(191, 0, 0);
       Color_2 = RGB(0, 0, 0);
       Color_3 = RGB(0, 0, 0);
      }
      else if (Select_Setting == 2)
      {
       Color_1 = RGB(0, 0, 0);
       Color_2 = RGB(191, 0, 0);
       Color_3 = RGB(0, 0, 0);
      }
      else if (Select_Setting == 3)
      {
       Color_1 = RGB(0, 0, 0);
       Color_2 = RGB(0, 0, 0);
       Color_3 = RGB(191, 0, 0);
      }

    printTextScreen(170, 140, "Media Player",    Color_1);
    printTextScreen(170, 150, "Credits",         Color_2);
    printTextScreen(170, 160, "Exit to Eloader", Color_3);
}

//**********************************************************************************
//On_Select_Menu_2
//**********************************************************************************
    else if (On_Select_Menu_2 ==1)
    {
      if (Select_Setting == 1)
      {
       Color_1 = RGB(191, 0, 0);
       Color_2 = RGB(0, 0, 0);
      }
      else if (Select_Setting == 2)
      {
       Color_1 = RGB(0, 0, 0);
       Color_2 = RGB(191, 0, 0);
      }
    printTextScreen(5, 10,  "Music Player",  Color_1);
    printTextScreen(5, 10, "PS2 DVD Player", Color_2);    
}
     
     
     
    sceDisplayWaitVblankStart();
    flipScreen();

    }


Logged

whazilla
Sr. Member
****

Karma: +2/-8
Offline Offline

Posts: 377
1793.33 points

View Inventory
Send Money to whazilla


View Profile
« Reply #18 on: June 04, 2006, 04:37:13 AM »

howcomes u want a dvd player in a psp ?

try making a menu.c and a mediaplayer.c then in main u call like
Code:

void main(){
menu();
}


and u let the menu call the mediaplayer()
Logged
faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #19 on: June 04, 2006, 04:40:28 AM »

i use my ps2 every day, and i dont have a DVD, thats why Smile
Logged

faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #20 on: June 04, 2006, 04:52:47 AM »

whazilla that is also my plan.
But i dont really know how i can make this in a single folder  Confused
Logged

Insert_Witty_Name
Global Moderator
Hero Member
*

Karma: +149/-17
Offline Offline

Posts: 1602
1141.66 points

View Inventory
Send Money to Insert_Witty_Name

View Profile WWW
« Reply #21 on: June 04, 2006, 05:28:45 AM »

Quote from: "faati"
whazilla that is also my plan.
But i dont really know how i can make this in a single folder  Confused


Patience, next part of the tutorial will be up tonight sometime.
Logged

Coder formerly known as:

Check out my homebrew & C tutorials at http://insomniac.0x89.org
Last updated 6th Oct 06 - Tutorial 2 added.
faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #22 on: June 04, 2006, 05:37:00 AM »

inso i dont wanna make it to a single folder (yet), i need help with the code above  Rolling Eyes
Logged

harleyg
Give miinaturvat Points!
Full Member
***

Karma: +11/-14
Offline Offline

Posts: 231
0.00 points

View Inventory
Send Money to harleyg

View Profile
« Reply #23 on: June 04, 2006, 05:39:30 AM »

Insomniac, whats the next tutorial?
Logged
Insert_Witty_Name
Global Moderator
Hero Member
*

Karma: +149/-17
Offline Offline

Posts: 1602
1141.66 points

View Inventory
Send Money to Insert_Witty_Name

View Profile WWW
« Reply #24 on: June 04, 2006, 05:47:22 AM »

Part 2 to this tutorial.

Setting up the actual game in a seperate .c/.h file, editing the original main.c to accomodate, movement and animation of character.
Logged

Coder formerly known as:

Check out my homebrew & C tutorials at http://insomniac.0x89.org
Last updated 6th Oct 06 - Tutorial 2 added.
Insert_Witty_Name
Global Moderator
Hero Member
*

Karma: +149/-17
Offline Offline

Posts: 1602
1141.66 points

View Inventory
Send Money to Insert_Witty_Name

View Profile WWW
« Reply #25 on: June 04, 2006, 05:48:33 AM »

Quote from: "faati"
inso i dont wanna make it to a single folder (yet), i need help with the code above  Rolling Eyes


What's the error you're having?
Logged

Coder formerly known as:

Check out my homebrew & C tutorials at http://insomniac.0x89.org
Last updated 6th Oct 06 - Tutorial 2 added.
faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #26 on: June 04, 2006, 07:04:54 AM »

I get this Error, i never seen it before.

Quote

$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2   -c -o Common_1/m
ain.o Common_1/main.c
Common_1/main.c: In function 'menu':
Common_1/main.c:53: error: section attribute cannot be specified for local varia
bles
Common_1/main.c:79: warning: 'main' is normally a non-static function
Common_1/main.c:54: warning: unused variable 'sce_newlib_attribute'
././Common_3/framebuffer.h:6: warning: unused variable 'g_vram_base'
make: *** [Common_1/main.o] Error 1




my main.c



Code:


/*
 *     This is a Just a little image/sound processing program
 *            This was created by ********,
 *            Created at 19:50 , 29 April 2006.
 *          If you want to add to this code plz send
 *           me an email,  xxFaaTixx@hotmail.com
 *
 */

//**********************************************************************************
//Headers
//**********************************************************************************
#include <pspaudiolib.h>  
#include <pspdisplay.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspaudio.h>
#include <psppower.h>
#include <pspsircs.h>// ir
#include <pspctrl.h>
//#include <dirent.h>
#include <psprtc.h>
#include <string.h>//ir
#include <pspgu.h>
#include <stdio.h>
#include <png.h>

//**********************************************************************************
//The Included Headers From Folder Common
//**********************************************************************************
#include "./Common_2/menu.h"
#include "./Common_2/ps2_sircs.h"
#include "./Common_3/graphics.h"
#include "./Common_3/mp3player.h"
#include "./Common_3/callbacks.h"
#include "./Common_3/framebuffer.h"

//**********************************************************************************
//The Defines
//**********************************************************************************
#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 272

#define setxy pspDebugScreenSetXY
#define blit  blitAlphaImageToScreen
#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))

//**********************************************************************************
//A little info for the program
//**********************************************************************************
PSP_MODULE_INFO("FaaTis Program", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);

//**********************************************************************************
//The time
//**********************************************************************************
void Show_The_Time()
{      
   pspTime time;  
   Color Black = RGB(0,0,0);  
  char Time_Hours[10];     char Time_Minutes[10];
 
  sceRtcGetCurrentClockLocalTime(&time);      
 
  snprintf(Time_Hours, sizeof(Time_Hours), "%d", (int)time.hour);
  printTextScreen(425, 8, Time_Hours, Black);
 
  snprintf(Time_Minutes, sizeof(Time_Minutes), ":%d", (int)time.minutes);
  printTextScreen(440, 8, Time_Minutes, Black);    
     
}                                                                                  


//**********************************************************************************
//The Main Starts Here
//**********************************************************************************
int main() {
//    Initializing
    pspDebugScreenInit();
    setxy( 1, 0); printf("Initializing...");  
   
    setupCallbacks();    
    powerCallbacks();    
    initGraphics();
    SceCtrlData pad;    
    pspAudioInit();  
    MP3_Init(1);  
         
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);  
     
    sceKernelDelayThread(500000);  
   
//**********************************************************************************
//MP3 Load
//**********************************************************************************
    char Intro_Music_1[255];
    sprintf(Intro_Music_1, "Music/Music.mp3");
    MP3_Load(Intro_Music_1);
 
     
//**********************************************************************************
//The first loop with the menu starts here
//**********************************************************************************        
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
     
//If Intro music fails
if(!Intro_Music_1) {
printf("ERROR, MP3 Load Failed,\n");
}  

MP3_Play();
   
menu();
       
sceDisplayWaitVblankStart();
}
flipScreen();
}

    MP3_Stop();   MP3_End();    MP3_FreeTune();
    sceKernelSleepThread();
    return 0;
}
//**********************************************************************************
//End of program
//**********************************************************************************


Logged

Insert_Witty_Name
Global Moderator
Hero Member
*

Karma: +149/-17
Offline Offline

Posts: 1602
1141.66 points

View Inventory
Send Money to Insert_Witty_Name

View Profile WWW
« Reply #27 on: June 04, 2006, 07:14:57 AM »

You haven't included your menu() function in the above code.

You can PM me all the code if you wish it kept private.
Logged

Coder formerly known as:

Check out my homebrew & C tutorials at http://insomniac.0x89.org
Last updated 6th Oct 06 - Tutorial 2 added.
faati
Full Member
***

Karma: +0/-1
Offline Offline

Posts: 152
0.00 points

View Inventory
Send Money to faati


View Profile
« Reply #28 on: June 04, 2006, 07:22:29 AM »

ill give you my full project folder but i dont know how to give it Sad
Logged

SG57
Sr. Member
****

Karma: +7/-37
Offline Offline

Posts: 474
1140.80 points

View Inventory
Send Money to SG57


View Profile
« Reply #29 on: June 04, 2006, 07:23:40 AM »

well...  Someone said basically calling a function in its self, that there is recursion and is possible, you must first allow running through the code 1 time though, meaning a switch or if statement is needed...

Ex:

Code:

int recursiveBool = 0;
int RecursionFunc(int bool) {
      char string[] = "Recursion Function"
     
      while(1) {
         if(bool<1) {
         printf("This Should occur only ONCE");
         bool++;
         break;
      } else {
         printf("Demonstration of a %s\nThis string will repeate forever.", RecursionFunc(recursiveBool));
         break;
     }
     }
return *string;
int main() {
      RecursionFunc(recursiveBool);
return 0;
}

Give that a whirl in Dev-C++ and watch as the CMD goes nuts while scrolling by such a simpel thing  Cool  

Hope someone learned from me?

EDIT
Wait, i need to fix a few things in that scracth code...
Logged
Pages: 1 [2] 3 4 5
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.444 seconds with 38 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com