Merge sdl_mode.c to sdl_video.c

This commit is contained in:
kichikuou
2020-09-10 15:42:27 +09:00
parent 988a072964
commit f5248bda8a
3 changed files with 38 additions and 76 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ if (X11_FOUND)
set(SRC_GRAPHDEV xcore_draw.c xcore_video.c xcore_mode.c xcore_event.c xcore_cursor.c xcore_maskupdate.c image.c xcore_image.c)
set(SUMMARY_GRAPHDEV "X11")
elseif (SDL2_FOUND)
set(SRC_GRAPHDEV sdl_video.c sdl_mode.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c)
set(SRC_GRAPHDEV sdl_video.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c)
set(SUMMARY_GRAPHDEV "SDL2")
set(ENABLE_SDL 1)
else()
-75
View File
@@ -1,75 +0,0 @@
/*
* sdl_darw.c SDL video mode and full-screen
*
* Copyright (C) 2000- Fumihiko Murata <fmurata@p1.tcnet.ne.jp>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* $Id: sdl_mode.c,v 1.6 2003/01/04 17:01:02 chikama Exp $ */
#include "config.h"
#include <stdio.h>
#include <limits.h>
#include <SDL.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include "portab.h"
#include "system.h"
#include "sdl_private.h"
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);
}
}
/* Windowの大きさの変更 */
void sdl_setWindowSize(int x, int y, int w, int h) {
view_x = x;
view_y = y;
if (w == view_w && h == view_h) return;
view_w = w;
view_h = h;
#ifndef __ANDROID__
SDL_SetWindowSize(sdl_window, w, h);
#endif
SDL_RenderSetLogicalSize(sdl_renderer, w, h);
if (sdl_display)
SDL_FreeSurface(sdl_display);
if (sdl_texture)
SDL_DestroyTexture(sdl_texture);
sdl_display = SDL_CreateRGBSurface(0, w, h, 32, 0, 0, 0, 0);
sdl_texture = SDL_CreateTexture(sdl_renderer, sdl_display->format->format,
SDL_TEXTUREACCESS_STATIC, w, h);
//ms_active = (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ? TRUE : FALSE;
#ifdef __EMSCRIPTEN__
EM_ASM( xsystem35.shell.windowSizeChanged(); );
#endif
}
+37
View File
@@ -206,6 +206,43 @@ 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_setWindowSize(int x, int y, int w, int h) {
view_x = x;
view_y = y;
if (w == view_w && h == view_h) return;
view_w = w;
view_h = h;
#ifndef __ANDROID__
SDL_SetWindowSize(sdl_window, w, h);
#endif
SDL_RenderSetLogicalSize(sdl_renderer, w, h);
if (sdl_display)
SDL_FreeSurface(sdl_display);
if (sdl_texture)
SDL_DestroyTexture(sdl_texture);
sdl_display = SDL_CreateRGBSurface(0, w, h, 32, 0, 0, 0, 0);
sdl_texture = SDL_CreateTexture(sdl_renderer, sdl_display->format->format,
SDL_TEXTUREACCESS_STATIC, w, h);
//ms_active = (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ? TRUE : FALSE;
#ifdef __EMSCRIPTEN__
EM_ASM( xsystem35.shell.windowSizeChanged(); );
#endif
}
#ifdef __EMSCRIPTEN__
void* EMSCRIPTEN_KEEPALIVE sdl_getDisplaySurface() {