Add controls to readme

This commit is contained in:
2023-07-02 22:16:28 +02:00
parent 125e19e0be
commit aa3dd28fb3
3 changed files with 13 additions and 12 deletions

View File

@@ -1,3 +1,13 @@
A work in progress game engine written in C++ using OpenGL and [entt](https://github.com/skypjack/entt). A work in progress game engine written in C++ using OpenGL and [entt](https://github.com/skypjack/entt).
![A screenshot](screenshot.png) ![A screenshot](screenshot.png)
## Controls
| Button | Action |
| ------------ | -------------------------- |
| W, A, S, D | Horizontal Camera Movement |
| Left Shift | Camera Down |
| Space | Camera Up |
| Left Alt | Accelerate |
| Left Control | Catch Mouse |
| Escape | Quit |

View File

@@ -9,7 +9,8 @@ using namespace entt::literals;
Controller::Controller() Controller::Controller()
{ {
std::filesystem::path document_path("WaterBottle/glTF-Binary/WaterBottle.glb"); std::filesystem::path document_path("ABeautifulGame.glb");
// std::filesystem::path document_path("WaterBottle/glTF-Binary/WaterBottle.glb");
entt::hashed_string document_hash(document_path.string().c_str()); entt::hashed_string document_hash(document_path.string().c_str());
entt::resource<Gltf> gltf_document = entt::resource<Gltf> gltf_document =

View File

@@ -107,17 +107,7 @@ auto Window::physical_dimensions() const -> glm::u32vec2
void Window::mouse_catching(entt::registry& registry) const void Window::mouse_catching(entt::registry& registry) const
{ {
if (!registry.ctx().contains<MouseCatched>()) { auto& mouse_catched = registry.ctx().emplace<MouseCatched>(MouseCatched{.catched = false});
bool catched = true;
#ifndef NDEBUG
catched = false;
#endif
registry.ctx().emplace<MouseCatched>(MouseCatched{.catched = catched});
}
auto& mouse_catched = registry.ctx().get<MouseCatched>();
auto const& key_state = registry.ctx().get<Input::State<Input::KeyCode>>(); auto const& key_state = registry.ctx().get<Input::State<Input::KeyCode>>();
if (key_state.just_pressed(Input::KeyCode{GLFW_KEY_LEFT_CONTROL})) { if (key_state.just_pressed(Input::KeyCode{GLFW_KEY_LEFT_CONTROL})) {