Refactor fullscreen code

This commit is contained in:
kichikuou
2020-12-12 16:21:10 +09:00
parent 4d5fd5efca
commit d531fa3994
9 changed files with 25 additions and 32 deletions
-5
View File
@@ -822,11 +822,6 @@ boolean ags_getAntialiasedStringMode() {
return font_get_antialias();
}
void ags_fullscreen(boolean on) {
nact->sys_fullscreen_on = on;
sdl_FullScreen(on);
}
void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy, int lv) {
if (nact->sys_world_depth == 8) return;
-1
View File
@@ -149,7 +149,6 @@ extern void ags_getDIBInfo(DispInfo *info);
extern void ags_getWindowInfo(DispInfo *info);
extern void ags_getViewAreaInfo(DispInfo *info);
extern boolean ags_regionContains(MyRectangle *r, int x, int y);
extern void ags_fullscreen(boolean on);
extern boolean ags_check_param(int *x, int *y, int *w, int *h);
extern boolean ags_check_param_xy(int *x, int *y);
extern void ags_intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst);
+1 -1
View File
@@ -429,7 +429,7 @@ void commandZZ10() {
/* スクリーンモードを取得する */
int *var = getCaliVariable();
*var = nact->sys_fullscreen_on ? 1 : 0;
*var = sdl_isFullscreen() ? 1 : 0;
DEBUG_COMMAND("ZZ10 %d:\n",*var);
}
-5
View File
@@ -78,7 +78,6 @@ typedef struct {
void *datatbl_addr; /* データテーブルのアドレス */
int fnc_return_value; /* 関数の戻り値として返す値 (~0,cali:で渡す値) */
#if 1
/* ags info */
Palette256 *sys_pal;
boolean sys_pal_changed;
@@ -86,10 +85,6 @@ typedef struct {
MyDimension sys_world_size;
int sys_world_depth;
int sys_mouse_movesw; /* 0:IZを無視, 1: 直接指定場所へ, 2: スムーズに指定場所に */
boolean sys_fullscreen_capable;
boolean sys_fullscreen_on;
#endif
/* for fader/ecopy */
int effect_rate;
+2 -2
View File
@@ -41,12 +41,12 @@ extern void sdl_setWorldSize(int width, int height, int depth);
extern void sdl_setWindowSize(int x, int y, int w, int h);
extern void sdl_setWindowTitle(char *name);
extern void sdl_getWindowInfo(DispInfo *info);
extern void sdl_FullScreen(boolean on);
extern void sdl_setFullscreen(boolean on);
extern boolean sdl_isFullscreen(void);
extern agsurface_t *sdl_getDIB(void);
/* 画面更新 */
extern void sdl_updateArea(MyRectangle *src, MyPoint *dst);
extern void sdl_fullScreen(boolean on);
extern void sdl_updateScreen(void);
/* パレット関係 */
+7 -6
View File
@@ -139,13 +139,14 @@ static void sdl_getEvent(void) {
break;
case SDL_KEYUP:
keyEventProsess(&e.key, FALSE);
if (e.key.keysym.sym == SDLK_F1) msg_skip = TRUE;
#ifndef __EMSCRIPTEN__
if (e.key.keysym.sym == SDLK_F4) {
sdl_fs_on = !sdl_fs_on;
SDL_SetWindowFullscreen(sdl_window, sdl_fs_on ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
switch (e.key.keysym.sym) {
case SDLK_F1:
msg_skip = TRUE;
break;
case SDLK_F4:
sdl_setFullscreen(!sdl_fs_on);
break;
}
#endif
break;
case SDL_MOUSEMOTION:
mousex = e.motion.x;
+11 -8
View File
@@ -201,14 +201,17 @@ void sdl_setAutoRepeat(boolean bool) {
}
}
void sdl_FullScreen(boolean on) {
if (on && !sdl_fs_on) {
sdl_fs_on = TRUE;
SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
} else if (!on && sdl_fs_on) {
sdl_fs_on = FALSE;
SDL_SetWindowFullscreen(sdl_window, 0);
}
void sdl_setFullscreen(boolean on) {
#ifndef __EMSCRIPTEN__
if (on == sdl_fs_on)
return;
SDL_SetWindowFullscreen(sdl_window, on ? SDL_WINDOW_FULLSCREEN_DESKTOP: 0);
sdl_fs_on = on;
#endif
}
boolean sdl_isFullscreen(void) {
return sdl_fs_on;
}
void sdl_setWindowSize(int x, int y, int w, int h) {
+3 -3
View File
@@ -22,9 +22,9 @@
#include <SDL_syswm.h>
#include "system.h"
#include "menu.h"
#include "sdl_core.h"
#include "sdl_private.h"
#include "resources.h"
#include "ags.h"
static HWND get_hwnd(SDL_Window *window) {
SDL_SysWMinfo info;
@@ -50,10 +50,10 @@ void win_menu_onsyswmevent(SDL_SysWMmsg* msg) {
menu_quitmenu_open();
break;
case ID_SCREEN_WINDOW:
ags_fullscreen(FALSE);
sdl_setFullscreen(FALSE);
break;
case ID_SCREEN_FULL:
ags_fullscreen(TRUE);
sdl_setFullscreen(TRUE);
break;
}
break;
+1 -1
View File
@@ -220,7 +220,7 @@ static void sys35_init() {
for (i = 0; i < FONTTYPEMAX; i++)
font_set_name_and_index(i, fontname_tt[i], fontface[i]);
ags_fullscreen(fs_on);
sdl_setFullscreen(fs_on);
nact->noantialias = font_noantialias;
ags_setAntialiasedStringMode(!font_noantialias);