mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-01 13:40:59 +00:00
Port ref_soft SDL 3.
This commit is contained in:
parent
61e7ec9697
commit
aaf917e28e
2 changed files with 29 additions and 1 deletions
|
@ -19,11 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// sw_main.c
|
// sw_main.c
|
||||||
#include <stdint.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#else
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_video.h>
|
#include <SDL2/SDL_video.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
|
|
||||||
|
@ -1897,11 +1900,19 @@ RE_InitContext(void *win)
|
||||||
|
|
||||||
if (r_vsync->value)
|
if (r_vsync->value)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
#else
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED);
|
||||||
|
#else
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select the color for drawing. It is set to black here. */
|
/* Select the color for drawing. It is set to black here. */
|
||||||
|
@ -1917,7 +1928,11 @@ RE_InitContext(void *win)
|
||||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||||
// Figure out if we are high dpi aware.
|
// Figure out if we are high dpi aware.
|
||||||
int flags = SDL_GetWindowFlags(win);
|
int flags = SDL_GetWindowFlags(win);
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
IsHighDPIaware = (flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) ? true : false;
|
||||||
|
#else
|
||||||
IsHighDPIaware = (flags & SDL_WINDOW_ALLOW_HIGHDPI) ? true : false;
|
IsHighDPIaware = (flags & SDL_WINDOW_ALLOW_HIGHDPI) ? true : false;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We can't rely on vid, because the context is created
|
/* We can't rely on vid, because the context is created
|
||||||
|
@ -1953,7 +1968,11 @@ RE_InitContext(void *win)
|
||||||
*/
|
*/
|
||||||
void RE_GetDrawableSize(int* width, int* height)
|
void RE_GetDrawableSize(int* width, int* height)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
SDL_GetCurrentRenderOutputSize(renderer, width, height);
|
||||||
|
#else
|
||||||
SDL_GetRendererOutputSize(renderer, width, height);
|
SDL_GetRendererOutputSize(renderer, width, height);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2208,7 +2227,12 @@ RE_FlushFrame(int vmin, int vmax)
|
||||||
|
|
||||||
SDL_UnlockTexture(texture);
|
SDL_UnlockTexture(texture);
|
||||||
|
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
SDL_RenderTexture(renderer, texture, NULL, NULL);
|
||||||
|
#else
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
// replace use next buffer
|
// replace use next buffer
|
||||||
|
|
|
@ -17,7 +17,11 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
#ifdef USE_SDL3
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#else
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue