misc cleanup

This commit is contained in:
Shaun Inman 2023-01-20 22:28:31 -05:00
parent db8bb987c8
commit 7c934dfcd2
5 changed files with 28 additions and 27 deletions

View file

@ -112,6 +112,12 @@ struct owlfb_mem_info {
///////////////////////////////
uint32_t RGB_WHITE;
uint32_t RGB_BLACK;
uint32_t RGB_LIGHT_GRAY;
uint32_t RGB_GRAY;
uint32_t RGB_DARK_GRAY;
static struct GFX_Context {
int mode;
int fb;
@ -168,7 +174,7 @@ SDL_Surface* GFX_init(int mode) {
// open framebuffer
gfx.fb = open("/dev/fb0", O_RDWR);
// configure framebuffer
ioctl(gfx.fb, FBIOGET_VSCREENINFO, &gfx.vinfo);
gfx.vinfo.bits_per_pixel = SCREEN_DEPTH;
@ -276,7 +282,8 @@ void GFX_flip(SDL_Surface* screen) {
static int ticks = 0;
ticks += 1;
#ifdef GFX_ENABLE_VSYNC
#define FRAME_BUDGET 17 // 60fps
// TODO: this condition doesn't make sense when using the threaded renderer
#define FRAME_BUDGET 17 // 60fps
if (frame_start==0 || SDL_GetTicks()-frame_start<FRAME_BUDGET) { // only wait if we're under frame budget
int arg = 1;
ioctl(gfx.fb, OWLFB_WAITFORVSYNC, &arg);

View file

@ -20,11 +20,11 @@ void LOG_note(int level, const char* fmt, ...);
///////////////////////////////
uint32_t RGB_WHITE;
uint32_t RGB_BLACK;
uint32_t RGB_LIGHT_GRAY;
uint32_t RGB_GRAY;
uint32_t RGB_DARK_GRAY;
extern uint32_t RGB_WHITE;
extern uint32_t RGB_BLACK;
extern uint32_t RGB_LIGHT_GRAY;
extern uint32_t RGB_GRAY;
extern uint32_t RGB_DARK_GRAY;
enum {
ASSET_WHITE_PILL,

View file

@ -60,24 +60,12 @@
#define COLOR_DARK_TEXT (SDL_Color){TRIAD_DARK_TEXT}
#define COLOR_BUTTON_TEXT (SDL_Color){TRIAD_GRAY}
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define SCREEN_SCALE 2 // SCREEN_HEIGHT / 240
#define BASE_WIDTH 320
#define BASE_HEIGHT 240
// SNES (stretched to 4:3)
// #define SCREEN_WIDTH 1024
// #define SCREEN_HEIGHT 896
// GBA
// #define SCREEN_WIDTH 960
// #define SCREEN_HEIGHT 720
// GB converted to 4:3 with full height
// #define SCREEN_WIDTH 768
// #define SCREEN_HEIGHT 576
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define SCREEN_SCALE 2 // SCREEN_HEIGHT / 240
#define SCREEN_DEPTH 16
#define SCREEN_BPP 2