diff --git a/install/Makefile b/install/Makefile
index 543a9fc6..9d060365 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -4,7 +4,7 @@ MAKENSIS = makensis
UNZIP = unzip -o
SED = sed
-VERSIONTAG = ../obj/win32/versiontag
+VERSIONTAG = ../obj/win32-sdl/versiontag
VERSION := $(shell cat $(VERSIONTAG))
SOURCES = ../src-$(VERSION).tgz
diff --git a/project/msvc/grafx2.sln b/project/msvc/grafx2-sdl.sln
similarity index 100%
rename from project/msvc/grafx2.sln
rename to project/msvc/grafx2-sdl.sln
diff --git a/project/msvc/grafx2.vcxproj b/project/msvc/grafx2.vcxproj
index a3fde461..7bff05b6 100644
--- a/project/msvc/grafx2.vcxproj
+++ b/project/msvc/grafx2.vcxproj
@@ -52,7 +52,7 @@
Level3
Disabled
- NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ USE_SDL;NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)
4244;%(DisableSpecificWarnings)
@@ -71,7 +71,7 @@
MaxSpeed
true
true
- NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ USE_SDL;NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)
4244;%(DisableSpecificWarnings)
@@ -93,6 +93,7 @@
+
@@ -153,6 +154,7 @@
+
diff --git a/project/msvc/grafx2.vcxproj.filters b/project/msvc/grafx2.vcxproj.filters
index ba45dc68..88a6dc53 100644
--- a/project/msvc/grafx2.vcxproj.filters
+++ b/project/msvc/grafx2.vcxproj.filters
@@ -177,6 +177,9 @@
Fichiers d%27en-tĂȘte
+
+ Fichiers d%27en-tĂȘte
+
@@ -349,5 +352,8 @@
Fichiers sources
+
+ Fichiers sources
+
\ No newline at end of file
diff --git a/src/Makefile b/src/Makefile
index dee5c5cd..dfabf6b6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -57,10 +57,13 @@ ifneq (,$(LABEL))
RES := $(shell if [ ! -f $(LABEL_CACHE) ] || [ "`cat $(LABEL_CACHE)`" != "$(LABEL)" ] ; then echo "$(LABEL)" > $(LABEL_CACHE) ; fi )
endif
- CFLAGS_CACHE = .cflags.cache
+ CFLAGS_CACHE = $(OBJDIR)/.cflags.cache
RECOILVER = 4.3.0
+# Video / input API used
+ API ?= sdl
+
### PLATFORM DETECTION AND CONFIGURATION ###
PLATFORMOBJ =
@@ -539,6 +542,17 @@ ifdef NORECOIL
COPT += -DNORECOIL
endif
+OBJDIR := $(OBJDIR)-$(API)
+
+ifeq ($(API),sdl)
+ APIOBJ = sdlscreen.o
+ COPT += -DUSE_SDL
+endif
+ifeq ($(API),sdl2)
+ #APIOBJ = sdlscreen.o
+ COPT += -DUSE_SDL2
+endif
+
#To enable Joystick emulation of cursor, make USE_JOYSTICK=1 (for input.o)
#This can be necessary to test cursor code on a PC, but by default for all
#non-console platforms the joystick is disabled, to avoid reporting
@@ -553,7 +567,7 @@ endif
.PHONY : all debug release clean depend zip force install uninstall valgrind
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
-OBJS = main.o init.o graph.o sdlscreen.o misc.o special.o \
+OBJS = main.o init.o graph.o $(APIOBJ) misc.o special.o \
buttons.o palette.o help.o operatio.o pages.o loadsave.o \
readline.o engine.o filesel.o op_c.o readini.o saveini.o \
shade.o keyboard.o io.o version.o text.o SFont.o setup.o \
@@ -739,9 +753,10 @@ pversion.c: $(LABEL_CACHE)
endif
$(OBJDIR)/versiontag: pversion.c $(REVISION_CACHE)
+ $(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.$(GIT_REVISION) | tr " :" "_-" | sed -e "s/\([wW][iI][pP]\)\\./\1/" > $(OBJDIR)/versiontag
-RES := $(shell if [ ! -f $(CFLAGS_CACHE) ] || [ "`cat $(CFLAGS_CACHE)`" != "$(COPT) $(CFLAGS)" ] ; then echo "$(COPT) $(CFLAGS)" > $(CFLAGS_CACHE) ; fi )
+RES := $(shell $(MKDIR) $(OBJDIR) ; if [ ! -f $(CFLAGS_CACHE) ] || [ "`cat $(CFLAGS_CACHE)`" != "$(COPT) $(CFLAGS)" ] ; then echo "$(COPT) $(CFLAGS)" > $(CFLAGS_CACHE) ; fi )
ifndef NORECOIL
recoil.c: ../3rdparty/recoil-$(RECOILVER)/recoil.c
diff --git a/src/io.c b/src/io.c
index 24c6b6f7..5d91cc7a 100644
--- a/src/io.c
+++ b/src/io.c
@@ -38,7 +38,7 @@
#include
#include
#include
-#elif defined(__WIN32__)
+#elif defined(WIN32)
#ifdef _MSC_VER
#include
#else
diff --git a/src/io.h b/src/io.h
index 4302f1d7..300feb91 100644
--- a/src/io.h
+++ b/src/io.h
@@ -36,6 +36,10 @@
/// - Also, don't assume "/" or "\\", use PATH_SEPARATOR
/// If you don't, you break another platform.
//////////////////////////////////////////////////////////////////////////////
+#ifndef IO_H__
+#define IO_H__
+
+#include
/// Reads a single byte from an open file. Returns true if OK, false if a file i/o error occurred.
int Read_byte(FILE *file, byte *dest);
@@ -151,3 +155,5 @@ int Remove_path(const char * path);
///
/// Remove the directory
int Remove_directory(const char * path);
+
+#endif
\ No newline at end of file