native,gpu: small refactor for W and H

This commit is contained in:
Zihao Yu 2024-08-28 12:49:28 +08:00
parent befa045964
commit e6f833c3b9

View file

@ -3,12 +3,12 @@
#include <fenv.h>
//#define MODE_800x600
#define WINDOW_W 800
#define WINDOW_H 600
#ifdef MODE_800x600
# define W 800
# define H 600
const int disp_w = WINDOW_W, disp_h = WINDOW_H;
#else
# define W 400
# define H 300
const int disp_w = 400, disp_h = 300;
#endif
#define FPS 60
@ -31,13 +31,8 @@ void __am_gpu_init() {
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
window = SDL_CreateWindow("Native Application",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
#ifdef MODE_800x600
W, H,
#else
W * 2, H * 2,
#endif
SDL_WINDOW_OPENGL);
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, W, H, 32,
WINDOW_W, WINDOW_H, SDL_WINDOW_OPENGL);
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, disp_w, disp_h, 32,
RMASK, GMASK, BMASK, AMASK);
SDL_AddTimer(1000 / FPS, texture_sync, NULL);
}
@ -45,7 +40,7 @@ void __am_gpu_init() {
void __am_gpu_config(AM_GPU_CONFIG_T *cfg) {
*cfg = (AM_GPU_CONFIG_T) {
.present = true, .has_accel = false,
.width = W, .height = H,
.width = disp_w, .height = disp_h,
.vmemsz = 0
};
}