MAIN.C
// Libreria a Incluir Necesarias
#include <pspsdk.h>
#include <pspkernel.h>
#include <psppower.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <pspdebug.h>
// Libreria a Incluir Graficas en la misma carpeta que el makefile #include "graphics.h"
#include "framebuffer.h"
PSP_MODULE_INFO("Sample Menu Grafico", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
SceCtrlData currentPad, lastPad;
int opcion = 1;
int down = 1;
int up = 1;
Image *menu;
void Menu_A()
{
opcion = 1;
down = 1;
up = 1;
menu = loadImage("Menu/Imagen_A.png");
blitAlphaImageToScreen(0, 0, 480, 272, menu, 0, 0);
flipScreen();
freeImage(menu);
}
void Menu_B()
{
opcion = 2;
down = 2;
up = 2;
menu = loadImage("Menu/Imagen_B.png");
blitAlphaImageToScreen(0, 0, 480, 272, menu, 0, 0);
flipScreen();
freeImage(menu);
}
void Menu_C()
{
opcion = 3;
down = 3;
up = 3;
menu = loadImage("Menu/Imagen_C.png");
blitAlphaImageToScreen(0, 0, 480, 272, menu, 0, 0);
flipScreen();
freeImage(menu);
}
void Opcion_A() //Define aqui tu Funcion
{
}
void Opcion_B() //Define aqui tu Funcion
{
}
void Opcion_C() //Define aqui tu Funcion
{
sceKernelExitGame();
}
int main()
{
sceCtrlReadBufferPositive(&lastPad, 1);
initGraphics();
Menu_A();
while(1)
{
sceCtrlReadBufferPositive(¤tPad, 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;
}
}
}
}
MAKEFILETARGET = SampleMenuGrafico
OBJS = menu.o LibreriaPNG/graphics.o LibreriaPNG/framebuffer.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS = -lpspgu -lpng -lz -lm -lmad
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Sample Menu Grafico
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
|