mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 11:35:05 +08:00
Compare commits
1 Commits
refapi-15
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f81af50af |
@@ -543,9 +543,9 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_GetWindowHandle( void **handle, int type )
|
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return REF_WINDOW_TYPE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -246,9 +246,9 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_GetWindowHandle( void **handle, int type )
|
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return REF_WINDOW_TYPE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -513,9 +513,9 @@ qboolean VID_SetMode( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_GetWindowHandle( void **handle, int type )
|
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return REF_WINDOW_TYPE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_config.h>
|
#include <SDL_config.h>
|
||||||
|
#include <SDL_syswm.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
@@ -367,14 +368,13 @@ static void WIN_SetDPIAwareness( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <SDL_syswm.h>
|
|
||||||
static qboolean WIN_SetWindowIcon( HICON ico )
|
static qboolean WIN_SetWindowIcon( HICON ico )
|
||||||
{
|
{
|
||||||
SDL_SysWMinfo wminfo;
|
SDL_SysWMinfo wminfo;
|
||||||
|
|
||||||
SDL_VERSION( &wminfo.version );
|
SDL_VERSION( &wminfo.version );
|
||||||
|
|
||||||
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE )
|
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE && wminfo.info.subsystem == SDL_SYSWM_WINDOWS )
|
||||||
{
|
{
|
||||||
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
|
||||||
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
|
||||||
@@ -1165,52 +1165,67 @@ qboolean VID_SetMode( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_GetWindowHandle( void **handle, int type )
|
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
|
||||||
{
|
{
|
||||||
SDL_SysWMinfo wmInfo;
|
SDL_SysWMinfo wmInfo;
|
||||||
|
|
||||||
|
if( type == REF_WINDOW_TYPE_SDL )
|
||||||
|
{
|
||||||
|
if( handle )
|
||||||
|
*handle = (void *)host.hWnd;
|
||||||
|
return REF_WINDOW_TYPE_SDL;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_VERSION( &wmInfo.version );
|
SDL_VERSION( &wmInfo.version );
|
||||||
|
|
||||||
if ( SDL_GetWindowWMInfo( host.hWnd, &wmInfo ) != SDL_TRUE )
|
if( SDL_GetWindowWMInfo( host.hWnd, &wmInfo ))
|
||||||
{
|
return REF_WINDOW_TYPE_NULL;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( type )
|
switch( wmInfo.info.subsystem )
|
||||||
{
|
{
|
||||||
case REF_WINDOW_TYPE_WIN32:
|
case SDL_SYSWM_WINDOWS:
|
||||||
|
if( !type || type == REF_WINDOW_TYPE_WIN32 )
|
||||||
|
{
|
||||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||||
*handle = (void*)wmInfo.info.win.window; // HWND
|
if( handle )
|
||||||
return TRUE;
|
*handle = (void *)wmInfo.info.win.window;
|
||||||
#else
|
return REF_WINDOW_TYPE_WIN32;
|
||||||
return FALSE;
|
#endif // SDL_VIDEO_DRIVER_WINDOWS
|
||||||
#endif
|
}
|
||||||
case REF_WINDOW_TYPE_MACOS:
|
break;
|
||||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
case SDL_SYSWM_X11:
|
||||||
*handle = (void*)wmInfo.info.cocoa.window; // NSWindow*
|
if( !type || type == REF_WINDOW_TYPE_X11 )
|
||||||
return TRUE;
|
{
|
||||||
#else
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
case REF_WINDOW_TYPE_X11:
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_X11
|
#ifdef SDL_VIDEO_DRIVER_X11
|
||||||
*handle = (void*)(uintptr_t)wmInfo.info.x11.window; // X11 Window
|
if( handle )
|
||||||
return TRUE;
|
*handle = (void *)(uintptr_t)wmInfo.info.x11.window;
|
||||||
#else
|
return REF_WINDOW_TYPE_X11;
|
||||||
return FALSE;
|
#endif // SDL_VIDEO_DRIVER_X11
|
||||||
#endif
|
}
|
||||||
case REF_WINDOW_TYPE_WAYLAND:
|
break;
|
||||||
|
case SDL_SYSWM_COCOA:
|
||||||
|
if( !type || type == REF_WINDOW_TYPE_MACOS )
|
||||||
|
{
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_COCOA
|
||||||
|
if( handle )
|
||||||
|
*handle = (void *)wmInfo.info.cocoa.window;
|
||||||
|
return REF_WINDOW_TYPE_MACOS;
|
||||||
|
#endif // SDL_VIDEO_DRIVER_COCOA
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDL_SYSWM_WAYLAND:
|
||||||
|
if( !type || type == REF_WINDOW_TYPE_WAYLAND )
|
||||||
|
{
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||||
*handle = (void*)wmInfo.info.wl.surface; // wl_surface*
|
if( handle )
|
||||||
return TRUE;
|
*handle = (void *)wmInfo.info.wl.surface;
|
||||||
#else
|
return REF_WINDOW_TYPE_WAYLAND;
|
||||||
return FALSE;
|
#endif // SDL_VIDEO_DRIVER_WAYLAND
|
||||||
#endif
|
}
|
||||||
case REF_WINDOW_TYPE_SDL:
|
break;
|
||||||
*handle = (void*)host.hWnd; // SDL_Window*
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return REF_WINDOW_TYPE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ GNU General Public License for more details.
|
|||||||
// CL_RunLightStyles now accepts lightstyles array.
|
// CL_RunLightStyles now accepts lightstyles array.
|
||||||
// Removed R_DrawTileClear and Mod_LoadMapSprite, as they're implemented on engine side
|
// Removed R_DrawTileClear and Mod_LoadMapSprite, as they're implemented on engine side
|
||||||
// Removed FillRGBABlend. Now FillRGBA accepts rendermode parameter.
|
// Removed FillRGBABlend. Now FillRGBA accepts rendermode parameter.
|
||||||
// 10. Added R_GetWindowHandle.
|
// 10. Added R_GetWindowHandle to retrieve platform-specific window object.
|
||||||
#define REF_API_VERSION 9
|
#define REF_API_VERSION 10
|
||||||
|
|
||||||
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP|TF_ALLOW_NEAREST)
|
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP|TF_ALLOW_NEAREST)
|
||||||
#define TF_FONT (TF_NOMIPMAP|TF_CLAMP|TF_ALLOW_NEAREST)
|
#define TF_FONT (TF_NOMIPMAP|TF_CLAMP|TF_ALLOW_NEAREST)
|
||||||
@@ -104,14 +104,15 @@ typedef enum
|
|||||||
DEMO_QUAKE1
|
DEMO_QUAKE1
|
||||||
} demo_mode;
|
} demo_mode;
|
||||||
|
|
||||||
enum
|
typedef enum ref_window_type_e
|
||||||
{
|
{
|
||||||
REF_WINDOW_TYPE_WIN32 = 1, // HWND
|
REF_WINDOW_TYPE_NULL = 0,
|
||||||
REF_WINDOW_TYPE_X11 = 2, // Display*
|
REF_WINDOW_TYPE_WIN32, // HWND
|
||||||
REF_WINDOW_TYPE_WAYLAND = 3, // wl_display*
|
REF_WINDOW_TYPE_X11, // Display*
|
||||||
REF_WINDOW_TYPE_MACOS = 4, // NSWindow*
|
REF_WINDOW_TYPE_WAYLAND, // wl_display*
|
||||||
REF_WINDOW_TYPE_SDL = 5, // SDL_Window*
|
REF_WINDOW_TYPE_MACOS, // NSWindow*
|
||||||
};
|
REF_WINDOW_TYPE_SDL, // SDL_Window*
|
||||||
|
} ref_window_type_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -479,7 +480,7 @@ typedef struct ref_api_s
|
|||||||
fs_api_t *fsapi;
|
fs_api_t *fsapi;
|
||||||
|
|
||||||
// for abstracting the engine's rendering
|
// for abstracting the engine's rendering
|
||||||
qboolean (*R_GetWindowHandle)( void **handle, int type );
|
ref_window_type_t (*R_GetWindowHandle)( void **handle, ref_window_type_t type );
|
||||||
} ref_api_t;
|
} ref_api_t;
|
||||||
|
|
||||||
struct mip_s;
|
struct mip_s;
|
||||||
|
|||||||
Reference in New Issue
Block a user