mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
unified menu wip and some reorganization for it
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@638 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
13b692eb4e
commit
24b24674ae
10 changed files with 487 additions and 102 deletions
12
gp2x/emu.h
12
gp2x/emu.h
|
@ -4,18 +4,6 @@
|
|||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
|
||||
|
||||
// engine states
|
||||
enum TPicoGameState {
|
||||
PGS_Paused = 1,
|
||||
PGS_Running,
|
||||
PGS_Quit,
|
||||
PGS_KeyConfig,
|
||||
PGS_ReloadRom,
|
||||
PGS_Menu,
|
||||
PGS_RestartRun,
|
||||
};
|
||||
|
||||
extern char romFileName[];
|
||||
extern int engineState;
|
||||
|
||||
|
|
24
gp2x/menu.c
24
gp2x/menu.c
|
@ -1483,28 +1483,6 @@ static void menu_loop_root(void)
|
|||
}
|
||||
}
|
||||
|
||||
void menu_darken_bg(void *dst, int pixels, int darker)
|
||||
{
|
||||
unsigned int *screen = dst;
|
||||
pixels /= 2;
|
||||
if (darker)
|
||||
{
|
||||
while (pixels--)
|
||||
{
|
||||
unsigned int p = *screen;
|
||||
*screen++ = ((p&0xf79ef79e)>>1) - ((p&0xc618c618)>>3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (pixels--)
|
||||
{
|
||||
unsigned int p = *screen;
|
||||
*screen++ = (p&0xf79ef79e)>>1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_prepare_bg(int use_game_bg)
|
||||
{
|
||||
if (use_game_bg)
|
||||
|
@ -1535,7 +1513,7 @@ static void menu_gfx_prepare(void)
|
|||
}
|
||||
|
||||
|
||||
void menu_loop(void)
|
||||
void menu_loop_old(void)
|
||||
{
|
||||
in_set_blocking(1);
|
||||
menu_gfx_prepare();
|
||||
|
|
43
gp2x/plat.c
Normal file
43
gp2x/plat.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "gp2x.h"
|
||||
#include "../common/plat.h"
|
||||
#include "../common/readpng.h"
|
||||
#include "../common/menu.h"
|
||||
|
||||
|
||||
void plat_video_menu_enter(int is_rom_loaded)
|
||||
{
|
||||
if (is_rom_loaded)
|
||||
{
|
||||
// darken the active framebuffer
|
||||
memset(gp2x_screen, 0, 320*8*2);
|
||||
menu_darken_bg((char *)gp2x_screen + 320*8*2, 320*224, 1);
|
||||
memset((char *)gp2x_screen + 320*232*2, 0, 320*8*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// should really only happen once, on startup..
|
||||
readpng(gp2x_screen, "skin/background.png", READPNG_BG);
|
||||
}
|
||||
|
||||
// copy to buffer2
|
||||
gp2x_memcpy_buffers((1<<2), gp2x_screen, 0, 320*240*2);
|
||||
|
||||
// switch to 16bpp
|
||||
gp2x_video_changemode2(16);
|
||||
gp2x_video_RGB_setscaling(0, 320, 240);
|
||||
gp2x_video_flip2();
|
||||
}
|
||||
|
||||
void plat_video_menu_begin(void)
|
||||
{
|
||||
gp2x_pd_clone_buffer2();
|
||||
}
|
||||
|
||||
void plat_video_menu_end(void)
|
||||
{
|
||||
gp2x_video_flush_cache();
|
||||
gp2x_video_flip2();
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue