-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from KTStephano/v0.9
V0.9 -> Master
- Loading branch information
Showing
695 changed files
with
6,242 additions
and
2,937 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
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,7 +1,30 @@ | ||
find_package(OpenGL REQUIRED) | ||
|
||
set(ROOT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../) | ||
|
||
include_directories( | ||
${ROOT_DIRECTORY}/gl3w/include | ||
${ROOT_DIRECTORY} | ||
${ROOT_DIRECTORY}/Source/Engine/ | ||
${CMAKE_CURRENT_LIST_DIR} | ||
${OPENGL_INCLUDE_DIRS} | ||
${ROOT_DIRECTORY}/assimp/Deploy/include | ||
${ROOT_DIRECTORY}/SDL2/include | ||
) | ||
|
||
link_directories(${ROOT_DIRECTORY}/Bin) | ||
|
||
include_directories(${CMAKE_CURRENT_LIST_DIR}/Common) | ||
file(GLOB COMMON_SOURCES ${CMAKE_CURRENT_LIST_DIR}/Common/*.cpp) | ||
|
||
set(OUTPUT_DIRECTORY ${ROOT_DIRECTORY}/Bin/) | ||
|
||
add_subdirectory(ExampleEnv00) | ||
add_subdirectory(ExampleEnv01) | ||
add_subdirectory(ExampleEnv02) | ||
add_subdirectory(ExampleEnv03) | ||
add_subdirectory(ExampleEnv03) | ||
add_subdirectory(ExampleEnv04) | ||
add_subdirectory(ExampleEnv05) | ||
add_subdirectory(ExampleEnv06) | ||
add_subdirectory(ExampleEnv07) | ||
add_subdirectory(ExampleEnv08) |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
|
||
#include "StratusCommon.h" | ||
#include "glm/glm.hpp" | ||
#include "StratusWindow.h" | ||
#include "StratusRendererFrontend.h" | ||
#include "StratusLog.h" | ||
#include "StratusCamera.h" | ||
#include "StratusLight.h" | ||
|
||
struct FrameRateController : public stratus::InputHandler { | ||
FrameRateController() { | ||
INSTANCE(RendererFrontend)->SetVsyncEnabled(true); | ||
// 1000 fps is just to get the engine out of the way so SDL can control it with vsync | ||
_frameRates = {1000, 55, 50, 45, 40, 35, 30}; | ||
INSTANCE(Engine)->SetMaxFrameRate(_frameRates[0]); | ||
} | ||
|
||
// This class is deleted when the Window is deleted so the Renderer has likely already | ||
// been taken offline. The check is for if the camera controller is removed while the engine | ||
// is still running. | ||
virtual ~FrameRateController() {} | ||
|
||
void HandleInput(const stratus::MouseState& mouse, const std::vector<SDL_Event>& input, const double deltaSeconds) { | ||
const float camSpeed = 100.0f; | ||
|
||
// Handle WASD movement | ||
for (auto e : input) { | ||
switch (e.type) { | ||
case SDL_KEYDOWN: | ||
case SDL_KEYUP: { | ||
bool released = e.type == SDL_KEYUP; | ||
SDL_Scancode key = e.key.keysym.scancode; | ||
switch (key) { | ||
// Why M? Because F is used for flash light and R is recompile :( | ||
case SDL_SCANCODE_M: | ||
if (released) { | ||
_frameRateIndex = (_frameRateIndex + 1) % _frameRates.size(); | ||
INSTANCE(Engine)->SetMaxFrameRate(_frameRates[_frameRateIndex]); | ||
STRATUS_LOG << "Max Frame Rate Toggled: " << _frameRates[_frameRateIndex] << std::endl; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private: | ||
size_t _frameRateIndex = 0; | ||
std::vector<uint32_t> _frameRates; | ||
}; |
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
Oops, something went wrong.