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:
- mkdir bin
- mkdir saves
script:
- make
- make console
artifacts:
paths:
- bin/
......
#ifndef __COMPONENTS__TEXTURE_H__
#define __COMPONENTS__TEXTURE_H__
#ifndef console
#include <SDL.h>
#endif
#include <cstdio>
#include <string>
#include "components/components-generic.h"
......
......@@ -6,7 +6,10 @@
#include <vector>
#include <chrono>
#include <ctime>
#ifndef console
#include <SDL.h>
#endif
// Return
......@@ -15,6 +18,8 @@
#include "scene.h"
#include "window.h"
#endif
class GameEngine
{
public:
......
#ifndef __WINDOW_H__
#define __WINDOW_H__
#ifndef console
#include <SDL.h>
#include <SDL_image.h>
#endif
#include <cstdio>
#include <cstring>
......@@ -93,6 +95,4 @@ class Window
};
#endif // __WINDOW_H__
\ No newline at end of file
#endif // __WINDOW_H__
......@@ -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))
TEST_OBJ_FILES = $(patsubst $(TEST_DIR)/%.test.cpp,$(BUILD_DIR)/%.o,$(TEST_FILES))
# Define this for running console-only
CONSOLE_DEFINE = -Dconsole
# Output executable
TARGET = $(BIN_DIR)/game
TEST_TARGET = $(BIN_DIR)/test_runner
......@@ -66,6 +69,9 @@ all: $(TARGET)
$(TARGET): $(OBJ_FILES)
$(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
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -I${SDL_INCLUDE} -I$(INC_DIR) -c -o $@ $<
......@@ -75,5 +81,13 @@ clean:
rm -rf ./*~ ./*.swp
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)
./$(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