Commit ae951678 authored by Jerry's avatar Jerry
Browse files

Merge branch 'develop' of gitlab.fsi.hochschule-trier.de:GameDevWeek/gdw_ss15_cpp into develop

parents 44d7089d 29a92101
before_script:
- mkdir /root/.ssh && chmod 700 /root/.ssh
- ssh-keyscan -H -p 10022 gitlab.fsi.hochschule-trier.de >> /root/.ssh/known_hosts
- ssh-keyscan -H -p 10022 143.93.59.178 >> /root/.ssh/known_hosts
- cp /ssh/id_rsa /root/.ssh/id_rsa
- cp /ssh/id_rsa.pub /root/.ssh/id_rsa.pub
- chmod 600 /root/.ssh/id_rsa
- ./build_deps.sh linux
linux:
script:
- make clean
- premake5 --cc=clang gmake
- make clean
- make -j 7
tags:
- Linux
only:
- develop
allow_failure: true
allow_failure: false
// 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/
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
# FSI-Lizenz
Copyright © 2015 Johannes Kirchner, Michael Ochmann, Jeremias Boos,
Copyright © 2015 Benjamin Albsmeier, Johannes Kirchner, Michael Ochmann, Jeremias Boos,
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,
......
......@@ -9,6 +9,7 @@ namespace gdw {
class audio;
class graphics_system;
class rendering_system;
class game_state_machine;
}
namespace gdw {
......@@ -20,6 +21,7 @@ namespace gdw {
std::unique_ptr<gdw::audio> audio_;
std::unique_ptr<gdw::graphics_system> graphics_system_;
std::unique_ptr<gdw::rendering_system> rendering_system_;
std::unique_ptr<gdw::game_state_machine> game_state_machine_;
// needs to be the last one that will be destroyed
gdw::entity_manager entity_manager_;
......@@ -64,6 +66,10 @@ namespace gdw {
gdw::rendering_system& rendering_system() noexcept {
return *rendering_system_;
}
gdw::game_state_machine& game_state_machine() noexcept {
return *game_state_machine_;
}
};
}
......
......@@ -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 play_state : public game_state {
public:
play_state(engine& engine);
~play_state();
void update(float dt);
void on_enter();
void on_exit();
};
} //Namespace gdw
#endif
#ifndef COLLISION_COMPONENT_
#define COLLISION_COMPONENT_
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);
~collision_shape();
};
}
#endif
\ No newline at end of file
#ifndef RAY_
#define RAY_
namespace gdw{
class ray(glm::vec3 source, glm::vec3 destination):collision_shape(){
vec3 source;
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
#ifndef __GDW_RENDERING_SYSTEM_HPP__
#define __GDW_RENDERING_SYSTEM_HPP__
#include <vector>
#include <glm/glm.hpp>
#include <graphics/program.hpp>
......@@ -9,6 +11,7 @@
namespace gdw {
class engine;
class staticmesh_component;
}
namespace gdw {
......@@ -21,6 +24,10 @@ namespace gdw {
gdw::mesh_manager mesh_manager_;
program staticmesh_program_;
std::vector<staticmesh_component*> staticmesh_components_;
friend class staticmesh_component;
public:
rendering_system(engine& engine);
~rendering_system() = default;
......@@ -32,6 +39,7 @@ namespace gdw {
rendering_system& operator=(rendering_system&&) = default;
void update(float delta_time);
void render_gbuffer(float delta_time);
vertex_layout& staticmesh_layout() noexcept {
return staticmesh_layout_;
......@@ -40,6 +48,10 @@ namespace gdw {
gdw::mesh_manager& mesh_manager() noexcept {
return mesh_manager_;
}
private:
void register_component(staticmesh_component* component);
void unregister_component(staticmesh_component* component);
};
}
......
#ifndef __GDW_STATICMESH_COMPONENT_HPP__
#define __GDW_STATICMESH_COMPONENT_HPP__
#include <memory>
#include <ecs/component.hpp>
#include <util/id.hpp>
namespace gdw {
class engine;
class entity;
class mesh;
}
namespace gdw {
class staticmesh_component : public component {
private:
std::shared_ptr<const gdw::mesh> mesh_;
public:
staticmesh_component(engine& engine, entity& owner, const std::string& filename);
~staticmesh_component() noexcept;
staticmesh_component(const staticmesh_component&) = delete;
staticmesh_component& operator=(const staticmesh_component&) = delete;
staticmesh_component(staticmesh_component&&) = default;
staticmesh_component& operator=(staticmesh_component&&) = default;
const gdw::mesh& mesh() const {
return *mesh_;
}
static unsigned long long type_id() {
return gdw::type_id<gdw::staticmesh_component>();
}
};
}
#endif
#ifndef __GDW_COMPONENT_HELPER_HPP__
#define __GDW_COMPONENT_HELPER_HPP__
#include <vector>
namespace gdw {
template <typename container, typename t>
void remove_component(container& c, t* component) {
auto it = std::find(c.begin(), c.end(), component);
if (it != c.end()) {
c.erase(it);
}
}
}
#endif
#ifndef __LIST_HELPER__
#define __LIST_HELPER__
#include <vector>
#include <list>
#include <algorithm>
namespace gdw {
namespace list_helper {
/** Searches for an element in a given vector.
* Returns true, when found.
*/
template<typename T>
bool findElement(std::vector<T> &vector, T elem) {
auto it = std::find(vector.begin(), vector.end(), elem);
return it != vector.end();
}
template<typename T>
bool findElement(std::list<T> &list, T elem) {
auto it = std::find(list.begin(), list.end(), elem);
return it != list.end();
}
/** Searches for an element in a given vector and removes it.
* Does not respect insertion order.
* Returns true, when found and removed, otherwise false.
*/
template<typename T>
bool removeElement(std::vector<T> &vector, const T& elem) {
auto it = std::find(vector.begin(), vector.end(), elem);
if(it == vector.end())
return false;
auto last = vector.end() -1;
if(it != last)
*it = *last;
vector.pop_back();
return true;
}
} //Namespace List
} // Namespace Util
#endif
Markdown is supported
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