@@ -0,0 +1,83 @@
# Locate SDL2_gfx library
#
# This module defines:
#
# ::
#
# SDL2_GFX_LIBRARIES, the name of the library to link against
# SDL2_GFX_INCLUDE_DIRS, where to find the headers
# SDL2_GFX_FOUND, if false, do not try to link against
# SDL2_GFX_VERSION_STRING - human-readable string containing the version of SDL2_gfx
#
#
#
# $SDL2DIR is an environment variable that would correspond to the
# ./configure --prefix=$SDL2DIR used in building SDL2.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).

#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

find_path(SDL2_GFX_INCLUDE_DIR SDL2_gfxPrimitives.h
HINTS
ENV SDL2GFXDIR
ENV SDL2DIR
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDL2DIR}
include/SDL2 include
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()

find_library(SDL2_GFX_LIBRARY
NAMES SDL2_gfx
HINTS
ENV SDL2GFXDIR
ENV SDL2DIR
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)

if(SDL2_GFX_INCLUDE_DIR AND EXISTS "${SDL2_GFX_INCLUDE_DIR}/SDL2_gfxPrimitives.h")
file(STRINGS "${SDL2_GFX_INCLUDE_DIR}/SDL2_gfxPrimitives.h" SDL2_GFX_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_GFXPRIMITIVES_MAJOR[ \t]+[0-9]+$")
file(STRINGS "${SDL2_GFX_INCLUDE_DIR}/SDL2_gfxPrimitives.h" SDL2_GFX_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_GFXPRIMITIVES_MINOR[ \t]+[0-9]+$")
file(STRINGS "${SDL2_GFX_INCLUDE_DIR}/SDL2_gfxPrimitives.h" SDL2_GFX_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_GFXPRIMITIVES_MICRO[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_GFXPRIMITIVES_MAJOR[ \t]+([0-9]+)$" "\\1" SDL2_GFX_VERSION_MAJOR "${SDL2_GFX_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_GFXPRIMITIVES_MINOR[ \t]+([0-9]+)$" "\\1" SDL2_GFX_VERSION_MINOR "${SDL2_GFX_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_GFXPRIMITIVES_MICRO[ \t]+([0-9]+)$" "\\1" SDL2_GFX_VERSION_PATCH "${SDL2_GFX_VERSION_PATCH_LINE}")
set(SDL2_GFX_VERSION_STRING ${SDL2_GFX_VERSION_MAJOR}.${SDL2_GFX_VERSION_MINOR}.${SDL2_GFX_VERSION_PATCH})
unset(SDL2_GFX_VERSION_MAJOR_LINE)
unset(SDL2_GFX_VERSION_MINOR_LINE)
unset(SDL2_GFX_VERSION_PATCH_LINE)
unset(SDL2_GFX_VERSION_MAJOR)
unset(SDL2_GFX_VERSION_MINOR)
unset(SDL2_GFX_VERSION_PATCH)
endif()

set(SDL2_GFX_LIBRARIES ${SDL2_GFX_LIBRARY})
set(SDL2_GFX_INCLUDE_DIRS ${SDL2_GFX_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_gfx
REQUIRED_VARS SDL2_GFX_LIBRARIES SDL2_GFX_INCLUDE_DIRS
VERSION_VAR SDL2_GFX_VERSION_STRING)

mark_as_advanced(SDL2_GFX_LIBRARY SDL2_GFX_INCLUDE_DIR)
@@ -0,0 +1,100 @@
# Locate SDL_image library
#
# This module defines:
#
# ::
#
# SDL_IMAGE_LIBRARIES, the name of the library to link against
# SDL_IMAGE_INCLUDE_DIRS, where to find the headers
# SDL_IMAGE_FOUND, if false, do not try to link against
# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image
#
#
#
# For backward compatiblity the following variables are also set:
#
# ::
#
# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES)
# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS)
# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND)
#
#
#
# $SDLDIR is an environment variable that would correspond to the
# ./configure --prefix=$SDLDIR used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).

#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDL2IMAGEDIR
ENV SDL2DIR
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDLDIR}
include/SDL2 include
PATHS ${SDL2_PATH}
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()

find_library(SDL2_IMAGE_LIBRARY
NAMES SDL2_image
HINTS
ENV SDL2IMAGEDIR
ENV SDL2DIR
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
PATHS ${SDL2_PATH}
)

if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h")
file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}")
set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH})
unset(SDL2_IMAGE_VERSION_MAJOR_LINE)
unset(SDL2_IMAGE_VERSION_MINOR_LINE)
unset(SDL2_IMAGE_VERSION_PATCH_LINE)
unset(SDL2_IMAGE_VERSION_MAJOR)
unset(SDL2_IMAGE_VERSION_MINOR)
unset(SDL2_IMAGE_VERSION_PATCH)
endif()

set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY})
set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image
REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS
VERSION_VAR SDL2_IMAGE_VERSION_STRING)

# for backward compatiblity
#set(SDLIMAGE_LIBRARY ${SDL_IMAGE_LIBRARIES})
#set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS})
#set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND})

mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR)
@@ -0,0 +1,83 @@
# Locate SDL2_mixer library
#
# This module defines:
#
# ::
#
# SDL2_MIXER_LIBRARIES, the name of the library to link against
# SDL2_MIXER_INCLUDE_DIRS, where to find the headers
# SDL2_MIXER_FOUND, if false, do not try to link against
# SDL2_MIXER_VERSION_STRING - human-readable string containing the version of SDL2_mixer
#
#
#
# $SDL2DIR is an environment variable that would correspond to the
# ./configure --prefix=$SDL2DIR used in building SDL2.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).

#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

find_path(SDL2_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS
ENV SDL2MIXERDIR
ENV SDL2DIR
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDL2DIR}
include/SDL2 include
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()

find_library(SDL2_MIXER_LIBRARY
NAMES SDL2_mixer
HINTS
ENV SDL2MIXERDIR
ENV SDL2DIR
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)

if(SDL2_MIXER_INCLUDE_DIR AND EXISTS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MAJOR "${SDL2_MIXER_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MINOR "${SDL2_MIXER_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_PATCH "${SDL2_MIXER_VERSION_PATCH_LINE}")
set(SDL2_MIXER_VERSION_STRING ${SDL2_MIXER_VERSION_MAJOR}.${SDL2_MIXER_VERSION_MINOR}.${SDL2_MIXER_VERSION_PATCH})
unset(SDL2_MIXER_VERSION_MAJOR_LINE)
unset(SDL2_MIXER_VERSION_MINOR_LINE)
unset(SDL2_MIXER_VERSION_PATCH_LINE)
unset(SDL2_MIXER_VERSION_MAJOR)
unset(SDL2_MIXER_VERSION_MINOR)
unset(SDL2_MIXER_VERSION_PATCH)
endif()

set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_mixer
REQUIRED_VARS SDL2_MIXER_LIBRARIES SDL2_MIXER_INCLUDE_DIRS
VERSION_VAR SDL2_MIXER_VERSION_STRING)

