Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Port to SDL2. Only have images not showing up left to fix.
  • Loading branch information
ludamad committed Sep 11, 2016
1 parent f8cf13a commit 9a00232
Show file tree
Hide file tree
Showing 30 changed files with 117 additions and 125 deletions.
1 change: 1 addition & 0 deletions dependencies/sdl2-image/CMakeLists.txt
Expand Up @@ -4,6 +4,7 @@ PROJECT(SDL2_image)
ADD_DEFINITIONS (
-Wno-attributes
-DLOAD_PNG
-DLOAD_BMP
)

INCLUDE_DIRECTORIES(../sdl2/include)
Expand Down
1 change: 1 addition & 0 deletions dependencies/yaml-cpp/CMakeLists.txt
Expand Up @@ -67,6 +67,7 @@ if(YAML_CPP_BUILD_CONTRIB)
else()
add_definitions(-DYAML_CPP_NO_CONTRIB)
endif()
add_definitions(-Wno-deprecated-declarations)

if(VERBOSE)
message(STATUS "sources: ${sources}")
Expand Down
2 changes: 1 addition & 1 deletion install-scripts/fedora-deps.sh
@@ -1 +1 @@
sudo yum install SDL-static SDL_image SDL_image-devel SDL_mixer-devel freetype-devel gcc-c++ cmake
sudo yum install freetype-devel gcc-c++ cmake libXext-devel mesa-libGL-devel
5 changes: 2 additions & 3 deletions libs/common-lib/CMakeLists.txt
@@ -1,14 +1,13 @@
cmake_minimum_required( VERSION 2.6 )
PROJECT(project_lcommon)

FIND_PACKAGE(SDL REQUIRED)

