much better user interface for litenes
This commit is contained in:
parent
891375d8fa
commit
ef885890c1
3 changed files with 14 additions and 9 deletions
|
@ -6,7 +6,7 @@
|
||||||
#include <klib.h>
|
#include <klib.h>
|
||||||
|
|
||||||
static int frame_cnt;
|
static int frame_cnt;
|
||||||
bool candraw() { return frame_cnt % 3 == 0; }
|
static inline bool candraw() { return frame_cnt % (1 + FRAME_SKIP) == 0; }
|
||||||
|
|
||||||
static uint32_t canvas[SCR_W * SCR_H];
|
static uint32_t canvas[SCR_W * SCR_H];
|
||||||
|
|
||||||
|
@ -112,9 +112,11 @@ void fce_run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nr_draw ++;
|
nr_draw ++;
|
||||||
if (uptime_ms() - last > 1000) {
|
int upt = uptime_ms();
|
||||||
last = uptime_ms();
|
if (upt - last > 1000) {
|
||||||
printf("FPS = %d\n", nr_draw);
|
last = upt;
|
||||||
|
for (int i = 0; i < 80; i++) putch('\b');
|
||||||
|
printf("(System time: %ds) FPS = %d", upt / 1000, nr_draw);
|
||||||
nr_draw = 0;
|
nr_draw = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#define FPS 60
|
#define FPS 60
|
||||||
#define SCR_W 256
|
#define SCR_W 256
|
||||||
#define SCR_H 240
|
#define SCR_H 240
|
||||||
|
#define FRAME_SKIP 1
|
||||||
|
|
||||||
void fce_update_screen();
|
void fce_update_screen();
|
||||||
int fce_load_rom(char *rom);
|
int fce_load_rom(char *rom);
|
||||||
|
|
|
@ -7,11 +7,13 @@ extern char rom_mario_nes[];
|
||||||
int main() {
|
int main() {
|
||||||
ioe_init();
|
ioe_init();
|
||||||
|
|
||||||
printf("Play: [%s] SELECT [%s] START [%s]\n"
|
printf("==================== LiteNES Emulator ====================\n\n");
|
||||||
" [%s] [%s] [%s] A [%s] B [%s]\n",
|
printf("Control: [%s] SELECT [%s] START [%s]\n"
|
||||||
|
" [%s] [%s] [%s] A [%s] B [%s]\n\n",
|
||||||
TOSTRING(KEY_UP), TOSTRING(KEY_SELECT), TOSTRING(KEY_START),
|
TOSTRING(KEY_UP), TOSTRING(KEY_SELECT), TOSTRING(KEY_START),
|
||||||
TOSTRING(KEY_LEFT), TOSTRING(KEY_DOWN), TOSTRING(KEY_RIGHT),
|
TOSTRING(KEY_LEFT), TOSTRING(KEY_DOWN), TOSTRING(KEY_RIGHT),
|
||||||
TOSTRING(KEY_A), TOSTRING(KEY_B));
|
TOSTRING(KEY_A), TOSTRING(KEY_B));
|
||||||
|
printf("==========================================================\n");
|
||||||
|
|
||||||
fce_load_rom((void *)rom_mario_nes);
|
fce_load_rom((void *)rom_mario_nes);
|
||||||
fce_init();
|
fce_init();
|
||||||
|
|
Loading…
Reference in a new issue