mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
- vcmi compiles with SDL2 on Linux, video player is disabled for now
This commit is contained in:
parent
3db7fb4f63
commit
8eb661461c
@ -22,6 +22,7 @@ option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
|
||||
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
||||
option(ENABLE_TEST "Enable compilation of unit tests" OFF)
|
||||
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
|
||||
option(ENABLE_SDL2 "Use SDL2 for compilation instead of SDL 1.2" ON)
|
||||
|
||||
############################################
|
||||
# Building section #
|
||||
@ -54,11 +55,27 @@ if (APPLE)
|
||||
endif()
|
||||
|
||||
find_package(Boost 1.48.0 COMPONENTS program_options filesystem system thread locale REQUIRED)
|
||||
find_package(SDL REQUIRED)
|
||||
find_package(SDL_image REQUIRED)
|
||||
find_package(SDL_mixer REQUIRED)
|
||||
find_package(SDL_ttf REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
if (ENABLE_SDL2)
|
||||
include (FindPkgConfig)
|
||||
pkg_search_module(SDL REQUIRED sdl2)
|
||||
pkg_search_module(SDL_TTF REQUIRED SDL2_ttf)
|
||||
pkg_search_module(SDL_IMAGE REQUIRED SDL2_image)
|
||||
pkg_search_module(SDL_MIXER REQUIRED SDL2_mixer)
|
||||
|
||||
#This is weird - SDL defines singular variables while pkg_search defines plural
|
||||
set(SDL_INCLUDE_DIR "${SDL_INCLUDE_DIRS}")
|
||||
set(SDL_LIBRARY "${SDL_LIBRARIES}")
|
||||
set(SDLTTF_LIBRARY "${SDL_TTF_LIBRARIES}")
|
||||
set(SDLIMAGE_LIBRARY "${SDL_IMAGE_LIBRARIES}")
|
||||
set(SDLMIXER_LIBRARY "${SDL_MIXER_LIBRARIES}")
|
||||
else()
|
||||
find_package(SDL REQUIRED)
|
||||
find_package(SDL_image REQUIRED)
|
||||
find_package(SDL_mixer REQUIRED)
|
||||
find_package(SDL_ttf REQUIRED)
|
||||
endif()
|
||||
include(cotire)
|
||||
|
||||
if (ENABLE_EDITOR OR ENABLE_LAUNCHER)
|
||||
|
2
Global.h
2
Global.h
@ -16,6 +16,8 @@
|
||||
// Fixed width bool data type is important for serialization
|
||||
static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
||||
|
||||
# define DISABLE_VIDEO
|
||||
|
||||
#if defined _M_X64 && defined _WIN32 //Win64 -> cannot load 32-bit DLLs for video handling
|
||||
# define DISABLE_VIDEO
|
||||
#endif
|
||||
|
@ -390,7 +390,7 @@ int main(int argc, char** argv)
|
||||
CCS = new CClientState;
|
||||
CGI = new CGameInfo; //contains all global informations about game (texts, lodHandlers, map handler etc.)
|
||||
// Initialize video
|
||||
#if DISABLE_VIDEO
|
||||
#ifdef DISABLE_VIDEO
|
||||
CCS->videoh = new CEmptyVideoPlayer;
|
||||
#else
|
||||
if (!gNoGUI && !vm.count("disable-video"))
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
extern CGuiHandler GH; //global gui handler
|
||||
|
||||
#ifndef DISABLE_VIDEO
|
||||
//reads events and returns true on key down
|
||||
static bool keyDown()
|
||||
{
|
||||
@ -20,6 +21,7 @@ static bool keyDown()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && (_MSC_VER < 1800 || !defined(USE_FFMPEG))
|
||||
|
||||
|
@ -221,7 +221,7 @@ public:
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_video.h>
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#if SDL_VERSION_ATLEAST(1,3,0) && !SDL_VERSION_ATLEAST(2,0,0)
|
||||
#include <SDL_compat.h>
|
||||
#endif
|
||||
|
||||
|
@ -285,7 +285,7 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
#endif
|
||||
}
|
||||
#ifndef VCMI_SDL1 //SDL2x only events
|
||||
else if ((sEvent->type == SDL_MOUSEWHEEL))
|
||||
else if (sEvent->type == SDL_MOUSEWHEEL)
|
||||
{
|
||||
std::list<CIntObject*> hlp = wheelInterested;
|
||||
for(auto i=hlp.begin(); i != hlp.end() && current; i++)
|
||||
|
@ -222,6 +222,7 @@ std::vector<std::string> VCMIDirs::dataPaths() const
|
||||
{
|
||||
std::string dataDirsEnv = getenv("XDG_DATA_DIRS");
|
||||
std::vector<std::string> dataDirs;
|
||||
std::cout << dataDirsEnv;
|
||||
boost::split(dataDirs, dataDirsEnv, boost::is_any_of(":"));
|
||||
for (auto & entry : boost::adaptors::reverse(dataDirs))
|
||||
ret.push_back(entry + "/vcmi");
|
||||
|
Loading…
Reference in New Issue
Block a user