set( SRC "..")
set( DEPS ../../dependencies)
include_directories(${SDL_INCLUDE_DIR}
include_directories(
include/lcommon/
${DEPS}/UnitTest++
${DEPS}/lua
${DEPS}/sdl2/include
"${SRC}/luawrap-lib/include"
)
add_definitions( -std=c++98 )
Expand Down
2 changes: 1 addition & 1 deletion libs/common-lib/src/Timer.cpp
Expand Up @@ -6,7 +6,7 @@

#include "Timer.h"

#include <SDL/SDL.h>
#include <SDL.h>

#ifdef __unix__
#include <sys/time.h>
Expand Down
3 changes: 1 addition & 2 deletions libs/draw-lib/examples/examples.cpp
Expand Up @@ -3,8 +3,7 @@
* Exercises the shape drawing methods
*/

#include <SDL2/SDL.h>
#include <GL/glu.h>
#include <SDL.h>

#include <lua.hpp>

Expand Down
2 changes: 0 additions & 2 deletions libs/draw-lib/src/Font.cpp
Expand Up @@ -2,8 +2,6 @@
#include <stdexcept>
#include <vector>

#include <GL/glu.h>

#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
Expand Down
5 changes: 2 additions & 3 deletions libs/draw-lib/src/display.cpp
Expand Up @@ -3,10 +3,9 @@
* Control display options, and set indicate that you are done drawing.
*/

#include <SDL2/SDL.h>
#include <SDL.h>
#undef GL_GLEXT_VERSION
#include <SDL2/SDL_opengl.h>
#include <GL/glu.h>
#include <SDL_opengl.h>

#include <lcommon/geometry.h>
#include <lcommon/perf_timer.h>
Expand Down
2 changes: 1 addition & 1 deletion libs/draw-lib/src/draw.cpp
@@ -1,4 +1,4 @@
#include <SDL2/SDL_opengl.h>
#include <SDL_opengl.h>

#include <cstdio>
#include <cmath>
Expand Down
1 change: 0 additions & 1 deletion libs/draw-lib/src/opengl/GLImage.cpp
Expand Up @@ -11,7 +11,6 @@
//Surpress some multiple definition warnings:
#undef GL_GLEXT_VERSION
#include <SDL_image.h>
#include <GL/glu.h>

#include "ldraw_assert.h"

Expand Down
2 changes: 0 additions & 2 deletions libs/draw-lib/src/opengl/gl_extensions.cpp
Expand Up @@ -8,8 +8,6 @@

#include <string>

#include <GL/glu.h>

#include "gl_extensions.h"

static bool query_ext_string(const std::string& extension,
Expand Down
2 changes: 0 additions & 2 deletions libs/dungeon-generation-lib/CMakeLists.txt
Expand Up @@ -3,8 +3,6 @@ PROJECT(project_lanarts_dungeon_gen)

set( DEPS ../../dependencies)

FIND_PACKAGE(SDL REQUIRED)

add_definitions( -std=c++98 )

include_directories(
Expand Down
5 changes: 2 additions & 3 deletions libs/net-lib/CMakeLists.txt
Expand Up @@ -3,12 +3,11 @@ PROJECT(project_lanarts_net)

set( DEPS ../../dependencies)

FIND_PACKAGE(SDL REQUIRED)

add_definitions( -std=c++11 )

include_directories(
${SDL_INCLUDE_DIR}
${DEPS}/sdl2/include
${DEPS}/enet/include
../common-lib/include
../luawrap-lib/include
Expand All @@ -31,7 +30,7 @@ target_link_libraries(
lanarts_net
pthread
enet
${SDL_LIBRARY}
SDL2-static
lcommon
UnitTest++
)
4 changes: 2 additions & 2 deletions libs/net-lib/impl/ServerConnection.cpp
Expand Up @@ -5,7 +5,7 @@

#include <vector>

#include <SDL/SDL_thread.h>
#include <SDL_thread.h>

#include <lcommon/Timer.h>

Expand Down Expand Up @@ -176,7 +176,7 @@ void ServerConnection::initialize_connection() {
__lnet_throw_connection_error(
"An error occurred while trying to create an ENet server host.\n");
}
_polling_thread = SDL_CreateThread(server_poll_thread, _data);
_polling_thread = SDL_CreateThread(server_poll_thread, "server-poll-thread", _data);
if (!_polling_thread) {
__lnet_throw_connection_error(
"An error occurred while trying to create the server connection polling thread.\n");
Expand Down
4 changes: 2 additions & 2 deletions libs/net-lib/tests/util_tests.cpp
@@ -1,6 +1,6 @@
// Simple tests for utility classes

#include <SDL/SDL.h>
#include <SDL.h>
#include <lcommon/unittest.h>
#include "../impl/PacketQueue.h"

Expand All @@ -16,7 +16,7 @@ static int writer_thread(void* _queue) {
TEST(packet_queue) {
PacketQueue queue;
/* Ensure we get sequential packets */
SDL_CreateThread(writer_thread, &queue);
SDL_CreateThread(writer_thread, "packet-queue-thread", &queue);
for (int i = 0; i < 1000; i++) {
ENetPacket* pseudo_packet = queue.wait_for_packet(-1);
CHECK_EQUAL(i, (long)pseudo_packet);
Expand Down
15 changes: 6 additions & 9 deletions libs/sound-lib/CMakeLists.txt
@@ -1,17 +1,14 @@
cmake_minimum_required( VERSION 2.6 )
PROJECT(project_lsound)

FIND_PACKAGE(SDL REQUIRED)
FIND_PACKAGE(SDL_mixer REQUIRED)

set( LIBS ../../dependencies)
set( DEPS ../../dependencies)
set( SRC ..)

include_directories(
"include/lsound"
${SDL_INCLUDE_DIR}
${SDLMIXER_INCLUDE_DIR}
${LIBS}/lua
"${DEPS}/lua"
"${DEPS}/sdl2/include"
"${DEPS}/sdl2-mixer"
"${SRC}/luawrap-lib/include"
"${SRC}/common-lib/include"
)
Expand All @@ -36,8 +33,8 @@ set(LINKEDLIBS
luawrap
lcommon
lua
${SDL_LIBRARY}
${SDLMIXER_LIBRARY}
SDL2-static
SDL2-mixer
)

#add_executable( lsound_tests main.cpp)
Expand Down
2 changes: 1 addition & 1 deletion libs/sound-lib/src/Music.cpp
Expand Up @@ -3,7 +3,7 @@
* Represents a piece of music, only one piece of music can be playing at a time.
*/

#include <SDL/SDL_mixer.h>
#include <SDL_mixer.h>

#include "Music.h"
#include "Sound.h"
Expand Down
2 changes: 1 addition & 1 deletion libs/sound-lib/src/Sound.cpp
Expand Up @@ -3,7 +3,7 @@
* A smart reference to a sound file.
*/

#include <SDL/SDL_mixer.h>
#include <SDL_mixer.h>
#include <Sound.h>
#include <SoundBase.h>

Expand Down
2 changes: 1 addition & 1 deletion libs/sound-lib/src/SoundEffect.cpp
Expand Up @@ -3,7 +3,7 @@
* Represents a sound effect, multiple can be played at a time.
*/

#include <SDL/SDL_mixer.h>
#include <SDL_mixer.h>

#include "SoundEffect.h"
#include "Sound.h"
Expand Down
4 changes: 2 additions & 2 deletions libs/sound-lib/src/lsound.cpp
Expand Up @@ -4,8 +4,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
#include <SDL.h>
#include <SDL_mixer.h>

#include "lsound.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/sound-lib/src/lua/lua_lsound.cpp
Expand Up @@ -3,7 +3,7 @@
* Bindings for the lsound component
*/

#include <SDL/SDL_mixer.h>
#include <SDL_mixer.h>

#include <luawrap/luameta.h>
#include <luawrap/types.h>
Expand Down
11 changes: 3 additions & 8 deletions src/CMakeLists.txt
@@ -1,17 +1,14 @@
cmake_minimum_required( VERSION 2.6 )
PROJECT(project_lanarts)

FIND_LIBRARY(SDL2 REQUIRED)
FIND_LIBRARY(SDL2_image REQUIRED)
FIND_LIBRARY(SDL2_mixer REQUIRED)
FIND_LIBRARY(OpenGL REQUIRED)
include(FindFreetype)

set( LIBS ../libs)
set( DEPS ../dependencies)
set( BUILTDEPS ${CMAKE_BINARY_DIR}/dependencies )

add_definitions( -std=c++11)
add_definitions( -std=c++11 -Wno-deprecated-declarations)

if (${USE_LUAJIT})
set( lua_includes ${DEPS}/luajit/src )
Expand All @@ -23,8 +20,8 @@ set( lua_libraries lua )

include_directories(
"."
${SDL_INCLUDE_DIR}
${SDLIMAGE_INCLUDE_DIR}
"${DEPS}/sdl2/include"
"${DEPS}/sdl2-image/"
${OpenGL_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
"${LIBS}/common-lib/include"
Expand Down Expand Up @@ -113,9 +110,7 @@ set (libraries
#physfs-static
libxmi
${OPENGL_gl_LIBRARY}
${SDLMIXER_LIBRARY}
enet
# ${SDLMAIN_LIBRARY}
${FREETYPE_LIBRARIES}
UnitTest++
SDL2-image
Expand Down
1 change: 0 additions & 1 deletion src/draw/draw_sprite.h
Expand Up @@ -8,7 +8,6 @@

#include <cstdlib>
#include <SDL_opengl.h>
#include <GL/glu.h>

#include <lcommon/geometry.h>
#include <ldraw/Colour.h>
Expand Down

0 comments on commit 9a00232

Please sign in to comment.