-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
134 changed files
with
3,045 additions
and
3,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Language: Cpp | ||
BasedOnStyle: LLVM | ||
IndentWidth: 4 | ||
|
||
BreakBeforeBraces: Stroustrup | ||
FixNamespaceComments: true | ||
IndentCaseLabels: true | ||
NamespaceIndentation: None | ||
|
||
BreakConstructorInitializersBeforeComma: true | ||
|
||
AllowShortFunctionsOnASingleLine: None | ||
|
||
ColumnLimit: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,58 @@ | ||
#ifndef APPLICATION_H_INCLUDED | ||
#define APPLICATION_H_INCLUDED | ||
|
||
#include <vector> | ||
#include <memory> | ||
#include <vector> | ||
|
||
#include "States/StateBase.h" | ||
#include "Renderer/RenderMaster.h" | ||
#include "States/StateBase.h" | ||
|
||
#include "Context.h" | ||
#include "Camera.h" | ||
#include "Context.h" | ||
|
||
float extern g_timeElapsed; | ||
|
||
class Application | ||
{ | ||
|
||
public: | ||
Application(const Config& config); | ||
class Application { | ||
|
||
public: | ||
Application(const Config &config); | ||
|
||
void runLoop(); | ||
void runLoop(); | ||
|
||
template<typename T, typename... Args> | ||
void pushState(Args&&... args) | ||
{ | ||
m_states.push_back(std::make_unique<T>(std::forward<Args>(args)...)); | ||
auto& s = m_states.back(); | ||
s->onOpen(); | ||
} | ||
template <typename T, typename... Args> void pushState(Args &&... args) | ||
{ | ||
m_states.push_back(std::make_unique<T>(std::forward<Args>(args)...)); | ||
auto &s = m_states.back(); | ||
s->onOpen(); | ||
} | ||
|
||
void popState(); | ||
void popState(); | ||
|
||
Camera& getCamera() { return m_camera; } | ||
Camera &getCamera() | ||
{ | ||
return m_camera; | ||
} | ||
|
||
const sf::Window& getWindow() const { return m_context.window; } | ||
const sf::Window &getWindow() const | ||
{ | ||
return m_context.window; | ||
} | ||
|
||
void turnOffMouse(); | ||
void turnOnMouse (); | ||
void turnOffMouse(); | ||
void turnOnMouse(); | ||
|
||
private: | ||
void handleEvents(); | ||
private: | ||
void handleEvents(); | ||
|
||
std::vector<std::unique_ptr<StateBase>> m_states; | ||
std::vector<std::unique_ptr<StateBase>> m_states; | ||
|
||
Context m_context; | ||
RenderMaster m_masterRenderer; | ||
Camera m_camera; | ||
Context m_context; | ||
RenderMaster m_masterRenderer; | ||
Camera m_camera; | ||
|
||
const Config& m_config; | ||
const Config &m_config; | ||
|
||
bool m_isPopState = false; | ||
bool m_isPopState = false; | ||
}; | ||
|
||
#endif // APPLICATION_H_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,34 @@ | ||
#ifndef CAMERA_H_INCLUDED | ||
#define CAMERA_H_INCLUDED | ||
|
||
#include "Maths/glm.h" | ||
#include "Maths/Frustum.h" | ||
#include "Entity.h" | ||
#include "Config.h" | ||
#include "Entity.h" | ||
#include "Maths/Frustum.h" | ||
#include "Maths/glm.h" | ||
|
||
class Camera : public Entity | ||
{ | ||
public: | ||
Camera(const Config& config) noexcept; | ||
|
||
void update() noexcept; | ||
void hookEntity(const Entity& entity) noexcept; | ||
|
||
const glm::mat4& getViewMatrix () const noexcept; | ||
const glm::mat4& getProjMatrix () const noexcept; | ||
const glm::mat4& getProjectionViewMatrix () const noexcept; | ||
class Camera : public Entity { | ||
public: | ||
Camera(const Config &config) noexcept; | ||
|
||
const ViewFrustum& getFrustum() const noexcept; | ||
void update() noexcept; | ||
void hookEntity(const Entity &entity) noexcept; | ||
|
||
private: | ||
const Entity* m_pEntity; | ||
const glm::mat4 &getViewMatrix() const noexcept; | ||
const glm::mat4 &getProjMatrix() const noexcept; | ||
const glm::mat4 &getProjectionViewMatrix() const noexcept; | ||
|
||
ViewFrustum m_frustum; | ||
const ViewFrustum &getFrustum() const noexcept; | ||
|
||
glm::mat4 m_projectionMatrix; | ||
glm::mat4 m_viewMatrix; | ||
glm::mat4 m_projViewMatrx; | ||
private: | ||
const Entity *m_pEntity; | ||
|
||
Config m_config; | ||
ViewFrustum m_frustum; | ||
|
||
glm::mat4 m_projectionMatrix; | ||
glm::mat4 m_viewMatrix; | ||
glm::mat4 m_projViewMatrx; | ||
|
||
Config m_config; | ||
}; | ||
|
||
#endif // CAMERA_H_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
#ifndef CONFIG_H_INCLUDED | ||
#define CONFIG_H_INCLUDED | ||
|
||
struct Config | ||
{ | ||
int windowX = 1280; | ||
int windowY = 720; | ||
bool isFullscreen = false; | ||
int renderDistance = 16; | ||
int fov = 90; | ||
struct Config { | ||
int windowX = 1280; | ||
int windowY = 720; | ||
bool isFullscreen = false; | ||
int renderDistance = 16; | ||
int fov = 90; | ||
}; | ||
|
||
#endif // CONFIG_H_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#include "Controller.h" | ||
|
||
//WIP | ||
// WIP | ||
/* | ||
glm::vec3 Controller::translateInput() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.