Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Incomplete] Initial SDL3 support #54

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ elseif(RENDERER STREQUAL "sdl1")
${SDL_INCLUDE_DIR}
)
add_definitions(-DWITH_SDL)
elseif(RENDERER STREQUAL "sdl3")
message(STATUS "Using SDL3 renderer backend")
find_package(SDL3 REQUIRED)
set(OMNISPEAK_PLATFORM_SRCS
src/id_in_sdl3.c
src/id_sd_sdl3.c
src/id_vl_sdl3.c
)
set(OMNISPEAK_PLATFORM_LIBRARIES
${SDL3_LIBRARIES}
)
include_directories(
${SDL3_INCLUDE_DIRS}
)
add_definitions(-DWITH_SDL=3)
else()
message(WARNING "Using NULL platform layer.")
set(OMNISPEAK_PLATFORM_SRCS
Expand Down
7 changes: 7 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This Makefile supports the following options:
sdl2sw = SDL 2.0 + Software SDL_Renderer
sdl2gl = SDL 2.0 + OpenGL 2.0 (default)
sdl2vk = SDL 2.0 + Vulkan (experimental)
sdl3 = SDL 3.0 + SDL_Renderer
null = dummy renderer

WITH_KEEN4 whether to include support for Keen 4: Secret of the Oracle (0/1; default: on)
Expand Down Expand Up @@ -352,6 +353,12 @@ ifeq ($(RENDERER), sdl2vk)
CXXFLAGS += -I$(OBJDIR) #For generated SPIR-V headers
endif

ifeq ($(RENDERER), sdl3)
RENDER_OBJS = id_vl_sdl3.o id_sd_sdl3.o id_in_sdl3.o
SDL_CFLAGS = `pkg-config sdl3 --cflags` -DWITH_SDL=3
SDL_LIBS = `pkg-config sdl3 $(SDL_LIB_QUERY)`
endif

ifeq ($(RENDERER), dos)
RENDER_OBJS = id_vl_dos.o id_sd_dos.o id_in_dos.o
endif
Expand Down
4 changes: 4 additions & 0 deletions src/ck_cross.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include <stdio.h>

#ifdef WITH_SDL
#if WITH_SDL == 3
#include <SDL3/SDL.h>
#else
#include "SDL.h"
#endif
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
#define CK_CROSS_IS_BIGENDIAN
#elif (SDL_BYTEORDER == SDL_LIL_ENDIAN)
Expand Down
3 changes: 0 additions & 3 deletions src/ck_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdlib.h>
#include <string.h>

#ifdef WITH_SDL
#include <SDL.h> // For main (SDL_main) function prototype
#endif
/*
* The 'episode' we're playing.
*/
Expand Down
14 changes: 11 additions & 3 deletions src/icon.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/id_ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#include <stdio.h>
#include <string.h>
#ifdef WITH_SDL
#include "SDL.h"
#endif

#define CA_THREEBYTEHEADERS

Expand Down
Loading
Loading