mark_as_advanced(SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)
@@ -0,0 +1,98 @@
# Locate SDL_image library
#
# This module defines:
#
# ::
#
# SDL_TTF_LIBRARIES, the name of the library to link against
# SDL_TTF_INCLUDE_DIRS, where to find the headers
# SDL_TTF_FOUND, if false, do not try to link against
# SDL_F_VERSION_STRING - human-readable string containing the version of SDL_ttf
#
#
#
# For backward compatiblity the following variables are also set:
#
# ::
#
# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
# SDLTTF_FOUND (same value as SDL_TTF_FOUND)
#
#
#
# $SDLDIR is an environment variable that would correspond to the
# ./configure --prefix=$SDLDIR used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).

#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

find_path(SDL2_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDL2TTFDIR
ENV SDL2DIR
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDLDIR}
include/SDL2 include
PATHS ${SDL2_PATH}
)

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else ()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif ()

find_library(SDL2_TTF_LIBRARY
NAMES SDL2_ttf
HINTS
ENV SDL2TTFDIR
ENV SDL2DIR
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
PATHS ${SDL2_PATH}
)

if (SDL2_TTF_INCLUDE_DIR AND EXISTS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h")
file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL2_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_TTF_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL2_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_TTF_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MAJOR "${SDL2_TTF_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MINOR "${SDL2_TTF_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_PATCH "${SDL2_TTF_VERSION_PATCH_LINE}")
set(SDL2_TTF_VERSION_STRING ${SDL2_TTF_VERSION_MAJOR}.${SDL2_TTF_VERSION_MINOR}.${SDL2_TTF_VERSION_PATCH})
unset(SDL2_TTF_VERSION_MAJOR_LINE)
unset(SDL2_TTF_VERSION_MINOR_LINE)
unset(SDL2_TTF_VERSION_PATCH_LINE)
unset(SDL2_TTF_VERSION_MAJOR)
unset(SDL2_TTF_VERSION_MINOR)
unset(SDL2_TTF_VERSION_PATCH)
endif ()

set(SDL2_TTF_LIBRARIES ${SDL2_TTF_LIBRARY})
set(SDL2_TTF_INCLUDE_DIRS ${SDL2_TTF_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_ttf
REQUIRED_VARS SDL2_TTF_LIBRARIES SDL2_TTF_INCLUDE_DIRS
VERSION_VAR SDL2_TTF_VERSION_STRING)

# for backward compatiblity
#set(SDLTTF_LIBRARY ${SDL_TTF_LIBRARIES})
#set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS})
#set(SDLTTF_FOUND ${SDL_TTF_FOUND})
@@ -0,0 +1,23 @@
FindLibArchive.cmake
Copyright 2010 Kitware, Inc.


FindSDL2.cmake
FindSDL2_image.cmake
FindSDL2_ttf.cmake
BSD license
Copyright 2003-2009 Kitware, Inc.
Modified by Eric Wing

Found here:
https://github.com/tcbrindle/sdl2-cmake-scripts


FindSDL2_Mixer.cmake
FindSDL2_gfx.cmake
Copyright 2005-2009 Kitware, Inc.
Copyright 2012 Benjamin Eikel

BSD license
Found here:
https://github.com/rodrigo21/sdl2-cmake-scripts
@@ -0,0 +1,23 @@
FindLibArchive.cmake
Copyright 2010 Kitware, Inc.


FindSDL2.cmake
FindSDL2_image.cmake
FindSDL2_ttf.cmake
BSD license
Copyright 2003-2009 Kitware, Inc.
Modified by Eric Wing

Found here:
https://github.com/tcbrindle/sdl2-cmake-scripts


FindSDL2_Mixer.cmake
FindSDL2_gfx.cmake
Copyright 2005-2009 Kitware, Inc.
Copyright 2012 Benjamin Eikel
(There seems to be a number of versions of this one modified in different ways, who did the changes is impossible to tell)
BSD license
Found here:
https://github.com/rodrigo21/sdl2-cmake-scripts
@@ -33,11 +33,11 @@
#include <sstream>
#include <iostream>
#include "libs/tinyformat/tinyformat.h"
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_ttf.h>
#endif


@@ -49,11 +49,11 @@ Addons::Addons():selected(NULL){

//Load placeholder addon icons and screenshot.
addonIcon[0]=loadImage(getDataPath()+"/gfx/addon1.png");
SDL_SetAlpha(addonIcon[0],0,0);
SDL_SetSurfaceAlphaMod(addonIcon[0], 0);
addonIcon[1]=loadImage(getDataPath()+"/gfx/addon2.png");
SDL_SetAlpha(addonIcon[1],0,0);
SDL_SetSurfaceAlphaMod(addonIcon[1], 0);
addonIcon[2]=loadImage(getDataPath()+"/gfx/addon3.png");
SDL_SetAlpha(addonIcon[2],0,0);
SDL_SetSurfaceAlphaMod(addonIcon[2], 0);
screenshot=loadImage(getDataPath()+"/gfx/screenshot.png");

//Open the addons file in the user cache path for writing (downloading) to.
@@ -262,13 +262,13 @@ void Addons::fillAddonList(TreeStorageNode &objAddons, TreeStorageNode &objInsta
//There are (at least) two values, the url to the icon and its md5sum used for caching.
addon.icon=loadCachedImage(entry->attributes["icon"][0].c_str(),entry->attributes["icon"][1].c_str());
if(addon.icon)
SDL_SetAlpha(addon.icon,0,0);
SDL_SetSurfaceAlphaMod(addon.icon,0);
}
if(entry->attributes["screenshot"].size()>1){
//There are (at least) two values, the url to the screenshot and its md5sum used for caching.
addon.screenshot=loadCachedImage(entry->attributes["screenshot"][0].c_str(),entry->attributes["screenshot"][1].c_str());
if(addon.screenshot)
SDL_SetAlpha(addon.screenshot,0,0);
SDL_SetSurfaceAlphaMod(addon.screenshot,0);
}
if(!entry->attributes["version"].empty())
addon.version=atoi(entry->attributes["version"][0].c_str());
@@ -351,33 +351,33 @@ void Addons::addonsToList(const std::string &type){

SDL_Color black={0,0,0,0};
SDL_Surface* nameSurf=TTF_RenderUTF8_Blended(fontGUI,addon.name.c_str(),black);
SDL_SetAlpha(nameSurf,0,0xFF);
SDL_SetSurfaceAlphaMod(nameSurf,0xFF);
applySurface(74,-1,nameSurf,surf,NULL);
SDL_FreeSurface(nameSurf);

/// TRANSLATORS: indicates the author of an addon.
string authorLine = tfm::format(_("by %s"),addon.author);
SDL_Surface* authorSurf=TTF_RenderUTF8_Blended(fontText,authorLine.c_str(),black);
SDL_SetAlpha(authorSurf,0,0xFF);
SDL_SetSurfaceAlphaMod(authorSurf,0xFF);
applySurface(74,43,authorSurf,surf,NULL);
SDL_FreeSurface(authorSurf);

if(addon.installed){
if(addon.upToDate){
SDL_Surface* infoSurf=TTF_RenderUTF8_Blended(fontText,_("Installed"),black);
SDL_SetAlpha(infoSurf,0,0xFF);
SDL_SetSurfaceAlphaMod(infoSurf,0xFF);
applySurface(surf->w-infoSurf->w-32,(surf->h-infoSurf->h)/2,infoSurf,surf,NULL);
SDL_FreeSurface(infoSurf);
}else{
SDL_Surface* infoSurf=TTF_RenderUTF8_Blended(fontText,_("Updatable"),black);
SDL_SetAlpha(infoSurf,0,0xFF);
SDL_SetSurfaceAlphaMod(infoSurf,0xFF);
applySurface(surf->w-infoSurf->w-32,(surf->h-infoSurf->h)/2,infoSurf,surf,NULL);
SDL_FreeSurface(infoSurf);
}
}else{
SDL_Color grey={127,127,127};
SDL_Surface* infoSurf=TTF_RenderUTF8_Blended(fontText,_("Not installed"),grey);
SDL_SetAlpha(infoSurf,0,0xFF);
SDL_SetSurfaceAlphaMod(infoSurf,0xFF);
applySurface(surf->w-infoSurf->w-32,(surf->h-infoSurf->h)/2,infoSurf,surf,NULL);
SDL_FreeSurface(infoSurf);
}
@@ -30,8 +30,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif

//The addons menu.
@@ -26,7 +26,7 @@
#include "ScriptUserData.h"
#include "ScriptExecutor.h"
#include <vector>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>

class Block: public GameObject, public ScriptUserClass<'B','L','O','K',Block>{
private:
@@ -21,17 +21,17 @@
#include <math.h>
#include <locale.h>
#include <algorithm>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_gfx/SDL_gfxPrimitives.h>
#include <SDL_gfx/SDL_rotozoom.h>
#include <SDL2_mixer/SDL_mixer.h>
#include <SDL2_gfx/SDL2_gfxPrimitives.h>
#include <SDL2_gfx/SDL2_rotozoom.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_gfxPrimitives.h>
#include <SDL/SDL_rotozoom.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL2_gfxPrimitives.h>
#include <SDL2/SDL2_rotozoom.h>
#endif
#include <SDL/SDL_syswm.h>
#include <SDL2/SDL_syswm.h>
#include <string>
#include "Globals.h"
#include "Functions.h"
@@ -142,13 +142,15 @@ void applySurface(int x,int y,SDL_Surface* source,SDL_Surface* dest,SDL_Rect* cl

void drawRect(int x,int y,int w,int h,SDL_Surface* dest,Uint32 color){
//NOTE: We let SDL_gfx render it.
rectangleRGBA(dest,x,y,x+w,y+h,color >> 24,color >> 16,color >> 8,255);
//FIXME - This needs to be fixed to work with SDL2
// rectangleRGBA(dest,x,y,x+w,y+h,color >> 24,color >> 16,color >> 8,255);
}

//Draw a box with anti-aliased borders using SDL_gfx.
void drawGUIBox(int x,int y,int w,int h,SDL_Surface* dest,Uint32 color){
//Fill content's background color from function parameter
boxRGBA(dest,x+1,y+1,x+w-2,y+h-2,color >> 24,color >> 16,color >> 8,color >> 0);
//FIXME - ditto
/* boxRGBA(dest,x+1,y+1,x+w-2,y+h-2,color >> 24,color >> 16,color >> 8,color >> 0);
//Draw first black borders around content and leave 1 pixel in every corner
lineRGBA(dest,x+1,y,x+w-2,y,0,0,0,255);
@@ -169,12 +171,12 @@ void drawGUIBox(int x,int y,int w,int h,SDL_Surface* dest,Uint32 color){
pixelRGBA(dest,x+1,y+1,0,0,0,50);
pixelRGBA(dest,x+1,y+h-2,0,0,0,50);
pixelRGBA(dest,x+w-2,y+1,0,0,0,50);
pixelRGBA(dest,x+w-2,y+h-2,0,0,0,50);
pixelRGBA(dest,x+w-2,y+h-2,0,0,0,50);*/
}

void drawLine(int x1,int y1,int x2,int y2,SDL_Surface* dest,Uint32 color){
//NOTE: We let SDL_gfx render it.
lineRGBA(dest,x1,y1,x2,y2,color >> 24,color >> 16,color >> 8,255);
// lineRGBA(dest,x1,y1,x2,y2,color >> 24,color >> 16,color >> 8,255);
}

void drawLineWithArrow(int x1,int y1,int x2,int y2,SDL_Surface* dest,Uint32 color,int spacing,int offset,int xsize,int ysize){
@@ -275,19 +277,31 @@ bool createScreen(){
#endif
}else{
//Set the flags.
Uint32 flags=SCREEN_FLAGS;
#if !defined(ANDROID)
flags |= SDL_DOUBLEBUF;
#endif
// Uint32 flags=SCREEN_FLAGS;
Uint32 flags = 0;
//#if !defined(ANDROID)
// flags |= SDL_DOUBLEBUF;
//#endif
if(settings->getBoolValue("fullscreen"))
flags|=SDL_FULLSCREEN;
flags|=SDL_WINDOW_FULLSCREEN; //TODO with SDL2 we can also do SDL_WINDOW_FULLSCREEN_DESKTOP
else if(settings->getBoolValue("resizable"))
flags|=SDL_RESIZABLE;
flags|=SDL_WINDOW_RESIZABLE;

//Create the screen and check if there weren't any errors.
screen=SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,flags);
if(screen==NULL){
fprintf(stderr,"FATAL ERROR: SDL_SetVideoMode failed\n");
//Create the window and renderer and check if there weren't any errors.
// screen=SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,flags);
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, flags, &sdlWindow, &sdlRenderer);
if(!sdlWindow || !sdlRenderer){
fprintf(stderr,"FATAL ERROR: SDL_CreateWindowAndRenderer failed\n");
return false;
}

//Create the surface we are drawing to
int width = 0;
int height = 0;
SDL_GetWindowSize(sdlWindow, &width, &height);
screen = SDL_CreateRGBSurface(0, width, height, SCREEN_BPP, RMASK, GMASK, BMASK, AMASK);
if(!screen) {
fprintf(stderr,"FATAL ERROR: SDL_CreateRGBSurface failed\n");
return false;
}
}
@@ -299,13 +313,19 @@ bool createScreen(){
//Create the temp surface, just a replica of the screen surface, free the previous one if any.
if(tempSurface)
SDL_FreeSurface(tempSurface);
tempSurface=SDL_CreateRGBSurface(SCREEN_FLAGS|SDL_SRCALPHA,
tempSurface=SDL_CreateRGBSurface(0,
screen->w,screen->h,screen->format->BitsPerPixel,
screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,0);

//TODO - do we need to test for pixel format here?
screenTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, screen->w, screen->h);

//Set the the window caption.
SDL_WM_SetCaption(("Me and My Shadow "+version).c_str(),NULL);
SDL_EnableUNICODE(1);
// SDL_WM_SetCaption(("Me and My Shadow "+version).c_str(),NULL);
SDL_SetWindowTitle(sdlWindow, ("Me and My Shadow "+version).c_str());
//FIXME Seems to be obsolete
// SDL_EnableUNICODE(1);

//Nothing went wrong so return true.
return true;
@@ -351,9 +371,11 @@ vector<_res> getResolutionList(){
//NOTE: we enumerate fullscreen resolutions because
// windowed resolutions always can be arbitrary
if(resolutionList.empty()){
SDL_Rect **modes=SDL_ListModes(NULL,SDL_FULLSCREEN|SCREEN_FLAGS|SDL_ANYFORMAT);
// SDL_Rect **modes=SDL_ListModes(NULL,SDL_FULLSCREEN|SCREEN_FLAGS|SDL_ANYFORMAT);
//NOTe - currently only using the first display (0)
int numDisplayModes = SDL_GetNumDisplayModes(0);

if(modes==NULL || ((intptr_t)modes) == -1){
if(numDisplayModes < 1){
cerr<<"ERROR: Can't enumerate available screen resolutions."
" Use predefined screen resolutions list instead."<<endl;

@@ -385,10 +407,17 @@ vector<_res> getResolutionList(){
}
}else{
//Fill the resolutionList.
for(unsigned int i=0;modes[i]!=NULL;i++){

for(int i=0;i < numDisplayModes; ++i){
SDL_DisplayMode mode;
int error = SDL_GetDisplayMode(0, i, &mode);
if(error < 0) {
//We failed to get a display mode. Should we crash here?
std::cerr << "ERROR: Failed to get display mode " << i << " " << std::endl;
}
//Check if the resolution is higher than the minimum (800x600).
if(modes[i]->w>=800 && modes[i]->h>=600){
_res res={modes[i]->w, modes[i]->h};
if(mode.w >= 800 && mode.h >= 600){
_res res={mode.w, mode.h};
resolutionList.push_back(res);
}
}
@@ -472,11 +501,13 @@ void configureWindow(){
//Retrieve the WM info from SDL containing the window handle.
struct SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
SDL_GetWMInfo(&wmInfo);
SDL_GetWindowWMInfo(sdlWindow, &wmInfo);

#ifdef __X11_INCLUDED__
//We assume that a linux system running meandmyshadow is also running an Xorg server.
if(wmInfo.subsystem==SDL_SYSWM_X11){
//TODO: Lock func no longer exists in SDL2, is this still needed?
/*
//Create the size hints to give to the window.
XSizeHints* sizeHints;
if(!(sizeHints=XAllocSizeHints())){
@@ -496,6 +527,7 @@ void configureWindow(){
//Free size hint structure
XFree(sizeHints);
*/
}else{
//No X11 so an unsupported window manager.
cerr<<"WARNING: Unsupported window manager."<<endl;
@@ -512,25 +544,25 @@ void configureWindow(){

void onVideoResize(){
//Check if the resize event isn't malformed.
if(event.resize.w<=0 || event.resize.h<=0)
if(event.window.data1<=0 || event.window.data2<=0)
return;

//Check the size limit.
if(event.resize.w<800)
event.resize.w=800;
if(event.resize.h<600)
event.resize.h=600;
if(event.window.data1<800)
event.window.data1=800;
if(event.window.data2<600)
event.window.data2=600;

//Check if it really resizes.
if(SCREEN_WIDTH==event.resize.w && SCREEN_HEIGHT==event.resize.h)
if(SCREEN_WIDTH==event.window.data1 && SCREEN_HEIGHT==event.window.data2)
return;

char s[32];

//Set the new width and height.
sprintf(s,"%d",event.resize.w);
sprintf(s,"%d",event.window.data1);
getSettings()->setValue("width",s);
sprintf(s,"%d",event.resize.h);
sprintf(s,"%d",event.window.data2);
getSettings()->setValue("height",s);

//Do resizing.
@@ -813,8 +845,12 @@ bool loadFiles(){
SDL_BlitSurface(surface,NULL,screen,&r);
SDL_FreeSurface(surface);
}
SDL_UpdateTexture(screenTexture, NULL, screen->pixels, screen->w * sizeof(Uint32));
SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, screenTexture, NULL, NULL);
SDL_RenderPresent(sdlRenderer);

SDL_Flip(screen);
// SDL_Flip(screen);
}

musicManager.destroy();
@@ -994,7 +1030,10 @@ void flipScreen(){
fprintf(stderr,"FATAL ERROR: Unable to draw to screen using OpenGL (compiled without).\n");
#endif
}else{
SDL_Flip(screen);
SDL_UpdateTexture(screenTexture, NULL, screen->pixels, screen->w * sizeof(Uint32));
SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, screenTexture, NULL, NULL);
SDL_RenderPresent(sdlRenderer);
}
}

@@ -1144,7 +1183,7 @@ void changeState(){
fade=0;

SDL_FillRect(screen,NULL,0);
SDL_SetAlpha(tempSurface, SDL_SRCALPHA, fade);
SDL_SetSurfaceAlphaMod(tempSurface, fade);
SDL_BlitSurface(tempSurface,NULL,screen,NULL);
flipScreen();
SDL_Delay(25);
@@ -27,7 +27,7 @@
#include "ScriptExecutor.h"
#include "Globals.h"

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include <string>
#include <vector>

@@ -113,11 +113,11 @@ bool GUIListBox::handleEvents(int x,int y,bool enabled,bool visible,bool process
}

//Check for mouse wheel scrolling.
if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELDOWN && scrollBar->enabled){
if(event.type==SDL_MOUSEBUTTONDOWN && event.wheel.y < 0 && scrollBar->enabled){
scrollBar->value++;
if(scrollBar->value>scrollBar->maxValue)
scrollBar->value=scrollBar->maxValue;
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELUP && scrollBar->enabled){
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.wheel.y > 0 && scrollBar->enabled){
scrollBar->value--;
if(scrollBar->value<0)
scrollBar->value=0;
@@ -28,13 +28,15 @@ GUIObject* GUIObjectRoot=NULL;
list<GUIEvent> GUIEventQueue;

void GUIObjectHandleEvents(bool kill){
//NOTE: This was already not doing anything so commenting it for now.
/*
//Check if user resizes the window.
if(event.type==SDL_VIDEORESIZE){
//onVideoResize();
//Don't let other objects process this event (?)
return;
}
}*/

//Make sure that GUIObjectRoot isn't null.
if(GUIObjectRoot)
@@ -614,29 +616,29 @@ bool GUITextBox::handleEvents(int x,int y,bool enabled,bool visible,bool process
//Check if there's a key press and the event hasn't been already processed.
if(state==2 && event.type==SDL_KEYDOWN && !b){
//Get the keycode.
int key=(int)event.key.keysym.unicode;
SDL_Keycode key=event.key.keysym.sym;

//Check if the key is supported.
if(key>=32&&key<=126){
if(highlightStart==highlightEnd){
caption.insert((size_t)highlightStart,1,char(key));
caption.insert((size_t)highlightStart,1,static_cast<char>(key));
highlightStart++;
highlightEnd=highlightStart;
}else if(highlightStart<highlightEnd){
caption.erase(highlightStart,highlightEnd-highlightStart);
caption.insert((size_t)highlightStart,1,char(key));
caption.insert((size_t)highlightStart,1,static_cast<char>(key));
highlightStart++;
highlightEnd=highlightStart;
highlightEndX=highlightStartX;
}else{
caption.erase(highlightEnd,highlightStart-highlightEnd);
caption.insert((size_t)highlightEnd,1,char(key));
caption.insert((size_t)highlightEnd,1,static_cast<char>(key));
highlightEnd++;
highlightStart=highlightEnd;
highlightStartX=highlightEndX;
}
int advance;
TTF_GlyphMetrics(fontText,char(key),NULL,NULL,NULL,NULL,&advance);
TTF_GlyphMetrics(fontText,static_cast<char>(key),NULL,NULL,NULL,NULL,&advance);
highlightStartX=highlightEndX=highlightStartX+advance;

//If there is an event callback then call it.
@@ -37,7 +37,7 @@ GUIOverlay::GUIOverlay(GUIObject* root,bool dim):root(root),dim(dim){
//Dim the background.
if(dim){
SDL_FillRect(tempSurface,NULL,0);
SDL_SetAlpha(tempSurface,SDL_SRCALPHA,155);
SDL_SetSurfaceAlphaMod(tempSurface,155);
SDL_BlitSurface(tempSurface,NULL,screen,NULL);
}
}
@@ -60,7 +60,7 @@ void GUIOverlay::enterLoop(bool skip){
while(GUIObjectRoot){
while(SDL_PollEvent(&event)){
//Check for a resize event.
if(event.type==SDL_VIDEORESIZE){
if(event.type==SDL_WINDOWEVENT_RESIZED){
onVideoResize();
continue;
}
@@ -127,7 +127,7 @@ void GUIOverlay::resize(){
//Dim the background.
if(dim){
SDL_FillRect(tempSurface,NULL,0);
SDL_SetAlpha(tempSurface,SDL_SRCALPHA,155);
SDL_SetSurfaceAlphaMod(tempSurface,155);
SDL_BlitSurface(tempSurface,NULL,screen,NULL);
}
}
@@ -20,7 +20,7 @@
#ifndef GUI_OVERLAY_H
#define GUI_OVERLAY_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include "GameState.h"
#include "GUIObject.h"

@@ -40,7 +40,7 @@ bool GUISpinBox::handleEvents(int x,int y,bool enabled,bool visible,bool process
//Check if there's a key press and the event hasn't been already processed.
if(state==2 && event.type==SDL_KEYDOWN && !b){
//Get the keycode.
int key=(int)event.key.keysym.unicode;
SDL_Keycode key=event.key.keysym.sym;

//Check if the key is supported.
if(key>=32&&key<=126){
@@ -175,10 +175,10 @@ bool GUISpinBox::handleEvents(int x,int y,bool enabled,bool visible,bool process
}

//Allow mouse wheel to change value.
if(event.type==SDL_MOUSEBUTTONUP){
if(event.button.button==SDL_BUTTON_WHEELUP){
if(event.type==SDL_MOUSEWHEEL){
if(event.wheel.y > 0){
updateValue(true);
}else if(event.button.button==SDL_BUTTON_WHEELDOWN){
}else if(event.wheel.y < 0){
updateValue(false);
}
}
@@ -86,17 +86,17 @@ bool GUITextArea::handleEvents(int x,int y,bool enabled,bool visible,bool proces
//Check if there's a key press and the event hasn't been already processed.
if(state==2 && event.type==SDL_KEYDOWN && !b && editable){
//Get the keycode.
int key=(int)event.key.keysym.unicode;
SDL_Keycode key=event.key.keysym.sym;

//Check if the key is supported.
if(key>=32&&key<=126){
removeHighlight();
string* str=&lines.at(highlightLineStart);
str->insert((size_t)highlightEnd,1,char(key));
str->insert((size_t)highlightEnd,1,static_cast<char>(key));
highlightEnd++;
highlightStart=highlightEnd;
int advance;
TTF_GlyphMetrics(widgetFont,char(key),NULL,NULL,NULL,NULL,&advance);
TTF_GlyphMetrics(widgetFont,static_cast<char>(key),NULL,NULL,NULL,NULL,&advance);
highlightStartX=highlightEndX=highlightStartX+advance;

//Update cache.
@@ -256,21 +256,21 @@ bool GUITextArea::handleEvents(int x,int y,bool enabled,bool visible,bool proces
//Scroll horizontally if mouse is over the horizontal scrollbar.
//Otherwise scroll vertically.
if(j>=y+height-16&&scrollBarH->visible){
if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELDOWN){
if(event.type==SDL_MOUSEWHEEL && event.wheel.y < 0){
scrollBarH->value+=20;
if(scrollBarH->value>scrollBarH->maxValue)
scrollBarH->value=scrollBarH->maxValue;
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELUP){
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.wheel.y > 0){
scrollBarH->value-=20;
if(scrollBarH->value<0)
scrollBarH->value=0;
}
}else{
if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELDOWN){
if(event.type==SDL_MOUSEWHEEL && event.wheel.y < 0){
scrollBar->value++;
if(scrollBar->value>scrollBar->maxValue)
scrollBar->value=scrollBar->maxValue;
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELUP){
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.wheel.y > 0){
scrollBar->value--;
if(scrollBar->value<0)
scrollBar->value=0;
@@ -23,7 +23,7 @@
#ifdef __APPLE__
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_ttf.h>
#endif

#include "GUIObject.h"
@@ -993,15 +993,15 @@ void Game::render(){
int y=SCREEN_HEIGHT;

bm=TTF_RenderUTF8_Shaded(fontText,tfm::format(_("%d recordings"),recordings).c_str(),fg,bg);
SDL_SetAlpha(bm,SDL_SRCALPHA,160);
SDL_SetSurfaceAlphaMod(bm,160);
y-=bm->h;
applySurface(0,y,bm,screen,NULL);
SDL_FreeSurface(bm);

char c[32];
sprintf(c,"%-.2fs",time/40.0f);
bm=TTF_RenderUTF8_Shaded(fontText,c,fg,bg);
SDL_SetAlpha(bm,SDL_SRCALPHA,160);
SDL_SetSurfaceAlphaMod(bm,160);
y-=bm->h;
applySurface(0,y,bm,screen,NULL);
SDL_FreeSurface(bm);
@@ -1021,7 +1021,7 @@ void Game::render(){
if(interlevel){
SDL_BlitSurface(screen,NULL,tempSurface,NULL);
SDL_FillRect(screen,NULL,0);
SDL_SetAlpha(tempSurface, SDL_SRCALPHA,191);
SDL_SetSurfaceAlphaMod(tempSurface,191);
SDL_BlitSurface(tempSurface,NULL,screen,NULL);
}else if((time & 0x10)==0x10){
SDL_Rect r={50,0,50,50};
@@ -20,13 +20,13 @@
#ifndef GAME_H
#define GAME_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <vector>
#include <map>
@@ -23,7 +23,7 @@
#include "Globals.h"
#include "TreeStorageNode.h"
#include "Player.h"
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include <string>
#include <vector>
#include <utility>
@@ -22,8 +22,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include "libs/tinygettext/tinygettext.hpp"

@@ -43,6 +43,13 @@ std::string language;
//The DictionaryManager that is used to translate the game itself.
tinygettext::DictionaryManager* dictionaryManager=NULL;

//SDL Window and renderer
SDL_Window* sdlWindow=NULL;
SDL_Renderer* sdlRenderer=NULL;

//Texture
SDL_Texture* screenTexture=NULL;

//Set both the screen and the tempSurface to NULL.
SDL_Surface* screen=NULL;
SDL_Surface* tempSurface=NULL;
@@ -20,13 +20,13 @@
#ifndef GLOBALS_H
#define GLOBALS_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <string>
#include "libs/tinygettext/tinygettext.hpp"
@@ -52,11 +52,12 @@ extern int SCREEN_HEIGHT;
#if defined(ANDROID)
//TODO: change other surface creating code to make the game runs faster
const int SCREEN_BPP=16; //??? 24?? 32??
const int SCREEN_FLAGS=SDL_HWSURFACE;
//const int SCREEN_FLAGS=SDL_HWSURFACE;
#else
const int SCREEN_BPP=32;
const int SCREEN_FLAGS=SDL_HWSURFACE;
//const int SCREEN_FLAGS=SDL_HWSURFACE;
#endif
const int SCREEN_FLAGS = 0;

//SDL interprets each pixel as a 32-bit number,
// so our masks must depend on the endianness (byte order) of the machine.
@@ -91,6 +92,11 @@ extern std::string language;
//The DictionaryManager that is used to translate the game itself.
extern tinygettext::DictionaryManager* dictionaryManager;

//SDL Window and renderer
extern SDL_Window* sdlWindow;
extern SDL_Renderer* sdlRenderer;
//The texture we will be drawing to
extern SDL_Texture* screenTexture;
//The screen surface, it's used to draw on before it's drawn to the real screen.
extern SDL_Surface* screen;
//SDL_Surface with the same dimensions as screen which can be used for all kinds of (temp) drawing.
@@ -39,14 +39,20 @@ SDL_Surface* ImageManager::loadImage(std::string file){
//Check if there's an alpha mask.
if(load->format->Amask){
//There is so let opt use it.
opt=SDL_DisplayFormatAlpha(load);
//
// opt=SDL_DisplayFormatAlpha(load);
//We don't need load anymore so free it.
SDL_FreeSurface(load);
// SDL_FreeSurface(load);
//TODO DisplayFormatAlpha doesn't exist in SDL2, trying to ignore it for now
opt = load;
}else{
//We use cyan for alpha, so set the alpha color key.
SDL_SetColorKey(load,SDL_SRCCOLORKEY,SDL_MapRGB(load->format,0,0xFF,0xFF));
// SDL_SetColorKey(load,SDL_SRCCOLORKEY,SDL_MapRGB(load->format,0,0xFF,0xFF));
SDL_SetColorKey(load,SDL_TRUE,SDL_MapRGB(load->format,0,0xFF,0xFF));
//Let opt use the alpha.
opt=SDL_DisplayFormat(load);

//TODO - SDL_DisplayFormat
// opt=SDL_DisplayFormat(load);
//We don't need load anymore so free it.
SDL_FreeSurface(load);
}
@@ -20,11 +20,11 @@
#ifndef IMAGEMANAGER_H
#define IMAGEMANAGER_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_image/SDL_image.h>
#else
#include <SDL/SDL_image.h>
#include <SDL2/SDL_image.h>
#endif
#include <string>
#include <map>
@@ -259,7 +259,7 @@ std::string InputManager::getKeyCodeName(int keyCode){
char c[64];
if(keyCode>0 && keyCode <0x1000){
//Keyboard.
char* s=SDL_GetKeyName((SDLKey)keyCode);
const char* s=SDL_GetKeyName(static_cast<SDL_Keycode>(keyCode));
if(s!=NULL){
return s;
}else{
@@ -334,7 +334,9 @@ int InputManager::getKeyState(int keyCode,int oldState,bool hasEvent){
state|=0x4;
}
}
if(keyCode<SDLK_LAST && SDL_GetKeyState(NULL)[keyCode]){
//FIXME - SDLK_LAST was removed in SDL2, using the currently last value in the enum
//This may cause issues if the header changes.
if(keyCode<=SDLK_SLEEP && SDL_GetKeyboardState(NULL)[keyCode]){
state|=0x1;
}
}else if(keyCode>0x1000){
@@ -20,7 +20,7 @@
#ifndef INPUTMANAGER_H
#define INPUTMANAGER_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include <vector>
#include <string>

@@ -32,7 +32,7 @@
#ifdef __APPLE__
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <algorithm>
#include <string>
@@ -29,8 +29,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <vector>
#include <string>
@@ -119,7 +119,7 @@ class LevelEditorActionsPopup:private GUIEventCallback{
//FIXME: Add some sort of caching?
SDL_Color fg={0,0,0};
SDL_Surface* tip=TTF_RenderUTF8_Blended(fontText,caption,fg);
SDL_SetAlpha(tip,0,0xFF);
SDL_SetSurfaceAlphaMod(tip, 0xFF);
//Create the surface, we add 16px to the width for an icon,
//plus 8px for the border to make it looks better.
SDL_Surface* item=SDL_CreateRGBSurface(SDL_SWSURFACE,tip->w+16+8,24,32,RMASK,GMASK,BMASK,AMASK);
@@ -909,16 +909,7 @@ class LevelEditorSelectionPopup{
}

if(event.type==SDL_MOUSEBUTTONDOWN){
//check mousewheel
if(event.button.button==SDL_BUTTON_WHEELUP){
startRow-=2;
updateScrollBar();
return;
}else if(event.button.button==SDL_BUTTON_WHEELDOWN){
startRow+=2;
updateScrollBar();
return;
}else if(event.button.button==SDL_BUTTON_LEFT){
if(event.button.button==SDL_BUTTON_LEFT){
SDL_Rect mouse={event.button.x,event.button.y,0,0};

//Check if close it
@@ -958,6 +949,18 @@ class LevelEditorSelectionPopup{
}
}
}
else if(event.type == SDL_MOUSEWHEEL) {
//check mousewheel
if(event.wheel.y < 0){
startRow-=2;
updateScrollBar();
return;
} else {
startRow+=2;
updateScrollBar();
return;
}
}
}
};

@@ -1007,9 +1010,9 @@ LevelEditor::LevelEditor():Game(){
bmGUI=loadImage(getDataPath()+"gfx/gui.png");

//Create the semi transparent surface.
placement=SDL_CreateRGBSurface(SDL_SWSURFACE|SDL_SRCALPHA,SCREEN_WIDTH,SCREEN_HEIGHT,32,RMASK,GMASK,BMASK,0);
SDL_SetColorKey(placement,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(placement->format,255,0,255));
SDL_SetAlpha(placement,SDL_SRCALPHA,125);
placement=SDL_CreateRGBSurface(0,SCREEN_WIDTH,SCREEN_HEIGHT,32,RMASK,GMASK,BMASK,0);
SDL_SetColorKey(placement,SDL_TRUE,SDL_MapRGB(placement->format,255,0,255));
SDL_SetSurfaceAlphaMod(placement,125);

//Count the level editing time.
statsMgr.startLevelEdit();
@@ -1639,7 +1642,7 @@ void LevelEditor::handleEvents(){
SDL_Rect mouse={x,y,0,0};

//Check if we scroll up, meaning the currentType++;
if((event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELUP) || inputMgr.isKeyDownEvent(INPUTMGR_NEXT)){
if((event.type==SDL_MOUSEWHEEL && event.wheel.y > 0) || inputMgr.isKeyDownEvent(INPUTMGR_NEXT)){
switch(tool){
case ADD:
//Check if mouse is in tool box.
@@ -1678,7 +1681,7 @@ void LevelEditor::handleEvents(){
}
}
//Check if we scroll down, meaning the currentType--;
if((event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELDOWN) || inputMgr.isKeyDownEvent(INPUTMGR_PREVIOUS)){
if((event.type==SDL_MOUSEWHEEL && event.wheel.y < 0) || inputMgr.isKeyDownEvent(INPUTMGR_PREVIOUS)){
switch(tool){
case ADD:
//Check if mouse is in tool box.
@@ -2106,7 +2109,7 @@ void LevelEditor::snapToGrid(int* x,int* y){

void LevelEditor::setCamera(const SDL_Rect* r,int count){
//SetCamera only works in the Level editor and when mouse is inside window.
if(stateID==STATE_LEVEL_EDITOR&&(SDL_GetAppState()&SDL_APPMOUSEFOCUS)){
if(stateID==STATE_LEVEL_EDITOR&&(SDL_GetMouseFocus() == sdlWindow)){
//Get the mouse coordinates.
int x,y;
SDL_GetMouseState(&x,&y);
@@ -3491,9 +3494,9 @@ void LevelEditor::resize(){
//Now update the placement surface.
if(placement)
SDL_FreeSurface(placement);
placement=SDL_CreateRGBSurface(SDL_SWSURFACE|SDL_SRCALPHA,SCREEN_WIDTH,SCREEN_HEIGHT,32,RMASK,GMASK,BMASK,0);
SDL_SetColorKey(placement,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(placement->format,255,0,255));
SDL_SetAlpha(placement,SDL_SRCALPHA,125);
placement=SDL_CreateRGBSurface(0,SCREEN_WIDTH,SCREEN_HEIGHT,32,RMASK,GMASK,BMASK,0);
SDL_SetColorKey(placement,SDL_TRUE,SDL_MapRGB(placement->format,255,0,255));
SDL_SetSurfaceAlphaMod(placement,125);

//Move the toolbar's position rect used for collision.
toolbarRect.x=(SCREEN_WIDTH-410)/2;
@@ -32,8 +32,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif

//Class that represents a moving position for moving blocks.
@@ -24,8 +24,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <vector>
#include <string>
@@ -21,11 +21,11 @@
#define LEVELPACKMANAGER_H

#include "LevelPack.h"
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_image/SDL_image.h>
#else
#include <SDL/SDL_image.h>
#include <SDL2/SDL_image.h>
#endif
#include <string>
#include <map>
@@ -31,7 +31,7 @@
#ifdef __APPLE__
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <stdio.h>
#include <string>
@@ -29,8 +29,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <vector>
#include <string>
@@ -30,7 +30,7 @@
#ifdef __APPLE__
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <stdio.h>
#include <string>
@@ -301,13 +301,18 @@ void LevelSelect::handleEvents(){
}

//Check for scrolling down and up.
if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELDOWN && levelScrollBar){
if(levelScrollBar->value<levelScrollBar->maxValue) levelScrollBar->value++;
return;
}else if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELUP && levelScrollBar){
if(levelScrollBar->value>0) levelScrollBar->value--;
return;
// if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELDOWN && levelScrollBar){
if(event.type==SDL_MOUSEWHEEL && levelScrollBar){
if(levelScrollBar->value<levelScrollBar->maxValue) {
//TODO - tweak the scroll amount
levelScrollBar->value += event.wheel.y;
}
}
// return;
// }else if(event.type==SDL_MOUSEBUTTONDOWN && event.button.button==SDL_BUTTON_WHEELUP && levelScrollBar){
// if(levelScrollBar->value>0) levelScrollBar->value--;
// return;
// }
}

void LevelSelect::checkMouse(){
@@ -30,8 +30,8 @@
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include <vector>
#include <string>
@@ -23,7 +23,7 @@
#include "GUIObject.h"
#include "InputManager.h"
#include "StatisticsManager.h"
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
@@ -116,11 +116,14 @@ int main(int argc, char** argv) {
//Loop the SDL events.
while(SDL_PollEvent(&event)){
//Check if user resizes the window.
if(event.type==SDL_VIDEORESIZE){
lastResize=event;
if(event.type==SDL_WINDOWEVENT){
if(event.window.event == SDL_WINDOWEVENT_RESIZED)
{
lastResize=event;

//Don't let other objects process this event (?)
continue;
//Don't let other objects process this event (?)
continue;
}
}

//Check if the fullscreen toggle shortcut is pressed (Alt+Enter).
@@ -171,12 +174,15 @@ int main(int argc, char** argv) {
}

//Process the resize event.
if(lastResize.type==SDL_VIDEORESIZE){
if(lastResize.type==SDL_WINDOWEVENT){
//TODO - used to be SDL_VIDEORESIZE
// so this may trigger on more events than intended
event=lastResize;
onVideoResize();

//After resize we erase the event type
lastResize.type=SDL_NOEVENT;
//TODO - used to be SDL_NOEVENT
lastResize.type=SDL_FIRSTEVENT;
}

//maybe we should add a check here (??) to fix some bugs (ticket #47)
@@ -206,7 +212,8 @@ int main(int argc, char** argv) {
if(fadeIn>0&&fadeIn<255){
SDL_BlitSurface(screen,NULL,tempSurface,NULL);
SDL_FillRect(screen,NULL,0);
SDL_SetAlpha(tempSurface, SDL_SRCALPHA, fadeIn);
// SDL_SetAlpha(tempSurface, SDL_SRCALPHA, fadeIn);
SDL_SetSurfaceAlphaMod(tempSurface, static_cast<Uint8>(fadeIn));
SDL_BlitSurface(tempSurface,NULL,screen,NULL);
fadeIn+=17;
}
@@ -20,11 +20,11 @@
#ifndef MUSICMANAGER_H
#define MUSICMANAGER_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL2/SDL_mixer.h>
#endif
#include <string>
#include <map>
@@ -27,13 +27,13 @@
#include "MD5.h"
#include <iostream>
#include <fstream>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
using namespace std;

@@ -23,13 +23,13 @@
#include "ThemeManager.h"
#include <vector>
#include <string>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif

//Debug the game record file.
@@ -24,7 +24,7 @@
#include "Globals.h"
#include "ThemeManager.h"
#include <vector>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>

class Scenery: public GameObject{
private:
@@ -19,7 +19,7 @@

#include "Settings.h"
#include "FileManager.h"
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include <string>
#include <stdio.h>
using namespace std;
@@ -20,11 +20,11 @@
#ifndef SOUNDMANAGER_H
#define SOUNDMANAGER_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#ifdef __APPLE__
#include <SDL_mixer/SDL_mixer.h>
#else
#include <SDL/SDL_mixer.h>
#include <SDL2/SDL_mixer.h>
#endif
#include <string>
#include <map>
@@ -36,7 +36,7 @@
#ifdef __APPLE__
#include <SDL_gfx/SDL_gfxPrimitives.h>
#else
#include <SDL/SDL_gfxPrimitives.h>
#include <SDL2/SDL2_gfxPrimitives.h>
#endif

using namespace std;
@@ -537,7 +537,8 @@ SDL_Surface* StatisticsManager::createAchievementSurface(AchievementInfo* info,S
r1.y++;
r1.w=int(achievementProgress/100.0f*float(r1.w));
r1.h-=3;
boxRGBA(surface,r1.x,r1.y,r1.x+r1.w,r1.y+r1.h,0,0,0,100);
//FIXME: Disabled for SDL2
// boxRGBA(surface,r1.x,r1.y,r1.x+r1.w,r1.y+r1.h,0,0,0,100);

//???
r.x+=2;
@@ -577,7 +578,7 @@ void StatisticsManager::drawAchievement(int alpha){
bmAchievement->w,bmAchievement->h};

//draw the surface
SDL_SetAlpha(bmAchievement,SDL_SRCALPHA,alpha*40);
SDL_SetSurfaceAlphaMod(bmAchievement,alpha*40);
SDL_BlitSurface(bmAchievement,NULL,screen,&r);

//draw drop shadow - corner
@@ -20,7 +20,7 @@
#ifndef STATISTICSMANAGER_H
#define STATISTICSMANAGER_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include <string>
#include <vector>
#include <map>
@@ -30,11 +30,11 @@
#include "GUIListBox.h"
#include "GUIScrollBar.h"
#ifdef __APPLE__
#include <SDL_image/SDL_image.h>
#include <SDL_gfx/SDL_gfxPrimitives.h>
#include <SDL2_image/SDL2_image.h>
#include <SDL2_gfx/SDL2_gfxPrimitives.h>
#else
#include <SDL/SDL_image.h>
#include <SDL/SDL_gfxPrimitives.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL2_gfxPrimitives.h>
#endif

using namespace std;
@@ -198,9 +198,10 @@ void StatisticsScreen::createGUI(){
SDL_Surface *surface=statsMgr.createAchievementSurface(&achievementList[idx],NULL,&r,false,lpt);

if(surface!=NULL){
hlineRGBA(surface,0,surface->w,0,0,0,0,32);
//FIXME - this is broken with SDL2 as the function now operates on a renderer, not sure how best to fix it
/* hlineRGBA(surface,0,surface->w,0,0,0,0,32);
hlineRGBA(surface,0,surface->w,surface->h-1,0,0,0,128);
hlineRGBA(surface,0,surface->w,surface->h-2,0,0,0,32);
hlineRGBA(surface,0,surface->w,surface->h-2,0,0,0,32);*/
list->addItem("",surface);
}
}
@@ -252,14 +253,16 @@ void StatisticsScreen::createGUI(){
DRAW_PLAYER_STATISTICS(_("Squashed times"),Squashed,"%d");

//Game specific statistics.
list->addItem("",SDL_DisplayFormat(h_bar));
//NOTE SDL2 changed this to sdl_convertsurfaceformat, but not sure if it's needed
// list->addItem("",SDL_DisplayFormat(h_bar));

drawMiscStatistics2(w,list,_("Recordings:"),statsMgr.recordTimes,"%d",_("Switch pulled times:"),statsMgr.switchTimes,"%d");
drawMiscStatistics1(w,list,_("Swap times:"),statsMgr.swapTimes,"%d");
drawMiscStatistics2(w,list,_("Save times:"),statsMgr.saveTimes,"%d",_("Load times:"),statsMgr.loadTimes,"%d");

//Level specific statistics
list->addItem("",SDL_DisplayFormat(h_bar));
//NOTE SDL2 changed this to sdl_convertsurfaceformat, but not sure if it's needed
//list->addItem("",SDL_DisplayFormat(h_bar));

surface=TTF_RenderUTF8_Blended(fontGUISmall,_("Completed levels:"),themeTextColor);
stats=SDL_CreateRGBSurface(SCREEN_FLAGS,w,surface->h,
@@ -300,7 +303,8 @@ void StatisticsScreen::createGUI(){
list->addItem("",stats);

//Other statistics.
list->addItem("",SDL_DisplayFormat(h_bar));
//NOTE SDL2 changed this to sdl_convertsurfaceformat, but not sure if it's needed
// list->addItem("",SDL_DisplayFormat(h_bar));

sprintf(s,"%02d:%02d:%02d",statsMgr.playTime/3600,(statsMgr.playTime/60)%60,statsMgr.playTime%60);
sprintf(s2,"%02d:%02d:%02d",statsMgr.levelEditTime/3600,(statsMgr.levelEditTime/60)%60,statsMgr.levelEditTime%60);
@@ -20,7 +20,7 @@
#ifndef STATISTICSSCREEN_H
#define STATISTICSSCREEN_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include "GameState.h"
#include "GUIObject.h"
#include "GUIListBox.h"
@@ -25,7 +25,7 @@
#ifdef __APPLE__
#include <SDL_gfx/SDL_rotozoom.h>
#else
#include <SDL/SDL_rotozoom.h>
#include <SDL2/SDL2_rotozoom.h>
#endif
#include <string.h>
#include <iostream>
@@ -23,9 +23,10 @@
#include "Globals.h"
#include "TreeStorageNode.h"
#ifdef __APPLE__
#include <SDL_gfx/SDL_rotozoom.h>
//TODO don't know if this works
#include <SDL2_gfx/SDL2_rotozoom.h>
#else
#include <SDL/SDL_rotozoom.h>
#include <SDL2/SDL2_rotozoom.h>
#endif
#include <string.h>
#include <math.h>
@@ -18,7 +18,7 @@
*/

#include "Timer.h"
#include <SDL/SDL.h>
#include <SDL2/SDL.h>

void Timer::start(){
//Store the current number of ticks (start time).
@@ -20,7 +20,7 @@
#ifndef TITLE_MENU_H
#define TITLE_MENU_H

#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#include "GameState.h"

//Included for the Options menu.