Permalink
Browse files

Merge pull request #18 from vanfanel/master

Added SDL2 support. OpenGL and GLES2 rendering working with SDL2 cont…
  • Loading branch information...
djyt committed Dec 20, 2015
2 parents 80cfa9c + d045e94 commit 412576c17d734d1dc69848ac146493c017bf9ddb
View
@@ -98,34 +98,80 @@ set(src_hwaudio
"${main_cpp_base}/hwaudio/ym2151.cpp"
)
if(OPENGL)
set(src_sdl
"${main_cpp_base}/sdl/audio.hpp"
"${main_cpp_base}/sdl/timer.hpp"
"${main_cpp_base}/sdl/input.hpp"
"${main_cpp_base}/sdl/renderbase.hpp"
"${main_cpp_base}/sdl/rendergl.hpp"
"${main_cpp_base}/sdl/audio.cpp"
"${main_cpp_base}/sdl/timer.cpp"
"${main_cpp_base}/sdl/input.cpp"
"${main_cpp_base}/sdl/renderbase.cpp"
"${main_cpp_base}/sdl/rendergl.cpp"
)
else()
set(src_sdl
"${main_cpp_base}/sdl/audio.hpp"
"${main_cpp_base}/sdl/timer.hpp"
"${main_cpp_base}/sdl/input.hpp"
"${main_cpp_base}/sdl/renderbase.hpp"
"${main_cpp_base}/sdl/rendersw.hpp"
"${main_cpp_base}/sdl/audio.cpp"
"${main_cpp_base}/sdl/timer.cpp"
"${main_cpp_base}/sdl/input.cpp"
"${main_cpp_base}/sdl/renderbase.cpp"
"${main_cpp_base}/sdl/rendersw.cpp"
)
if(SDL2)
if(OPENGL)
set(src_sdl
"${main_cpp_base}/sdl2/audio.hpp"
"${main_cpp_base}/sdl2/timer.hpp"
"${main_cpp_base}/sdl2/input.hpp"
"${main_cpp_base}/sdl2/renderbase.hpp"
"${main_cpp_base}/sdl2/rendergl.hpp"
"${main_cpp_base}/sdl2/audio.cpp"
"${main_cpp_base}/sdl2/timer.cpp"
"${main_cpp_base}/sdl2/input.cpp"
"${main_cpp_base}/sdl2/renderbase.cpp"
"${main_cpp_base}/sdl2/rendergl.cpp"
)
elseif(OPENGLES)
set(src_sdl
"${main_cpp_base}/sdl2/audio.hpp"
"${main_cpp_base}/sdl2/timer.hpp"
"${main_cpp_base}/sdl2/input.hpp"
"${main_cpp_base}/sdl2/renderbase.hpp"
"${main_cpp_base}/sdl2/rendergles.hpp"
"${main_cpp_base}/sdl2/audio.cpp"
"${main_cpp_base}/sdl2/timer.cpp"
"${main_cpp_base}/sdl2/input.cpp"
"${main_cpp_base}/sdl2/renderbase.cpp"
"${main_cpp_base}/sdl2/rendergles.cpp"
)
else()
set(src_sdl
"${main_cpp_base}/sdl2/audio.hpp"
"${main_cpp_base}/sdl2/timer.hpp"
"${main_cpp_base}/sdl2/input.hpp"
"${main_cpp_base}/sdl2/renderbase.hpp"
"${main_cpp_base}/sdl2/rendersurface.hpp"
"${main_cpp_base}/sdl2/audio.cpp"
"${main_cpp_base}/sdl2/timer.cpp"
"${main_cpp_base}/sdl2/input.cpp"
"${main_cpp_base}/sdl2/renderbase.cpp"
"${main_cpp_base}/sdl2/rendersurface.cpp"
)
endif()
else() #Using legacy, unmantained SDL1.x
if(OPENGL)
set(src_sdl
"${main_cpp_base}/sdl/audio.hpp"
"${main_cpp_base}/sdl/timer.hpp"
"${main_cpp_base}/sdl/input.hpp"
"${main_cpp_base}/sdl/renderbase.hpp"
"${main_cpp_base}/sdl/rendergl.hpp"
"${main_cpp_base}/sdl/audio.cpp"
"${main_cpp_base}/sdl/timer.cpp"
"${main_cpp_base}/sdl/input.cpp"
"${main_cpp_base}/sdl/renderbase.cpp"
"${main_cpp_base}/sdl/rendergl.cpp"
)
else()
set(src_sdl
"${main_cpp_base}/sdl/audio.hpp"
"${main_cpp_base}/sdl/timer.hpp"
"${main_cpp_base}/sdl/input.hpp"
"${main_cpp_base}/sdl/renderbase.hpp"
"${main_cpp_base}/sdl/rendersw.hpp"
"${main_cpp_base}/sdl/audio.cpp"
"${main_cpp_base}/sdl/timer.cpp"
"${main_cpp_base}/sdl/input.cpp"
"${main_cpp_base}/sdl/renderbase.cpp"
"${main_cpp_base}/sdl/rendersw.cpp"
)
endif()
endif()
set(src_directx
@@ -238,16 +284,28 @@ if(OPENGL)
add_definitions(-DWITH_OPENGL)
endif()
if(OPENGLES)
add_definitions(-DWITH_OPENGLES)
endif()
if(CANNONBOARD)
add_definitions(-DCANNONBOARD)
endif()
add_executable(cannonball ${SRCS})
# Copy Configuration file to current build
if(SDL2)
configure_file(../res/config_sdl2.xml ./config.xml
COPYONLY
)
else()
configure_file(../res/config.xml ./config.xml
COPYONLY
)
endif()
# Copy Resource files
configure_file(../res/tilemap.bin ./res/tilemap.bin
COPYONLY
@@ -1,24 +1,25 @@
# Default CMake Setup. Used for Raspberry Pi (Raspbian) Builds.
# CMake setup used for SDL2 Builds.
set(lib_base /usr/include)
set(sdl_root ${lib_base}/SDL)
set(sdl_root ${lib_base}/SDL2)
include_directories("${sdl_root}")
link_libraries(cannonball
SDL
SDLmain
link_libraries(cannonball
SDL2
)
# Linking
link_directories(
"${sdl_root}/lib"
)
add_definitions(-O3 -march=armv6 -mfpu=vfp -mfloat-abi=hard)
add_definitions(-O3 -DSDL2)
# Location for Cannonball to create save files
# Used to auto-generate setup.hpp with various file paths
set(xml_directory ./)
set(sdl_flags "SDL_DOUBLEBUF | SDL_HWSURFACE")
set(sdl_flags "SDL_WINDOW_RESIZABLE")
# Set SDL2 instead of SDL1
set(SDL2 1)
View
@@ -0,0 +1,25 @@
# CMake setup used for SDL2 Builds on Raspberry Pi.
set(lib_base /usr/include)
set(sdl_root ${lib_base}/SDL2)
include_directories("${sdl_root}")
link_libraries(cannonball
SDL2
)
# Linking
link_directories(
"${sdl_root}/lib"
)
add_definitions(-O3 -DSDL2 -march=armv6 -mfpu=vfp -mfloat-abi=hard)
# Location for Cannonball to create save files
# Used to auto-generate setup.hpp with various file paths
set(xml_directory ./)
set(sdl_flags "SDL_WINDOW_RESIZABLE")
# Set SDL2 instead of SDL1
set(SDL2 1)
View
@@ -0,0 +1,28 @@
# CMake setup used for SDL2 Builds.
set(lib_base /usr/include)
set(sdl_root ${lib_base}/SDL2)
include_directories("${sdl_root}")
link_libraries(cannonball
SDL2
GL
)
# Linking
link_directories(
"${sdl_root}/lib"
)
add_definitions(-O3 -DSDL2 -DWITH_OPENGL)
#add_definitions(-O0 -ggdb -DSDL2 -DWITH_OPENGL)
# Location for Cannonball to create save files
# Used to auto-generate setup.hpp with various file paths
set(xml_directory ./)
set(sdl_flags "SDL_WINDOW_RESIZABLE")
# Set SDL2 instead of SDL1
set(SDL2 1)
set(OPENGL 1)
View
@@ -0,0 +1,28 @@
# CMake setup used for SDL2 Builds.
set(lib_base /usr/include)
set(sdl_root ${lib_base}/SDL2)
include_directories("${sdl_root}")
link_libraries(cannonball
SDL2
GLESv2
)
# Linking
link_directories(
"${sdl_root}/lib"
)
add_definitions(-O3 -DSDL2 -DWITH_OPENGLES)
#add_definitions(-O0 -ggdb -DSDL2 -DWITH_OPENGLES)
# Location for Cannonball to create save files
# Used to auto-generate setup.hpp with various file paths
set(xml_directory ./)
set(sdl_flags "SDL_WINDOW_RESIZABLE")
# Set SDL2 instead of SDL1
set(SDL2 1)
set(OPENGLES 1)
View
@@ -0,0 +1,30 @@
# CMake setup used for SDL2/GLES builds on Raspberry Pi
set(CMAKE_CXX_FLAGS "-I/opt/vc/include -L/opt/vc/lib")
set(lib_base /usr/include)
set(sdl_root ${lib_base}/SDL2)
include_directories("${sdl_root}")
link_libraries(cannonball
SDL2
GLESv2
)
# Linking
link_directories(
"${sdl_root}/lib"
)
add_definitions(-O3 -DSDL2 -DWITH_OPENGLES -march=armv6 -mfpu=vfp -mfloat-abi=hard)
#add_definitions(-O0 -ggdb -DSDL2 -DWITH_OPENGLES)
# Location for Cannonball to create save files
# Used to auto-generate setup.hpp with various file paths
set(xml_directory ./)
set(sdl_flags "SDL_WINDOW_RESIZABLE")
# Set SDL2 instead of SDL1
set(SDL2 1)
set(OPENGLES 1)
Oops, something went wrong.

0 comments on commit 412576c

Please sign in to comment.