mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-22 23:06:18 +00:00
implementation for older SDL functions to use later
This commit is contained in:
parent
d1cf3a0435
commit
5b44fe7975
4 changed files with 51 additions and 0 deletions
|
|
@ -13,6 +13,17 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
## Setup main source ##
|
## Setup main source ##
|
||||||
|
|
||||||
|
# oldimpls dir stuff
|
||||||
|
set(OLDIMPLS_HEADERS
|
||||||
|
src/oldimpls/include.h
|
||||||
|
src/oldimpls/sdl/include.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(OLDIMPLS_SOURCE
|
||||||
|
src/oldimpls/sdl/rgb-surfaces.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# main stuff
|
||||||
set(MAIN_HEADERS
|
set(MAIN_HEADERS
|
||||||
src/quadarray.h
|
src/quadarray.h
|
||||||
src/audio.h
|
src/audio.h
|
||||||
|
|
@ -74,6 +85,7 @@ set(MAIN_HEADERS
|
||||||
chromasdk/RzErrors.h
|
chromasdk/RzErrors.h
|
||||||
chromasdk/ChromaApi.h
|
chromasdk/ChromaApi.h
|
||||||
src/i18n.h
|
src/i18n.h
|
||||||
|
${OLDIMPLS_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(MAIN_SOURCE
|
set(MAIN_SOURCE
|
||||||
|
|
@ -116,6 +128,7 @@ set(MAIN_SOURCE
|
||||||
src/oneshot.cpp
|
src/oneshot.cpp
|
||||||
src/screen.cpp
|
src/screen.cpp
|
||||||
src/i18n.cpp
|
src/i18n.cpp
|
||||||
|
${OLDIMPLS_SOURCE}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
|
||||||
1
src/oldimpls/include.h
Normal file
1
src/oldimpls/include.h
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
#include "sdl/include.h"
|
||||||
11
src/oldimpls/sdl/include.h
Normal file
11
src/oldimpls/sdl/include.h
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef _OLDIMPLS_SDL_INCLUDE_H
|
||||||
|
#define _OLDIMPLS_SDL_INCLUDE_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL_surface.h>
|
||||||
|
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format);
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format);
|
||||||
|
|
||||||
|
#endif
|
||||||
26
src/oldimpls/sdl/rgb-surfaces.cpp
Normal file
26
src/oldimpls/sdl/rgb-surfaces.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include "include.h"
|
||||||
|
|
||||||
|
// taken from: https://wiki.libsdl.org/SDL3/README-migration#sdl_surfaceh
|
||||||
|
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
|
{
|
||||||
|
return SDL_CreateSurface(width, height,
|
||||||
|
SDL_GetPixelFormatForMasks(depth, Rmask, Gmask, Bmask, Amask));
|
||||||
|
}
|
||||||
|
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
|
||||||
|
{
|
||||||
|
return SDL_CreateSurface(width, height, (SDL_PixelFormat)format);
|
||||||
|
}
|
||||||
|
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
|
{
|
||||||
|
return SDL_CreateSurfaceFrom(width, height,
|
||||||
|
SDL_GetPixelFormatForMasks(depth, Rmask, Gmask, Bmask, Amask),
|
||||||
|
pixels, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format)
|
||||||
|
{
|
||||||
|
return SDL_CreateSurfaceFrom(width, height, (SDL_PixelFormat)format, pixels, pitch);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue