Inicio » Artículos » PROGRAMACION » SAMPLES

[SAMPLE][C] Menu
 

MAIN.C


// Libreria a Incluir Necesarias
#include <pspsdk.h>
#include <pspkernel.h>
#include <psppower.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <pspdebug.h>
 
PSP_MODULE_INFO("Sample Menu", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
 
SceCtrlData currentPad, lastPad;
 
int opcion = 1;
int down = 1;
int up = 1;
 
void Menu_A()
{
opcion = 1;
down = 1;
up = 1;
 
pspDebugScreenClear();
pspDebugScreenSetTextColor(0xFF0000);
pspDebugScreenPrintf("\n Sample Menu by 6381\n\n\n");
pspDebugScreenSetTextColor(0xFFFFFF);
pspDebugScreenPrintf(" Seleccione una Opcion:\n\n");
pspDebugScreenSetTextColor(0x0000FF);
pspDebugScreenPrintf(" -> Opcion 1\n");
pspDebugScreenSetTextColor(0xFFFFFF);
pspDebugScreenPrintf(" -> Opcion 2\n\n");
pspDebugScreenSetTextColor(0xFFFFFF);
pspDebugScreenPrintf(" -> Salir\n\n\n");
}
 
void Menu_B()
{
opcion = 2;
down = 2;
up = 2;
 
pspDebugScreenClear();
pspDebugScreenSetTextColor(0xFF0000);
pspDebugScreenPrintf("\n Sample Menu by 6381\n\n\n");
pspDebugScreenSetTextColor(0xFFFFFF); pspDebugScreenPrintf(" Seleccione una Opcion:\n\n"); pspDebugScreenPrintf(" -> Opcion 1\n"); pspDebugScreenSetTextColor(0x0000FF); pspDebugScreenPrintf(" -> Opcion 2\n\n"); pspDebugScreenSetTextColor(0xFFFFFF); pspDebugScreenPrintf(" -> Salir\n\n\n"); }   void Menu_C() { opcion = 3; down = 3; up = 3;   pspDebugScreenClear(); pspDebugScreenSetTextColor(0xFF0000); pspDebugScreenPrintf("\n Sample Menu by 6381\n\n\n"); pspDebugScreenSetTextColor(0xFFFFFF); pspDebugScreenPrintf(" Seleccione una Opcion:\n\n"); pspDebugScreenPrintf(" -> Opcion 1\n"); pspDebugScreenSetTextColor(0xFFFFFF); pspDebugScreenPrintf(" -> Opcion 2\n\n"); pspDebugScreenSetTextColor(0x0000FF); pspDebugScreenPrintf(" -> Salir\n\n\n"); }   void Opcion_A() { pspDebugScreenClear(); pspDebugScreenSetTextColor(0x00FF00); pspDebugScreenPrintf("\n Define aqui tu Opcion 1"); sceKernelDelayThread(2*1000*1000); Menu_A(); }   void Opcion_B() { pspDebugScreenClear(); pspDebugScreenSetTextColor(0x00FF00); pspDebugScreenPrintf("\n Define aqui tu Opcion 2"); sceKernelDelayThread(2*1000*1000); Menu_A(); }   void Opcion_C() { pspDebugScreenSetTextColor(0x00FF00); pspDebugScreenPrintf("\n\n Saliendo... Espere..."); sceKernelDelayThread(2*1000*1000); sceKernelExitGame(); }   int main() { sceCtrlReadBufferPositive(&lastPad, 1);   pspDebugScreenInit(); Menu_A();   while(1) {   sceCtrlReadBufferPositive(&currentPad, 1);   if( currentPad.Buttons != lastPad.Buttons ) { lastPad = currentPad;   if(currentPad.Buttons & PSP_CTRL_DOWN) { switch(down) { case 1: Menu_B(); break;   case 2: Menu_C(); break;   case 3: Menu_A(); break; } }   if(currentPad.Buttons & PSP_CTRL_UP) { switch(up) { case 1: Menu_C(); break;   case 2: Menu_A(); break;   case 3: Menu_B(); break; } } }   if(currentPad.Buttons & PSP_CTRL_CROSS) { switch(opcion) { case 1: Opcion_A(); break;   case 2: Opcion_B(); break;   case 3: Opcion_C(); break; } } } }


MAKEFILE

TARGET = SampleMenu
OBJS = menu.o
 
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
 
LIBDIR =
LDFLAGS =
LIBS =
 
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Sample Menu
 
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak 


Categoría: SAMPLES | Ha añadido: 6381 (2011-10-03)
Visiones: 366 | Ranking: 0.0/0
Total de comentarios: 0
Solamente los usuarios registrados pueden añadir los comentarios.
[ Registrarse | Entrada ]
Banner
Member Banner
Quién está ONLINE
Online: 1
Visitantes 1
Registrados: 0
Formulario de entrada
Visitantes