Use SDL2 include files instead of those for SDL version 1.

This resolves an irritating issue in the code editor where SDL2-specific functions could't be found. Not entirely sure about the SDL include file logic for other operating systems than Linux so the #ifdef directives may need to be updated further at a later date.
This commit is contained in:
Leon Styhre 2020-06-26 18:03:55 +02:00
parent 1f74723533
commit eeae8033bd
17 changed files with 110 additions and 23 deletions

View file

@ -9,7 +9,12 @@
#include "components/ComponentGrid.h" #include "components/ComponentGrid.h"
#include "components/NinePatchComponent.h" #include "components/NinePatchComponent.h"
#include "components/TextComponent.h" #include "components/TextComponent.h"
#include <SDL_timer.h>
#ifdef __linux__
#include <SDL2/SDL_timer.h>
#else
#include "SDL_timer.h"
#endif
GuiInfoPopup::GuiInfoPopup( GuiInfoPopup::GuiInfoPopup(
Window* window, Window* window,

View file

@ -25,9 +25,15 @@
#include "Scripting.h" #include "Scripting.h"
#include "SystemData.h" #include "SystemData.h"
#include "VolumeControl.h" #include "VolumeControl.h"
#include <SDL_events.h>
#include <algorithm> #include <algorithm>
#ifdef __linux__
#include <SDL2/SDL_events.h>
#else
#include "SDL_events.h"
#endif
GuiMenu::GuiMenu( GuiMenu::GuiMenu(
Window* window) Window* window)
: GuiComponent(window), : GuiComponent(window),

View file

@ -30,10 +30,18 @@
#include "Settings.h" #include "Settings.h"
#include "SystemData.h" #include "SystemData.h"
#include "SystemScreenSaver.h" #include "SystemScreenSaver.h"
#ifdef __linux__
#include <SDL2/SDL_events.h>
#include <SDL2/SDL_main.h>
#include <SDL2/SDL_timer.h>
#else
#include "SDL_events.h"
#include "SDL_main.h"
#include "SDL_timer.h"
#endif
#include <FreeImage.h> #include <FreeImage.h>
#include <SDL_events.h>
#include <SDL_main.h>
#include <SDL_timer.h>
#include <iostream> #include <iostream>
#include <time.h> #include <time.h>
#ifdef WIN32 #ifdef WIN32

View file

@ -7,9 +7,9 @@
#include "AudioManager.h" #include "AudioManager.h"
#include "Log.h" #include "Log.h"
#include "SDL.h"
#include "Settings.h" #include "Settings.h"
#include "Sound.h" #include "Sound.h"
#include <SDL.h>
std::vector<std::shared_ptr<Sound>> AudioManager::sSoundVector; std::vector<std::shared_ptr<Sound>> AudioManager::sSoundVector;
SDL_AudioSpec AudioManager::sAudioFormat; SDL_AudioSpec AudioManager::sAudioFormat;

View file

@ -8,7 +8,12 @@
#ifndef ES_CORE_AUDIO_MANAGER_H #ifndef ES_CORE_AUDIO_MANAGER_H
#define ES_CORE_AUDIO_MANAGER_H #define ES_CORE_AUDIO_MANAGER_H
#include <SDL_audio.h> #ifdef __linux__
#include <SDL2/SDL_audio.h>
#else
#include "SDL_audio.h"
#endif
#include <memory> #include <memory>
#include <vector> #include <vector>

View file

@ -12,7 +12,13 @@
#include <iostream> // Bad bad cecloader. #include <iostream> // Bad bad cecloader.
#include <libcec/cec.h> #include <libcec/cec.h>
#include <libcec/cecloader.h> #include <libcec/cecloader.h>
#include <SDL_events.h>
#ifdef __linux__
#include <SDL2/SDL_events.h>
#else
#include "SDL_events.h"
#endif // __linux__
#ifdef _RPI_ #ifdef _RPI_
extern "C" { extern "C" {
#include <interface/vmcs_host/vc_cecservice.h> #include <interface/vmcs_host/vc_cecservice.h>

View file

@ -7,6 +7,7 @@
#include "InputConfig.h" #include "InputConfig.h"
#include "Log.h" #include "Log.h"
#include <pugixml.hpp> #include <pugixml.hpp>
// Some utility functions. // Some utility functions.

View file

@ -9,13 +9,17 @@
#define ES_CORE_INPUT_CONFIG_H #define ES_CORE_INPUT_CONFIG_H
#include <CECInput.h> #include <CECInput.h>
#include <SDL_joystick.h>
#include <SDL_keyboard.h>
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <vector> #include <vector>
namespace pugi { class xml_node; } #ifdef __linux__
#include <SDL2/SDL_joystick.h>
#include <SDL2/SDL_keyboard.h>
#else
#include "SDL_joystick.h"
#include "SDL_keyboard.h"
#endif
#define DEVICE_KEYBOARD -1 #define DEVICE_KEYBOARD -1
#define DEVICE_CEC -2 #define DEVICE_CEC -2
@ -29,6 +33,11 @@ enum InputType {
TYPE_COUNT TYPE_COUNT
}; };
namespace pugi
{
class xml_node;
}
struct Input struct Input
{ {
public: public:

View file

@ -14,8 +14,14 @@
#include "Platform.h" #include "Platform.h"
#include "Scripting.h" #include "Scripting.h"
#include "Window.h" #include "Window.h"
#ifdef __linux__
#include <SDL2/SDL.h>
#else
#include "SDL.h"
#endif
#include <pugixml.hpp> #include <pugixml.hpp>
#include <SDL.h>
#include <assert.h> #include <assert.h>
#include <iostream> #include <iostream>

View file

@ -10,7 +10,12 @@
#ifndef ES_CORE_INPUT_MANAGER_H #ifndef ES_CORE_INPUT_MANAGER_H
#define ES_CORE_INPUT_MANAGER_H #define ES_CORE_INPUT_MANAGER_H
#include <SDL_joystick.h> #ifdef __linux__
#include <SDL2/SDL_joystick.h>
#else
#include "SDL_joystick.h"
#endif
#include <map> #include <map>
class InputConfig; class InputConfig;

View file

@ -6,7 +6,12 @@
#include "Platform.h" #include "Platform.h"
#include <SDL_events.h> #ifdef __linux__
#include <SDL2/SDL_events.h>
#else
#include "SDL_events.h"
#endif
#ifdef WIN32 #ifdef WIN32
#include <codecvt> #include <codecvt>
#else #else

View file

@ -9,7 +9,12 @@
#ifndef ES_CORE_SOUND_H #ifndef ES_CORE_SOUND_H
#define ES_CORE_SOUND_H #define ES_CORE_SOUND_H
#ifdef __linux__
#include <SDL2/SDL_audio.h>
#else
#include "SDL_audio.h" #include "SDL_audio.h"
#endif
#include <map> #include <map>
#include <memory> #include <memory>
#include <vector> #include <vector>

View file

@ -5,7 +5,12 @@
#include "PowerSaver.h" #include "PowerSaver.h"
#include "ThemeData.h" #include "ThemeData.h"
#include "Window.h" #include "Window.h"
#include <SDL_timer.h>
#ifdef __linux__
#include <SDL2/SDL_timer.h>
#else
#include "SDL_timer.h"
#endif
#define FADE_TIME_MS 200 #define FADE_TIME_MS 200

View file

@ -5,9 +5,16 @@
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "PowerSaver.h" #include "PowerSaver.h"
#include "Settings.h" #include "Settings.h"
#ifdef __linux__
#include <SDL2/SDL_mutex.h>
#include <SDL2/SDL_timer.h>
#else
#include "SDL_mutex.h"
#include "SDL_timer.h"
#endif
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <SDL_mutex.h>
#include <SDL_timer.h>
#ifdef WIN32 #ifdef WIN32
#include <codecvt> #include <codecvt>
@ -261,7 +268,7 @@ void VideoVlcComponent::startVideo()
// Asynchronous media parsing // Asynchronous media parsing
libvlc_event_attach(libvlc_media_event_manager(mMedia), libvlc_MediaParsedChanged, VlcMediaParseCallback, 0); libvlc_event_attach(libvlc_media_event_manager(mMedia), libvlc_MediaParsedChanged, VlcMediaParseCallback, 0);
parseResult = libvlc_media_parse_with_options(mMedia, libvlc_media_parse_local, -1); parseResult = libvlc_media_parse_with_options(mMedia, libvlc_media_parse_local, -1);
if (!parseResult) if (!parseResult)
{ {
// Wait for a maximum of 1 second for the media parsing // Wait for a maximum of 1 second for the media parsing

View file

@ -13,7 +13,11 @@
#include "Log.h" #include "Log.h"
#include "Settings.h" #include "Settings.h"
#include <SDL.h> #ifdef __linux__
#include <SDL2/SDL.h>
#else
#include "SDL.h"
#endif
#include <stack> #include <stack>
namespace Renderer namespace Renderer

View file

@ -11,8 +11,13 @@
#include "Log.h" #include "Log.h"
#include "Settings.h" #include "Settings.h"
#include <SDL_opengl.h> #ifdef __linux__
#include <SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#else
#include "SDL.h"
#include "SDL_opengl.h"
#endif
namespace Renderer namespace Renderer
{ {

View file

@ -11,8 +11,13 @@
#include "Log.h" #include "Log.h"
#include "Settings.h" #include "Settings.h"
#include <SDL_opengles.h> #ifdef __linux__
#include <SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#else
#include "SDL.h"
#include "SDL_opengl.h"
#endif
namespace Renderer namespace Renderer
{ {