Add controls to readme
This commit is contained in:
10
README.md
10
README.md
@@ -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).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## 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 |
|
||||||
|
|||||||
@@ -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 =
|
||||||
|
|||||||
@@ -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})) {
|
||||||
|
|||||||
Reference in New Issue
Block a user