native,gpu: small refactor for W and H
This commit is contained in:
parent
befa045964
commit
e6f833c3b9
1 changed files with 7 additions and 12 deletions
|
@ -3,12 +3,12 @@
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
|
||||||
//#define MODE_800x600
|
//#define MODE_800x600
|
||||||
|
#define WINDOW_W 800
|
||||||
|
#define WINDOW_H 600
|
||||||
#ifdef MODE_800x600
|
#ifdef MODE_800x600
|
||||||
# define W 800
|
const int disp_w = WINDOW_W, disp_h = WINDOW_H;
|
||||||
# define H 600
|
|
||||||
#else
|
#else
|
||||||
# define W 400
|
const int disp_w = 400, disp_h = 300;
|
||||||
# define H 300
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FPS 60
|
#define FPS 60
|
||||||
|
@ -31,13 +31,8 @@ void __am_gpu_init() {
|
||||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
|
||||||
window = SDL_CreateWindow("Native Application",
|
window = SDL_CreateWindow("Native Application",
|
||||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||||
#ifdef MODE_800x600
|
WINDOW_W, WINDOW_H, SDL_WINDOW_OPENGL);
|
||||||
W, H,
|
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, disp_w, disp_h, 32,
|
||||||
#else
|
|
||||||
W * 2, H * 2,
|
|
||||||
#endif
|
|
||||||
SDL_WINDOW_OPENGL);
|
|
||||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, W, H, 32,
|
|
||||||
RMASK, GMASK, BMASK, AMASK);
|
RMASK, GMASK, BMASK, AMASK);
|
||||||
SDL_AddTimer(1000 / FPS, texture_sync, NULL);
|
SDL_AddTimer(1000 / FPS, texture_sync, NULL);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +40,7 @@ void __am_gpu_init() {
|
||||||
void __am_gpu_config(AM_GPU_CONFIG_T *cfg) {
|
void __am_gpu_config(AM_GPU_CONFIG_T *cfg) {
|
||||||
*cfg = (AM_GPU_CONFIG_T) {
|
*cfg = (AM_GPU_CONFIG_T) {
|
||||||
.present = true, .has_accel = false,
|
.present = true, .has_accel = false,
|
||||||
.width = W, .height = H,
|
.width = disp_w, .height = disp_h,
|
||||||
.vmemsz = 0
|
.vmemsz = 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue