2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 00:17:13 +00:00

Start implementing input

This commit is contained in:
2022-02-07 02:45:56 -08:00
parent 710b9ae6b3
commit 72502ec9a2
5 changed files with 196 additions and 66 deletions

View File

@@ -6,6 +6,8 @@
#include <cinttypes>
namespace aurora {
enum class SpecialKey : std::uint8_t;
struct WindowSize;
struct App;
@@ -25,6 +27,12 @@ struct AppDelegate {
virtual void onAppWindowMoved(std::int32_t x, std::int32_t y) noexcept = 0;
virtual void onAppExiting() noexcept = 0;
// Input
virtual void onCharKeyDown(std::uint8_t charCode, bool is_repeat) noexcept = 0;
virtual void onCharKeyUp(std::uint8_t charCode) noexcept = 0;
virtual void onSpecialKeyDown(const SpecialKey& key, bool is_repeat) noexcept = 0;
virtual void onSpecialKeyUp(const SpecialKey& key) noexcept = 0;
// virtual void resized([[maybe_unused]] const WindowSize& rect, [[maybe_unused]] bool sync) noexcept {}
// virtual void mouseDown([[maybe_unused]] const SWindowCoord& coord, [[maybe_unused]] EMouseButton button,
// [[maybe_unused]] EModifierKey mods) noexcept {}

View File

@@ -9,4 +9,9 @@ void App_onAppPostDraw(AppDelegate& cb) noexcept;
void App_onAppWindowResized(AppDelegate& cb, const WindowSize& size) noexcept;
void App_onAppWindowMoved(AppDelegate& cb, std::int32_t x, std::int32_t y) noexcept;
void App_onAppExiting(AppDelegate& cb) noexcept;
// Input
void App_onCharKeyDown(AppDelegate& cb, std::uint8_t code, bool is_repeat) noexcept;
void App_onCharKeyUp(AppDelegate& cb, std::uint8_t code) noexcept;
void App_onSpecialKeyDown(AppDelegate& cb, const SpecialKey& key, bool is_repeat);
void App_onSpecialKeyUp(AppDelegate& cb, const SpecialKey& key);
} // namespace aurora