From 48015cd425b26eb68eb07f4e4b1adf71e81e11b1 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Mon, 25 Nov 2024 11:48:39 +0100 Subject: make format --- src/crepe/api/Button.cpp | 2 +- src/crepe/api/Button.h | 28 ++--- src/crepe/api/Event.h | 6 +- src/crepe/api/KeyCodes.h | 284 +++++++++++++++++++++--------------------- src/crepe/api/LoopManager.cpp | 6 +- src/crepe/api/UiObject.h | 16 +-- 6 files changed, 170 insertions(+), 172 deletions(-) (limited to 'src/crepe/api') diff --git a/src/crepe/api/Button.cpp b/src/crepe/api/Button.cpp index 70f749d..547c0fc 100644 --- a/src/crepe/api/Button.cpp +++ b/src/crepe/api/Button.cpp @@ -2,4 +2,4 @@ using namespace crepe; -Button::Button(game_object_id_t id) : UiObject(id){} +Button::Button(game_object_id_t id) : UiObject(id) {} diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h index f769d58..0056238 100644 --- a/src/crepe/api/Button.h +++ b/src/crepe/api/Button.h @@ -12,33 +12,33 @@ namespace crepe { */ class Button : public UiObject { public: - /** + /** * \brief Constructs a Button with the specified game object ID. * \param id The unique ID of the game object associated with this button. */ - Button(game_object_id_t id); + Button(game_object_id_t id); - //! Indicates if the button is interactable (can be clicked). - bool interactable = true; + //! Indicates if the button is interactable (can be clicked). + bool interactable = true; - //! Indicates if the button is a toggle button (can be pressed and released). - bool is_toggle = false; + //! Indicates if the button is a toggle button (can be pressed and released). + bool is_toggle = false; - //! Indicates whether the button is currently pressed. - bool is_pressed = false; + //! Indicates whether the button is currently pressed. + bool is_pressed = false; - //! Indicates whether the mouse is currently hovering over the button. - bool hover = false; + //! Indicates whether the mouse is currently hovering over the button. + bool hover = false; - //! The callback function to be executed when the button is clicked. - std::function on_click; + //! The callback function to be executed when the button is clicked. + std::function on_click; public: - /** + /** * \brief Retrieves the maximum number of instances allowed for this button type. * \return Always returns 1, as only a single instance is allowed. */ - virtual int get_instances_max() const override { return 1; } + virtual int get_instances_max() const override { return 1; } }; } // namespace crepe diff --git a/src/crepe/api/Event.h b/src/crepe/api/Event.h index 46dd86b..2018d52 100644 --- a/src/crepe/api/Event.h +++ b/src/crepe/api/Event.h @@ -89,9 +89,9 @@ public: //! Y-coordinate of the mouse position at the time of the event. int mouse_y = 0; // Relative movement in x - int rel_x; + int rel_x; // Relative movement in y - int rel_y; + int rel_y; }; /** @@ -127,4 +127,4 @@ class ShutDownEvent : public Event { public: }; -} +} // namespace crepe diff --git a/src/crepe/api/KeyCodes.h b/src/crepe/api/KeyCodes.h index 4b026c5..fcfc080 100644 --- a/src/crepe/api/KeyCodes.h +++ b/src/crepe/api/KeyCodes.h @@ -1,154 +1,154 @@ #pragma once namespace crepe { - //! Enumeration for mouse button inputs, including standard and extended buttons. - enum class MouseButton { - NONE = 0, //!< No mouse button input. - LEFT_MOUSE = 1, //!< Left mouse button. - RIGHT_MOUSE = 2, //!< Right mouse button. - MIDDLE_MOUSE = 3, //!< Middle mouse button (scroll wheel press). - X1_MOUSE = 4, //!< First extended mouse button. - X2_MOUSE = 5, //!< Second extended mouse button. - SCROLL_UP = 6, //!< Scroll wheel upward movement. - SCROLL_DOWN = 7, //!< Scroll wheel downward movement. - }; +//! Enumeration for mouse button inputs, including standard and extended buttons. +enum class MouseButton { + NONE = 0, //!< No mouse button input. + LEFT_MOUSE = 1, //!< Left mouse button. + RIGHT_MOUSE = 2, //!< Right mouse button. + MIDDLE_MOUSE = 3, //!< Middle mouse button (scroll wheel press). + X1_MOUSE = 4, //!< First extended mouse button. + X2_MOUSE = 5, //!< Second extended mouse button. + SCROLL_UP = 6, //!< Scroll wheel upward movement. + SCROLL_DOWN = 7, //!< Scroll wheel downward movement. +}; - //! Enumeration for keyboard key inputs, including printable characters, function keys, and keypad keys. - enum class Keycode { - NONE = 0, //!< No key input. - SPACE = 32, //!< Spacebar. - APOSTROPHE = 39, //!< Apostrophe ('). - COMMA = 44, //!< Comma (,). - MINUS = 45, //!< Minus (-). - PERIOD = 46, //!< Period (.). - SLASH = 47, //!< Slash (/). - D0 = 48, //!< Digit 0. - D1 = 49, //!< Digit 1. - D2 = 50, //!< Digit 2. - D3 = 51, //!< Digit 3. - D4 = 52, //!< Digit 4. - D5 = 53, //!< Digit 5. - D6 = 54, //!< Digit 6. - D7 = 55, //!< Digit 7. - D8 = 56, //!< Digit 8. - D9 = 57, //!< Digit 9. - SEMICOLON = 59, //!< Semicolon (;). - EQUAL = 61, //!< Equal sign (=). - A = 65, //!< Key 'A'. - B = 66, //!< Key 'B'. - C = 67, //!< Key 'C'. - D = 68, //!< Key 'D'. - E = 69, //!< Key 'E'. - F = 70, //!< Key 'F'. - G = 71, //!< Key 'G'. - H = 72, //!< Key 'H'. - I = 73, //!< Key 'I'. - J = 74, //!< Key 'J'. - K = 75, //!< Key 'K'. - L = 76, //!< Key 'L'. - M = 77, //!< Key 'M'. - N = 78, //!< Key 'N'. - O = 79, //!< Key 'O'. - P = 80, //!< Key 'P'. - Q = 81, //!< Key 'Q'. - R = 82, //!< Key 'R'. - S = 83, //!< Key 'S'. - T = 84, //!< Key 'T'. - U = 85, //!< Key 'U'. - V = 86, //!< Key 'V'. - W = 87, //!< Key 'W'. - X = 88, //!< Key 'X'. - Y = 89, //!< Key 'Y'. - Z = 90, //!< Key 'Z'. - LEFT_BRACKET = 91, //!< Left bracket ([). - BACKSLASH = 92, //!< Backslash (\). - RIGHT_BRACKET = 93, //!< Right bracket (]). - GRAVE_ACCENT = 96, //!< Grave accent (`). - WORLD1 = 161, //!< Non-US key #1. - WORLD2 = 162, //!< Non-US key #2. - ESCAPE = 256, //!< Escape key. - ENTER = 257, //!< Enter key. - TAB = 258, //!< Tab key. - BACKSPACE = 259, //!< Backspace key. - INSERT = 260, //!< Insert key. - DELETE = 261, //!< Delete key. - RIGHT = 262, //!< Right arrow key. - LEFT = 263, //!< Left arrow key. - DOWN = 264, //!< Down arrow key. - UP = 265, //!< Up arrow key. - PAGE_UP = 266, //!< Page Up key. - PAGE_DOWN = 267, //!< Page Down key. - HOME = 268, //!< Home key. - END = 269, //!< End key. - CAPS_LOCK = 280, //!< Caps Lock key. - SCROLL_LOCK = 281, //!< Scroll Lock key. - NUM_LOCK = 282, //!< Num Lock key. - PRINT_SCREEN = 283, //!< Print Screen key. - PAUSE = 284, //!< Pause key. - /** +//! Enumeration for keyboard key inputs, including printable characters, function keys, and keypad keys. +enum class Keycode { + NONE = 0, //!< No key input. + SPACE = 32, //!< Spacebar. + APOSTROPHE = 39, //!< Apostrophe ('). + COMMA = 44, //!< Comma (,). + MINUS = 45, //!< Minus (-). + PERIOD = 46, //!< Period (.). + SLASH = 47, //!< Slash (/). + D0 = 48, //!< Digit 0. + D1 = 49, //!< Digit 1. + D2 = 50, //!< Digit 2. + D3 = 51, //!< Digit 3. + D4 = 52, //!< Digit 4. + D5 = 53, //!< Digit 5. + D6 = 54, //!< Digit 6. + D7 = 55, //!< Digit 7. + D8 = 56, //!< Digit 8. + D9 = 57, //!< Digit 9. + SEMICOLON = 59, //!< Semicolon (;). + EQUAL = 61, //!< Equal sign (=). + A = 65, //!< Key 'A'. + B = 66, //!< Key 'B'. + C = 67, //!< Key 'C'. + D = 68, //!< Key 'D'. + E = 69, //!< Key 'E'. + F = 70, //!< Key 'F'. + G = 71, //!< Key 'G'. + H = 72, //!< Key 'H'. + I = 73, //!< Key 'I'. + J = 74, //!< Key 'J'. + K = 75, //!< Key 'K'. + L = 76, //!< Key 'L'. + M = 77, //!< Key 'M'. + N = 78, //!< Key 'N'. + O = 79, //!< Key 'O'. + P = 80, //!< Key 'P'. + Q = 81, //!< Key 'Q'. + R = 82, //!< Key 'R'. + S = 83, //!< Key 'S'. + T = 84, //!< Key 'T'. + U = 85, //!< Key 'U'. + V = 86, //!< Key 'V'. + W = 87, //!< Key 'W'. + X = 88, //!< Key 'X'. + Y = 89, //!< Key 'Y'. + Z = 90, //!< Key 'Z'. + LEFT_BRACKET = 91, //!< Left bracket ([). + BACKSLASH = 92, //!< Backslash (\). + RIGHT_BRACKET = 93, //!< Right bracket (]). + GRAVE_ACCENT = 96, //!< Grave accent (`). + WORLD1 = 161, //!< Non-US key #1. + WORLD2 = 162, //!< Non-US key #2. + ESCAPE = 256, //!< Escape key. + ENTER = 257, //!< Enter key. + TAB = 258, //!< Tab key. + BACKSPACE = 259, //!< Backspace key. + INSERT = 260, //!< Insert key. + DELETE = 261, //!< Delete key. + RIGHT = 262, //!< Right arrow key. + LEFT = 263, //!< Left arrow key. + DOWN = 264, //!< Down arrow key. + UP = 265, //!< Up arrow key. + PAGE_UP = 266, //!< Page Up key. + PAGE_DOWN = 267, //!< Page Down key. + HOME = 268, //!< Home key. + END = 269, //!< End key. + CAPS_LOCK = 280, //!< Caps Lock key. + SCROLL_LOCK = 281, //!< Scroll Lock key. + NUM_LOCK = 282, //!< Num Lock key. + PRINT_SCREEN = 283, //!< Print Screen key. + PAUSE = 284, //!< Pause key. + /** * \name Function keys (F1-F25). * \{ */ - F1 = 290, - F2 = 291, - F3 = 292, - F4 = 293, - F5 = 294, - F6 = 295, - F7 = 296, - F8 = 297, - F9 = 298, - F10 = 299, - F11 = 300, - F12 = 301, - F13 = 302, - F14 = 303, - F15 = 304, - F16 = 305, - F17 = 306, - F18 = 307, - F19 = 308, - F20 = 309, - F21 = 310, - F22 = 311, - F23 = 312, - F24 = 313, - F25 = 314, - /// \} - /** + F1 = 290, + F2 = 291, + F3 = 292, + F4 = 293, + F5 = 294, + F6 = 295, + F7 = 296, + F8 = 297, + F9 = 298, + F10 = 299, + F11 = 300, + F12 = 301, + F13 = 302, + F14 = 303, + F15 = 304, + F16 = 305, + F17 = 306, + F18 = 307, + F19 = 308, + F20 = 309, + F21 = 310, + F22 = 311, + F23 = 312, + F24 = 313, + F25 = 314, + /// \} + /** * \name Keypad digits and operators. * \{ */ - KP0 = 320, - KP1 = 321, - KP2 = 322, - KP3 = 323, - KP4 = 324, - KP5 = 325, - KP6 = 326, - KP7 = 327, - KP8 = 328, - KP9 = 329, - KP_DECIMAL = 330, - KP_DIVIDE = 331, - KP_MULTIPLY = 332, - KP_SUBTRACT = 333, - KP_ADD = 334, - KP_ENTER = 335, - KP_EQUAL = 336, - /// \} - /** + KP0 = 320, + KP1 = 321, + KP2 = 322, + KP3 = 323, + KP4 = 324, + KP5 = 325, + KP6 = 326, + KP7 = 327, + KP8 = 328, + KP9 = 329, + KP_DECIMAL = 330, + KP_DIVIDE = 331, + KP_MULTIPLY = 332, + KP_SUBTRACT = 333, + KP_ADD = 334, + KP_ENTER = 335, + KP_EQUAL = 336, + /// \} + /** * \name Modifier keys. * \{ */ - LEFT_SHIFT = 340, - LEFT_CONTROL = 341, - LEFT_ALT = 342, - LEFT_SUPER = 343, - RIGHT_SHIFT = 344, - RIGHT_CONTROL = 345, - RIGHT_ALT = 346, - RIGHT_SUPER = 347, - /// \} - MENU = 348, //!< Menu key. - }; -} + LEFT_SHIFT = 340, + LEFT_CONTROL = 341, + LEFT_ALT = 342, + LEFT_SUPER = 343, + RIGHT_SHIFT = 344, + RIGHT_CONTROL = 345, + RIGHT_ALT = 346, + RIGHT_SUPER = 347, + /// \} + MENU = 348, //!< Menu key. +}; +} // namespace crepe diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index 9599943..b343250 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -2,11 +2,11 @@ #include "../system/AnimatorSystem.h" #include "../system/CollisionSystem.h" +#include "../system/InputSystem.h" #include "../system/ParticleSystem.h" #include "../system/PhysicsSystem.h" #include "../system/RenderSystem.h" #include "../system/ScriptSystem.h" -#include "../system/InputSystem.h" #include "LoopManager.h" #include "LoopTimer.h" @@ -24,9 +24,7 @@ LoopManager::LoopManager() { this->load_system(); } -void LoopManager::process_input() { - this->get_system().update(); -} +void LoopManager::process_input() { this->get_system().update(); } void LoopManager::start() { this->setup(); diff --git a/src/crepe/api/UiObject.h b/src/crepe/api/UiObject.h index ae2e744..7bd1c2e 100644 --- a/src/crepe/api/UiObject.h +++ b/src/crepe/api/UiObject.h @@ -10,24 +10,24 @@ namespace crepe { */ class UiObject : public Component { public: - /** + /** * \brief Constructs a UiObject with the specified game object ID. * \param id The unique ID of the game object associated with this UI object. */ - UiObject(game_object_id_t id); + UiObject(game_object_id_t id); - //! The width of the UI object. - int width = 0; + //! The width of the UI object. + int width = 0; - //! The height of the UI object. - int height = 0; + //! The height of the UI object. + int height = 0; public: - /** + /** * \brief Retrieves the maximum number of instances allowed for this UI object type. * /return Always returns 1, as only a single instance is allowed. */ - virtual int get_instances_max() const override { return 1; } + virtual int get_instances_max() const override { return 1; } }; } // namespace crepe -- cgit v1.2.3