diff --git a/Makefile b/Makefile index d28ca5c..d9ff64c 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,10 @@ LIBS = -lmingw32 -lSDL2main -lSDL2 -lbox2d -lentityx SRCDIR = src BUILDDIR = build -SRC = $(shell C:\\MinGW\\msys\\1.0\\bin\\find $(SRCDIR) -name *.cpp) -OBJ = $(patsubst %.cpp, %.o, $(SRC)) -OBJ := $(subst $(SRCDIR), $(BUILDDIR), $(OBJ)) +SRCDIRS := $(shell C:\\MinGW\\msys\\1.0\\bin\\find src/**/* -name '*.cpp' -exec dirname {} \; | sort | uniq) +BUILDLIST := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SRCDIRS)) +SRC = $(shell C:\\MinGW\\msys\\1.0\\bin\\find $(SRCDIR) -type f -name *.cpp) +OBJ := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SRC:.cpp=.o)) .PHONY: all clean build run debug @@ -19,9 +20,10 @@ run: all $(BUILDDIR)/$(EXE) $(EXE): $(OBJ) - $(CC) $(CFLAGS) -o $(BUILDDIR)/$@ $(OBJ) -L$(LIB_PATH) $(LIBS) -static-libgcc -static-libstdc++ + $(CC) $(CFLAGS) -o $(BUILDDIR)/$@ $^ -L$(LIB_PATH) $(LIBS) -static-libgcc -static-libstdc++ -$(OBJ): $(SRC) +$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp + @mkdir -p $(BUILDLIST) $(CC) $(CFLAGS) -c $< -o $@ -I$(INC_PATH) build: @@ -34,4 +36,4 @@ clean: rm -rf $(BUILDDIR) debug: - @echo $(OBJ) + @echo $(BUILDLIST) diff --git a/src/DarkRP2D.cpp b/src/DarkRP2D.cpp new file mode 100644 index 0000000..17148cb --- /dev/null +++ b/src/DarkRP2D.cpp @@ -0,0 +1,17 @@ +#include "DarkRP2D.h" + + void DarkRP2D::create() { + + } + + void DarkRP2D::loop(float deltaTime) { + + } + + void DarkRP2D::resize() { + + } + + void DarkRP2D::dispose() { + + } diff --git a/src/DarkRP2D.h b/src/DarkRP2D.h new file mode 100644 index 0000000..553841d --- /dev/null +++ b/src/DarkRP2D.h @@ -0,0 +1,12 @@ +#ifndef DARKRP2D_H +#define DARKRP2D_H + +class DarkRP2D { +public: + void create(); + void loop(float deltaTime); + void resize(); + void dispose(); +}; + +#endif // DARKRP2D_H diff --git a/src/DesktopLauncher.cpp b/src/DesktopLauncher.cpp new file mode 100644 index 0000000..b1032ca --- /dev/null +++ b/src/DesktopLauncher.cpp @@ -0,0 +1,15 @@ +#include + +#include +#include "DarkRP2D.h" + +const int WIDTH = 800, HEIGHT = 600; + +int main(int argc, char *argv[]) { + SDL_Init( SDL_INIT_EVERYTHING ); + + DarkRP2D* darkRP2D = new DarkRP2D(); + + SDL_Quit( ); + return EXIT_SUCCESS; +} diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index d05165b..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include - -#include -#include -#include - -const int WIDTH = 800, HEIGHT = 600; - -/* - * If 'main' is defined we clear that definition - * to get our default 'main' function back. - */ - -int main( int argc, char *argv[] ) { - SDL_Init( SDL_INIT_EVERYTHING ); - - //Box2D world just testing - b2World *world = new b2World(b2Vec2(0.0f, 98.f)); - //entityx testing - entityx::EntityX ex; - entityx::Entity entity = ex.entities.create(); - - SDL_Window *window = SDL_CreateWindow( "Hello SDL World", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); - - // Check that the window was successfully created - if ( NULL == window ) - { - // In the case that the window could not be made... - std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; - return 1; - } - - SDL_Event windowEvent; - - while ( true ) - { - if ( SDL_PollEvent( &windowEvent ) ) - { - if ( SDL_QUIT == windowEvent.type ) - { - break; - } - } - } - - SDL_DestroyWindow( window ); - SDL_Quit( ); - - return EXIT_SUCCESS; -} diff --git a/src/test/temp.cpp b/src/test/temp.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/test/test.cpp b/src/test/test.cpp new file mode 100644 index 0000000..d60dbf5 --- /dev/null +++ b/src/test/test.cpp @@ -0,0 +1,3 @@ +void hello() { + +}