Skip to content
Snippets Groups Projects
Commit 27d1ded9 authored by Alfred Burgess's avatar Alfred Burgess
Browse files

Merge branch 'sdl' of ssh.gitlab.ucc.asn.au:aburgess/spaceok into sdl

parents 19344d64 cfe9ee4e
No related merge requests found
...@@ -18,7 +18,7 @@ build: ...@@ -18,7 +18,7 @@ build:
- mkdir bin - mkdir bin
- mkdir saves - mkdir saves
script: script:
- make - make console
artifacts: artifacts:
paths: paths:
- bin/ - bin/
......
#ifndef __COMPONENTS__TEXTURE_H__ #ifndef __COMPONENTS__TEXTURE_H__
#define __COMPONENTS__TEXTURE_H__ #define __COMPONENTS__TEXTURE_H__
#ifndef console
#include <SDL.h> #include <SDL.h>
#endif
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include "components/components-generic.h" #include "components/components-generic.h"
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
#include <vector> #include <vector>
#include <chrono> #include <chrono>
#include <ctime> #include <ctime>
#ifndef console
#include <SDL.h> #include <SDL.h>
#endif
// Return // Return
...@@ -15,6 +18,8 @@ ...@@ -15,6 +18,8 @@
#include "scene.h" #include "scene.h"
#include "window.h" #include "window.h"
#endif
class GameEngine class GameEngine
{ {
public: public:
......
#ifndef __WINDOW_H__ #ifndef __WINDOW_H__
#define __WINDOW_H__ #define __WINDOW_H__
#ifndef console
#include <SDL.h> #include <SDL.h>
#include <SDL_image.h> #include <SDL_image.h>
#endif
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
...@@ -93,6 +95,4 @@ class Window ...@@ -93,6 +95,4 @@ class Window
}; };
#endif // __WINDOW_H__
#endif // __WINDOW_H__
\ No newline at end of file
...@@ -57,6 +57,9 @@ TEST_FILES = $(wildcard $(TEST_DIR)/**/*.test.cpp $(TEST_DIR)/*.test.cpp) ...@@ -57,6 +57,9 @@ TEST_FILES = $(wildcard $(TEST_DIR)/**/*.test.cpp $(TEST_DIR)/*.test.cpp)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRC_FILES)) OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRC_FILES))
TEST_OBJ_FILES = $(patsubst $(TEST_DIR)/%.test.cpp,$(BUILD_DIR)/%.o,$(TEST_FILES)) TEST_OBJ_FILES = $(patsubst $(TEST_DIR)/%.test.cpp,$(BUILD_DIR)/%.o,$(TEST_FILES))
# Define this for running console-only
CONSOLE_DEFINE = -Dconsole
# Output executable # Output executable
TARGET = $(BIN_DIR)/game TARGET = $(BIN_DIR)/game
TEST_TARGET = $(BIN_DIR)/test_runner TEST_TARGET = $(BIN_DIR)/test_runner
...@@ -66,6 +69,9 @@ all: $(TARGET) ...@@ -66,6 +69,9 @@ all: $(TARGET)
$(TARGET): $(OBJ_FILES) $(TARGET): $(OBJ_FILES)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJ_FILES) -L$(SDL_LIBRARY) $(LDFLAGS) $(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJ_FILES) -L$(SDL_LIBRARY) $(LDFLAGS)
console: $(OBJ_FILES)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJ_FILES) $(CONSOLE_DEFINE)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp ${INC_DIR}/*.h $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp ${INC_DIR}/*.h
@mkdir -p $(@D) @mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -I${SDL_INCLUDE} -I$(INC_DIR) -c -o $@ $< $(CXX) $(CXXFLAGS) $(LDFLAGS) -I${SDL_INCLUDE} -I$(INC_DIR) -c -o $@ $<
...@@ -75,5 +81,13 @@ clean: ...@@ -75,5 +81,13 @@ clean:
rm -rf ./*~ ./*.swp rm -rf ./*~ ./*.swp
rm -rf *~ rm -rf *~
run_tests: $(TEST_OBJ_FILES)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INC_DIRS) -o ${TEST_TARGET} $^
./${TEST_TARGET}
$(BUILD_DIR)/%.o: $(TEST_DIR)/%.test.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INC_DIRS) -c -o $@ $<
run: $(TARGET) run: $(TARGET)
./$(TARGET) ./$(TARGET)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment