Commit 177eeca1 authored by Benjamin 'Albsi' Albsmeier's avatar Benjamin 'Albsi' Albsmeier
Browse files

Merge branch 'develop' into feature/input

parents 180633e0 a51bc02d
......@@ -81,7 +81,6 @@ sftp-config.json
### JetBrains ###
.idea
CMakeLists.txt
### Jerry QT Project Files ###
GDW_WS1415_CPP.*
......
before_script:
- git remote prune origin
- ./build_deps.sh linux
linux:
script:
- premake5 --cc=clang gmake
- make clean
- make -j 7
tags:
- Linux
only:
- develop
allow_failure: false
cmake_minimum_required(VERSION 3.1)
project(gdw_ss15_cpp)
#use clang instead of g++
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -stdlib=libc++")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic")
#define symbols for debug build
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
if (NOT WIN32)
add_definitions(-DSTACKTRACE)
endif ()
endif ()
#define symbols for project
add_definitions(-DGLM_SWIZZLE)
add_definitions(-DGLEW_STATIC)
find_package(OpenGL)
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/gli"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/glm"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer/x86_64-w64-mingw32/include/SDL2"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
FILE(GLOB_RECURSE clion_all_headers
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/*.inl
)
#glew library
add_library(glew_static STATIC IMPORTED)
set_target_properties(glew_static PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/build/libGLEW.a
)
set(LINKED_LIBRARIES
SDL2
SDL2main
SDL2_mixer
GL
c++
c++abi
)
add_executable(Game ${clion_all_headers})
target_link_libraries(Game ${LINKED_LIBRARIES} glew_static)
file(COPY assets DESTINATION .)
\ No newline at end of file
// Add predefined macros for your project here. For example:
// #define THE_ANSWER 42
This diff is collapsed.
lib/glew/auto/src
lib/glew/include/GL
lib/sdl2/i686-w64-mingw32/include/SDL2
lib/sdl2/include
lib/sdl2/test
lib/sdl2/x86_64-w64-mingw32/include/SDL2
lib/sdl2_mixer/i686-w64-mingw32/include/SDL2
lib/sdl2_mixer/x86_64-w64-mingw32/include/SDL2
include/core
include/
glm/
lib/
lib/glm/glm/glm.hpp
tools/mesh_converter/lib/assimp/code
tools/mesh_converter/lib/assimp/code/res
tools/mesh_converter/lib/assimp/contrib/ConvertUTF
tools/mesh_converter/lib/assimp/contrib/irrXML
tools/mesh_converter/lib/assimp/contrib/openddlparser/include/openddlparser
tools/mesh_converter/lib/assimp/contrib/poly2tri/poly2tri
tools/mesh_converter/lib/assimp/contrib/poly2tri/poly2tri/common
tools/mesh_converter/lib/assimp/contrib/poly2tri/poly2tri/sweep
tools/mesh_converter/lib/assimp/contrib/unzip
tools/mesh_converter/lib/assimp/contrib/zlib
tools/mesh_converter/lib/assimp/doc
tools/mesh_converter/lib/assimp/include/assimp
tools/mesh_converter/lib/assimp/include/assimp/Compiler
tools/mesh_converter/lib/assimp/include/assimp/port/AndroidJNI
tools/mesh_converter/lib/assimp/port/jassimp/jassimp-native/src
tools/mesh_converter/lib/assimp/samples/DevIL/include/IL
tools/mesh_converter/lib/assimp/samples/glut/GL
tools/mesh_converter/lib/assimp/samples/SimpleAssimpViewX
tools/mesh_converter/lib/assimp/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/include
tools/mesh_converter/lib/assimp/test/unit
tools/mesh_converter/lib/assimp/tools/assimp_cmd
tools/mesh_converter/lib/assimp/tools/assimp_view
include/asset
src/graphics
src/game_state_machine
src/core
glm
tools/mesh_converter/src
include/graphics
lib/gli/test/gtx
lib/gli/test/core
tools/mesh_converter/lib/glm/glm/gtc
lib/gli/external/glm-0.9.5.1/glm
lib/gli/external/glm-0.9.5.1/test/core
src
src/util
tools/mesh_converter/lib/assimp/contrib/clipper
lib/gli/external/glm-0.9.5.1/test/external/gli/core
tools/mesh_converter/lib/assimp/port/AndroidJNI
tools/mesh_converter/lib/glm/glm/detail
lib/glew/src
tools/mesh_converter/lib/glm/test/gtc
tools/mesh_converter/lib/assimp/code/BoostWorkaround/boost/tuple
lib/glm/test/external/gli
lib/glm/test/external/gli/core
lib/gli/external/glm-0.9.5.1/test/external/gli/gtx
lib/glm/glm
tools/mesh_converter/lib/glm/glm/gtx
tools/mesh_converter/lib/glm/test/external/gli
tools/mesh_converter/lib/assimp/code/BoostWorkaround/boost/math
tools/mesh_converter/lib/glm/test/core
tools/mesh_converter/lib/assimp/code/BoostWorkaround/boost
lib/gli/test/gtc
src/ecs
tools/mesh_converter/include
lib/gli/external/glm-0.9.5.1/test/external/gli
include/core
tools/mesh_converter/lib/glm/test/external/gli/core
lib/glm/glm/gtc
lib/gli/test
tools/mesh_converter/lib/glm/test/gtx
src/asset
src/audio
src/core
lib/glm/glm/gtx
lib/glm/test/core
lib/gli/external/glm-0.9.5.1/test/gtx
lib/glm/test/gtx
lib/gli/gli/core
lib/gli/gli
src/rendering
tools/mesh_converter/lib/assimp/samples/SimpleOpenGL
lib/gli/test/bug
lib/gli/external/glm-0.9.5.1/glm/detail
tools/mesh_converter/lib/glm/glm
lib/glew/build/cmake/testbuild
lib/gli/external/glm-0.9.5.1/test/gtc
tools/mesh_converter/lib/assimp/contrib/openddlparser/code
lib/glm/test/gtc
include/rendering
tools/mesh_converter/lib/glm/test/external/gli/gtx
include/util
lib/gli/external/glm-0.9.5.1/glm/virtrev
lib/gli/external/glm-0.9.5.1/glm/gtx
include/ecs
tools/mesh_converter/lib/assimp/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src
include/audio
lib/glm/test/external/gli/gtx
lib/glm/glm/detail
lib/gli/external/glm-0.9.5.1/glm/gtc
include/game_state_machine
src/physics/movement
include/physics/movement
include/physics/collision
include/physics
src/physics
# FSI-Lizenz
Copyright © 2015 Benjamin Albsmeier, Jeremias Boos, Thomas Eppers, Johannes Kirchner, Michael Ochmann
Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der zugehörigen Dokumentationen
(die "Software") erhält, die Erlaubnis erteilt, sie uneingeschränkt zu benutzen, inklusive und ohne Ausnahme dem Recht,
sie zu verwenden, kopieren, ändern, fusionieren, verlegen, verbreiten, unterlizenzieren und/oder zu verkaufen,
und Personen, die diese Software erhalten, diese Rechte zu geben, unter den folgenden Bedingungen:
Der obige Urheberrechtsvermerk und dieser Erlaubnisvermerk sind in allen Kopien oder Teilkopien der Software beizulegen.
Diese Software darf niemals dazu verwendet werden, einem menschlichen Individuum, direkt oder indirekt, in irgendeiner
erdenklichen Form Schaden zuzufügen.
DIE SOFTWARE WIRD OHNE JEDE AUSDRÜCKLICHE ODER IMPLIZIERTE GARANTIE BEREITGESTELLT, EINSCHLIEßLICH DER GARANTIE ZUR
BENUTZUNG FÜR DEN VORGESEHENEN ODER EINEM BESTIMMTEN ZWECK SOWIE JEGLICHER RECHTSVERLETZUNG, JEDOCH NICHT DARAUF
BESCHRÄNKT. IN KEINEM FALL SIND DIE AUTOREN ODER COPYRIGHTINHABER FÜR JEGLICHEN SCHADEN ODER SONSTIGE ANSPRÜCHE
HAFTBAR ZU MACHEN, OB INFOLGE DER ERFÜLLUNG EINES VERTRAGES, EINES DELIKTES ODER ANDERS IM ZUSAMMENHANG MIT DER
SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN.
\ No newline at end of file
......@@ -9,8 +9,9 @@ out vec2 texcoord_;
uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;
void main() {
gl_Position = projection * view * vec4(_position, 1.f);
gl_Position = projection * view * model * vec4(_position, 1.f);
texcoord_ = _texcoord;
}
@echo off
echo "Update/Init submodules"
git submodule update --init --recursive
echo "Building GLEW"
cd lib
cd glew
premake5 gmake
mingw32-make -j 4 CC=gcc CXX=g++
cd ..
......@@ -10,6 +10,8 @@ namespace gdw {
class graphics_system;
class input;
class rendering_system;
class game_state_machine;
class physics_system;
}
namespace gdw {
......@@ -22,6 +24,8 @@ namespace gdw {
std::unique_ptr<gdw::graphics_system> graphics_system_;
std::unique_ptr<gdw::input> input_;
std::unique_ptr<gdw::rendering_system> rendering_system_;
std::unique_ptr<gdw::game_state_machine> game_state_machine_;
std::unique_ptr<gdw::physics_system> physics_system_;
// needs to be the last one that will be destroyed
gdw::entity_manager entity_manager_;
......@@ -70,6 +74,14 @@ namespace gdw {
gdw::rendering_system& rendering_system() noexcept {
return *rendering_system_;
}
gdw::game_state_machine& game_state_machine() noexcept {
return *game_state_machine_;
}
gdw::physics_system& physics_system() noexcept {
return *physics_system_;
}
};
}
......
......@@ -3,6 +3,7 @@
#include <memory>
#include <unordered_map>
#include <utility>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
......
#ifndef GAME_STATE_H
#define GAME_STATE_H
namespace gdw {
class engine;
class game_state {
public:
game_state(engine &engine);
virtual ~game_state();
virtual void update(float dt) = 0;
virtual void on_exit() = 0;
virtual void on_enter() = 0;
unsigned long long id() {return id_;}
protected:
engine& engine_;
unsigned long long id_;
};
} //Namespace gdw
#endif // GAME_STATE_H
#ifndef __GAME_STATE_MACHINE__
#define __GAME_STATE_MACHINE__
#include <map>
#include <memory>
#include <util/id.hpp>
#include <game_state_machine/game_state.h>
#include <util/map_helper.h>
namespace gdw {
class engine;
class game_state;
class game_state_machine {
public:
game_state_machine(engine &engine);
~game_state_machine();
template<typename T>
void change_state() {
auto id = type_id<T>();
if(!current_state_ ||
current_state_->id() == id ||
!map_helper::findKey(game_states_, id))
return;
current_state_->on_exit();
current_state_ = game_states_[id].get();
current_state_->on_enter();
}
void update(float dt);
private:
gdw::engine& engine_;
std::map<unsigned long long, std::unique_ptr<game_state>> game_states_;
game_state* current_state_;
};
} //Namespace gdw
#endif
#ifndef __MENU_STATE__
#define __MENU_STATE__
#include <game_state_machine/game_state.h>
namespace gdw {
class menu_state : public game_state {
public:
menu_state(engine& engine);
~menu_state();
void update(float dt);
void on_enter();
void on_exit();
};
} //Namespace gdw
#endif
#ifndef __PLAY_STATE__
#define __PLAY_STATE__
#include <game_state_machine/game_state.h>
namespace gdw {
class entity;
class movement_component;
class play_state : public game_state {
public:
play_state(engine& engine);
~play_state();
void update(float dt);
void on_enter();
void on_exit();
private:
entity* wcube_;
movement_component* wcube_move_;
};
} //Namespace gdw
#endif
#ifndef COLLISION_COMPONENT_
#define COLLISION_COMPONENT_
#include "collision_shape.h"
#include <core/engine.hpp>
#include <memory>
namespace gdw{
class collision_component
{
public:
collision_component(engine &engine, shape_type shape_type);
~collision_component();
private:
std::unique_ptr<collision_shape> collision_shape_;
};
}
#endif
\ No newline at end of file
#ifndef COLLISION_SHAPE_
#define COLLISION_SHAPE_
namespace gdw{
enum class shape_type
{
sphere,
ray
};
class collision_shape
{
public:
collision_shape(shape_type shape_type);
virtual ~collision_shape();
protected:
shape_type shape_type_;
};
}
#endif
\ No newline at end of file
#ifndef RAY_
#define RAY_
#include "collision_shape.h"
#include <glm/glm.hpp>
namespace gdw{
class ray : public collision_shape {
public:
ray(glm::vec3 source, glm::vec3 destination);
~ray();
private:
glm::vec3 source;
glm::vec3 destination;
};
}
#endif
\ No newline at end of file
#ifndef SPHERE_
#define SPHERE_
namespace gdw{
class sphere(glm::vec3 position, float radius):collision_shape(){
glm::vec3 position;
float radius;
}
}
#endif
\ No newline at end of file
Supports Markdown
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