91 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <format>
 | |
| 
 | |
| namespace lt::surface {
 | |
| 
 | |
| class KeyPressedEvent
 | |
| {
 | |
| public:
 | |
| 	KeyPressedEvent(uint32_t key): m_key(key)
 | |
| 	{
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto get_key() const -> uint32_t
 | |
| 	{
 | |
| 		return m_key;
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto to_string() const -> std::string
 | |
| 	{
 | |
| 		return std::format("KeyPressed: {}", m_key);
 | |
| 	}
 | |
| 
 | |
| private:
 | |
| 	uint32_t m_key;
 | |
| };
 | |
| 
 | |
| class KeyRepeatEvent
 | |
| {
 | |
| public:
 | |
| 	KeyRepeatEvent(int key): m_key(key)
 | |
| 	{
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto get_key() const -> uint32_t
 | |
| 	{
 | |
| 		return m_key;
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto to_string() const -> std::string
 | |
| 	{
 | |
| 		return std::format("KeyRepeated: {}", m_key);
 | |
| 	}
 | |
| 
 | |
| private:
 | |
| 	uint32_t m_key;
 | |
| };
 | |
| 
 | |
| class KeyReleasedEvent
 | |
| {
 | |
| public:
 | |
| 	KeyReleasedEvent(uint32_t key): m_key(key)
 | |
| 	{
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto get_key() const -> uint32_t
 | |
| 	{
 | |
| 		return m_key;
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto to_string() const -> std::string
 | |
| 	{
 | |
| 		return std::format("KeyReleased: {}", m_key);
 | |
| 	}
 | |
| 
 | |
| private:
 | |
| 	uint32_t m_key;
 | |
| };
 | |
| 
 | |
| class KeySetCharEvent
 | |
| {
 | |
| public:
 | |
| 	KeySetCharEvent(uint32_t character): m_character(character)
 | |
| 	{
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto get_character() const -> uint32_t
 | |
| 	{
 | |
| 		return m_character;
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] auto to_string() const -> std::string
 | |
| 	{
 | |
| 		return std::format("KeyCharSet: {}", m_character);
 | |
| 	}
 | |
| 
 | |
| private:
 | |
| 	uint32_t m_character;
 | |
| };
 | |
| 
 | |
| } // namespace lt::surface
 |