Some c++ testing
This commit is contained in:
14
Makefile
14
Makefile
@@ -7,9 +7,10 @@ LIBS = -lmingw32 -lSDL2main -lSDL2 -lbox2d -lentityx
|
|||||||
|
|
||||||
SRCDIR = src
|
SRCDIR = src
|
||||||
BUILDDIR = build
|
BUILDDIR = build
|
||||||
SRC = $(shell C:\\MinGW\\msys\\1.0\\bin\\find $(SRCDIR) -name *.cpp)
|
SRCDIRS := $(shell C:\\MinGW\\msys\\1.0\\bin\\find src/**/* -name '*.cpp' -exec dirname {} \; | sort | uniq)
|
||||||
OBJ = $(patsubst %.cpp, %.o, $(SRC))
|
BUILDLIST := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SRCDIRS))
|
||||||
OBJ := $(subst $(SRCDIR), $(BUILDDIR), $(OBJ))
|
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
|
.PHONY: all clean build run debug
|
||||||
|
|
||||||
@@ -19,9 +20,10 @@ run: all
|
|||||||
$(BUILDDIR)/$(EXE)
|
$(BUILDDIR)/$(EXE)
|
||||||
|
|
||||||
$(EXE): $(OBJ)
|
$(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)
|
$(CC) $(CFLAGS) -c $< -o $@ -I$(INC_PATH)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@@ -34,4 +36,4 @@ clean:
|
|||||||
rm -rf $(BUILDDIR)
|
rm -rf $(BUILDDIR)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
@echo $(OBJ)
|
@echo $(BUILDLIST)
|
||||||
|
|||||||
17
src/DarkRP2D.cpp
Normal file
17
src/DarkRP2D.cpp
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#include "DarkRP2D.h"
|
||||||
|
|
||||||
|
void DarkRP2D::create() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DarkRP2D::loop(float deltaTime) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DarkRP2D::resize() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DarkRP2D::dispose() {
|
||||||
|
|
||||||
|
}
|
||||||
12
src/DarkRP2D.h
Normal file
12
src/DarkRP2D.h
Normal file
@@ -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
|
||||||
15
src/DesktopLauncher.cpp
Normal file
15
src/DesktopLauncher.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#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;
|
||||||
|
}
|
||||||
50
src/main.cpp
50
src/main.cpp
@@ -1,50 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <Box2D/Box2D.h>
|
|
||||||
#include <entityx/entityx.h>
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
0
src/test/temp.cpp
Normal file
0
src/test/temp.cpp
Normal file
3
src/test/test.cpp
Normal file
3
src/test/test.cpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
void hello() {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user