mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: platform: move SDL2 support code into sdl2 subdirectory. Change XASH_SDL macro value from 12 to 1 for SDL1.2
This commit is contained in:
@@ -254,8 +254,8 @@ void Platform_SetCursorType( VGUI_DefaultCursor type );
|
||||
int Platform_GetClipboardText( char *buffer, size_t size );
|
||||
void Platform_SetClipboardText( const char *buffer );
|
||||
|
||||
#if XASH_SDL == 12
|
||||
#define SDL_SetWindowGrab( wnd, state ) SDL_WM_GrabInput( (state) )
|
||||
#if XASH_SDL == 1
|
||||
#define SDL_SetWindowGrab( wnd, state ) SDL_WM_GrabInput( (state) ? SDL_GRAB_ON : SDL_GRAB_OFF )
|
||||
#define SDL_MinimizeWindow( wnd ) SDL_WM_IconifyWindow()
|
||||
#define SDL_IsTextInputActive() host.textmode
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
events.c - SDL event system handlers
|
||||
Copyright (C) 2015-2017 a1batross
|
||||
host_sdl2.c - SDL event system handlers
|
||||
Copyright (C) 2015-2025 a1batross
|
||||
|
||||
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
|
||||
@@ -21,7 +21,7 @@ GNU General Public License for more details.
|
||||
#include "input.h"
|
||||
#include "client.h"
|
||||
#include "vgui_draw.h"
|
||||
#include "events.h"
|
||||
#include "platform_sdl2.h"
|
||||
#include "sound.h"
|
||||
#include "vid_common.h"
|
||||
|
||||
@@ -19,7 +19,7 @@ GNU General Public License for more details.
|
||||
#include "input.h"
|
||||
#include "client.h"
|
||||
#include "vgui_draw.h"
|
||||
#include "events.h"
|
||||
#include "platform_sdl2.h"
|
||||
#include "sound.h"
|
||||
#include "vid_common.h"
|
||||
|
||||
@@ -19,7 +19,7 @@ GNU General Public License for more details.
|
||||
#include "keydefs.h"
|
||||
#include "input.h"
|
||||
#include "client.h"
|
||||
#include "events.h"
|
||||
#include "platform_sdl2.h"
|
||||
|
||||
static const int g_button_mapping[] =
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
events.h - SDL backend internal header
|
||||
platform_sdl2.h - SDL backend internal header
|
||||
Copyright (C) 2015-2018 a1batross
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,7 @@ GNU General Public License for more details.
|
||||
#define KEYWRAPPER_H
|
||||
#ifdef XASH_SDL
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include "platform.h"
|
||||
|
||||
// window management
|
||||
void VID_RestoreScreenResolution( void );
|
||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "platform/platform.h"
|
||||
#include "platform.h"
|
||||
#if XASH_SOUND == SOUND_SDL
|
||||
|
||||
#include "sound.h"
|
||||
@@ -14,8 +14,8 @@ GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
#include "platform/platform.h"
|
||||
#include "events.h"
|
||||
#include "platform.h"
|
||||
#include "platform_sdl2.h"
|
||||
|
||||
#if XASH_TIMER == TIMER_SDL
|
||||
double Platform_DoubleTime( void )
|
||||
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "vid_common.h"
|
||||
#include "platform/sdl/events.h"
|
||||
#include "platform_sdl2.h"
|
||||
|
||||
static vidmode_t *vidmodes = NULL;
|
||||
static int num_vidmodes = 0;
|
||||
@@ -30,8 +30,8 @@ def options(opt):
|
||||
grp.add_option('--enable-custom-swap', action = 'store_true', dest = 'CUSTOM_SWAP', default = False,
|
||||
help = 'enable custom swap allocator. For devices with no swap support')
|
||||
|
||||
grp.add_option('--enable-legacy-sdl', action = 'store_true', dest = 'SDL12', default = False,
|
||||
help = 'enable using SDL1.2 instead of SDL2(not recommended) [default: %(default)s]')
|
||||
grp.add_option('--use-sdl1', action = 'store_true', dest = 'SDL12', default = False,
|
||||
help = 'enable using SDL1.2 instead of SDL2 (not supported or recommended) [default: %(default)s]')
|
||||
|
||||
grp.add_option('--enable-static-binary', action = 'store_true', dest = 'STATIC', default = False,
|
||||
help = 'build static binary(not recommended, --single-binary required) [default: %(default)s]')
|
||||
@@ -103,9 +103,9 @@ def configure(conf):
|
||||
elif conf.env.DEST_OS == 'linux' and conf.options.FBDEV_SW:
|
||||
conf.check_cc(lib='asound')
|
||||
elif conf.options.SDL12: # TODO: move to sdl2.py
|
||||
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL2')
|
||||
conf.env.XASH_SDL = 12
|
||||
conf.env.HAVE_SDL2 = True
|
||||
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL1')
|
||||
conf.env.XASH_SDL = 1
|
||||
conf.env.HAVE_SDL1 = True
|
||||
else:
|
||||
find_sdl(conf)
|
||||
|
||||
@@ -137,7 +137,7 @@ def build(bld):
|
||||
bld(name = 'engine_includes', export_includes = '. common common/imagelib', use = 'filesystem_includes')
|
||||
|
||||
libs = ['engine_includes', 'public', 'dllemu', 'werror', 'backtrace']
|
||||
includes = ['server', 'client', 'client/vgui', 'common/soundlib']
|
||||
includes = ['server', 'client', 'client/vgui', 'common/soundlib', 'platform']
|
||||
|
||||
# basic build: dedicated only
|
||||
source = bld.path.ant_glob(['common/*.c', 'common/imagelib/*.c', 'common/soundlib/*.c', 'server/*.c'])
|
||||
@@ -196,8 +196,8 @@ def build(bld):
|
||||
if bld.env.CLIENT:
|
||||
defines = []
|
||||
if bld.env.XASH_SDL:
|
||||
libs += ['SDL3' if bld.env.HAVE_SDL3 else 'SDL2']
|
||||
source += bld.path.ant_glob(['platform/sdl/*.c'])
|
||||
libs += ['SDL%d' % bld.env.XASH_SDL]
|
||||
source += bld.path.ant_glob(['platform/sdl%d/*.c' % bld.env.XASH_SDL])
|
||||
defines += ['XASH_SDL=%d' % bld.env.XASH_SDL]
|
||||
|
||||
# add client files
|
||||
|
||||
Reference in New Issue
Block a user