diff options
| author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-13 15:40:52 +0100 | 
|---|---|---|
| committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-13 15:40:52 +0100 | 
| commit | 9ce53b197953e66189febeaa434255b848647993 (patch) | |
| tree | 1f7a3ae029754399c1e5fd23ab1266caec163012 | |
| parent | 408eb1fb5932a683a65db79afed6a300e18db5c6 (diff) | |
make format
| -rw-r--r-- | src/crepe/api/Event.h | 4 | ||||
| -rw-r--r-- | src/crepe/api/EventManager.h | 1 | ||||
| -rw-r--r-- | src/crepe/api/KeyCodes.h | 118 | ||||
| -rw-r--r-- | src/example/events.cpp | 16 | 
4 files changed, 69 insertions, 70 deletions
| diff --git a/src/crepe/api/Event.h b/src/crepe/api/Event.h index 87c6068..cffa5da 100644 --- a/src/crepe/api/Event.h +++ b/src/crepe/api/Event.h @@ -1,8 +1,8 @@  #pragma once -#include <typeindex> +#include "KeyCodes.h"  #include <iostream>  #include <string> -#include "KeyCodes.h" +#include <typeindex>  class Event {  public: diff --git a/src/crepe/api/EventManager.h b/src/crepe/api/EventManager.h index 26539ce..e2665bd 100644 --- a/src/crepe/api/EventManager.h +++ b/src/crepe/api/EventManager.h @@ -254,4 +254,3 @@ void EventManager::unsubscribe(const EventHandler<EventType> & callback,  		}  	}  } - diff --git a/src/crepe/api/KeyCodes.h b/src/crepe/api/KeyCodes.h index 53be91b..1cb1a8a 100644 --- a/src/crepe/api/KeyCodes.h +++ b/src/crepe/api/KeyCodes.h @@ -1,25 +1,25 @@  #pragma once  enum class MouseButton { -	None = 0, -	Left_Mouse = 1, -	Right_Mouse = 2, -	Middle_Mouse = 3, -	X1_Mouse = 4, -	X2_Mouse = 5, -	Scroll_Up = 6, -	Scroll_Down = 7, +	NONE = 0, +	LEFT_MOUSE = 1, +	RIGHT_MOUSE = 2, +	MIDDLE_MOUSE = 3, +	X1_MOUSE = 4, +	X2_MOUSE = 5, +	SCROLL_UP = 6, +	SCROLL_DOWN = 7,  }; -enum class Keycode : int{ +enum class Keycode : int {  	// From glfw3.h -	None = 0, -	Space = 32, -	Apostrophe = 39, /* ' */ -	Comma = 44, /* , */ -	Minus = 45, /* - */ -	Period = 46, /* . */ -	Slash = 47, /* / */ +	NONE = 0, +	SPACE = 32, +	APOSTROPHE = 39, /* ' */ +	COMMA = 44, /* , */ +	MINUS = 45, /* - */ +	PERIOD = 46, /* . */ +	SLASH = 47, /* / */  	D0 = 48, /* 0 */  	D1 = 49, /* 1 */ @@ -32,8 +32,8 @@ enum class Keycode : int{  	D8 = 56, /* 8 */  	D9 = 57, /* 9 */ -	Semicolon = 59, /* ; */ -	Equal = 61, /* = */ +	SEMICOLON = 59, /* ; */ +	EQUAL = 61, /* = */  	A = 65,  	B = 66, @@ -62,34 +62,34 @@ enum class Keycode : int{  	Y = 89,  	Z = 90, -	LeftBracket = 91, /* [ */ -	Backslash = 92, /* \ */ -	RightBracket = 93, /* ] */ -	GraveAccent = 96, /* ` */ +	LEFT_BRACKET = 91, /* [ */ +	BACKSLASH = 92, /* \ */ +	RIGHT_BRACKET = 93, /* ] */ +	GRAVE_ACCENT = 96, /* ` */ -	World1 = 161, /* non-US #1 */ -	World2 = 162, /* non-US #2 */ +	WORLD1 = 161, /* non-US #1 */ +	WORLD2 = 162, /* non-US #2 */  	/* Function keys */ -	Escape = 256, -	Enter = 257, -	Tab = 258, -	Backspace = 259, -	Insert = 260, -	Delete = 261, -	Right = 262, -	Left = 263, -	Down = 264, -	Up = 265, -	PageUp = 266, -	PageDown = 267, -	Home = 268, -	End = 269, -	CapsLock = 280, -	ScrollLock = 281, -	NumLock = 282, -	PrintScreen = 283, -	Pause = 284, +	ESCAPE = 256, +	ENTER = 257, +	TAB = 258, +	BACKSPACE = 259, +	INSERT = 260, +	DELETE = 261, +	RIGHT = 262, +	LEFT = 263, +	DOWN = 264, +	UP = 265, +	PAGE_UP = 266, +	PAGE_DOWN = 267, +	HOME = 268, +	END = 269, +	CAPS_LOCK = 280, +	SCROLL_LOCK = 281, +	NUM_LOCK = 282, +	PRINT_SCREEN = 283, +	PAUSE = 284,  	F1 = 290,  	F2 = 291,  	F3 = 292, @@ -127,21 +127,21 @@ enum class Keycode : int{  	KP7 = 327,  	KP8 = 328,  	KP9 = 329, -	KPDecimal = 330, -	KPDivide = 331, -	KPMultiply = 332, -	KPSubtract = 333, -	KPAdd = 334, -	KPEnter = 335, -	KPEqual = 336, +	KP_DECIMAL = 330, +	KP_DIVIDE = 331, +	KP_MULTIPLY = 332, +	KP_SUBTRACT = 333, +	KP_ADD = 334, +	KP_ENTER = 335, +	KP_EQUAL = 336, -	LeftShift = 340, -	LeftControl = 341, -	LeftAlt = 342, -	LeftSuper = 343, -	RightShift = 344, -	RightControl = 345, -	RightAlt = 346, -	RightSuper = 347, -	Menu = 348 +	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  }; diff --git a/src/example/events.cpp b/src/example/events.cpp index 210c42c..51c9a37 100644 --- a/src/example/events.cpp +++ b/src/example/events.cpp @@ -4,16 +4,16 @@  #include <crepe/system/ScriptSystem.h>  #include <crepe/util/log.h> +#include <crepe/api/BehaviorScript.h> +#include <crepe/api/Config.h>  #include <crepe/api/Event.h>  #include <crepe/api/EventManager.h> +#include <crepe/api/GameObject.h>  #include <crepe/api/IKeyListener.h>  #include <crepe/api/IMouseListener.h> -#include <crepe/api/BehaviorScript.h> -#include <crepe/api/Config.h> -#include <crepe/api/GameObject.h> +#include <crepe/api/KeyCodes.h>  #include <crepe/api/Script.h>  #include <crepe/api/Transform.h> -#include <crepe/api/KeyCodes.h>  using namespace crepe;  using namespace std; @@ -54,13 +54,13 @@ class MyScript : public Script, public IKeyListener, public IMouseListener {  class TestKeyListener : public IKeyListener {  public:  	bool on_key_pressed(const KeyPressEvent & event) override { -		std::cout << "TestKeyListener: Key Pressed - Code: " << static_cast<int>(event.key) -				  << std::endl; +		std::cout << "TestKeyListener: Key Pressed - Code: " +				  << static_cast<int>(event.key) << std::endl;  		return true; // Return true if the listener should remain active  	}  	bool on_key_released(const KeyReleaseEvent & event) override { -		std::cout << "TestKeyListener: Key Released - Code: " << static_cast<int>(event.key) -				  << std::endl; +		std::cout << "TestKeyListener: Key Released - Code: " +				  << static_cast<int>(event.key) << std::endl;  		return true;  	}  }; |