fix: input module static analysis errors
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/pr Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/pr Build is failing
				
			This commit is contained in:
		
							parent
							
								
									9c628b1e68
								
							
						
					
					
						commit
						d8b9fd77a5
					
				
					 5 changed files with 100 additions and 37 deletions
				
			
		|  | @ -24,9 +24,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(SetChar); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::SetChar; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | KeyboardEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const unsigned int m_character; | ||||
|  |  | |||
|  | @ -34,18 +34,6 @@ enum EventCategory : uint8_t | |||
| 	MouseEventCategory = bit(3), | ||||
| }; | ||||
| 
 | ||||
| #define event_type(type)                      \ | ||||
| 	EventType get_event_type() const override \ | ||||
| 	{                                         \ | ||||
| 		return ::lt::EventType::type;         \ | ||||
| 	} | ||||
| 
 | ||||
| #define event_category(eCategory)                                   \ | ||||
| 	inline bool has_category(EventCategory category) const override \ | ||||
| 	{                                                               \ | ||||
| 		return (eCategory) & category;                              \ | ||||
| 	} | ||||
| 
 | ||||
| class Event | ||||
| { | ||||
| public: | ||||
|  |  | |||
|  | @ -29,7 +29,10 @@ public: | |||
| 		return ::lt::EventType::KeyPressed; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | KeyboardEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const int m_key; | ||||
|  | @ -54,9 +57,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(KeyRepeated); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::KeyRepeated; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | KeyboardEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const int m_key; | ||||
|  | @ -81,9 +90,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(KeyReleased); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::KeyReleased; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | KeyboardEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const int m_key; | ||||
|  |  | |||
|  | @ -35,9 +35,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(MouseMoved); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::MouseMoved; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | MouseEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const glm::vec2 m_position; | ||||
|  | @ -62,9 +68,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(WheelScrolled); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::WheelScrolled; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | MouseEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const float m_offset; | ||||
|  | @ -89,9 +101,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(ButtonPressed); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::ButtonPressed; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | MouseEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const int m_button; | ||||
|  | @ -116,9 +134,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(ButtonReleased); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::ButtonReleased; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | MouseEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const int m_button; | ||||
|  |  | |||
|  | @ -14,9 +14,15 @@ public: | |||
| 		return "WindowClosedEvent"; | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(WindowClosed); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::WindowClosed; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(WindowEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(WindowEventCategory) & category; | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| class WindowMovedEvent: public Event | ||||
|  | @ -39,9 +45,15 @@ public: | |||
| 		; | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(WindowMoved); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::WindowMoved; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(WindowEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(WindowEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const glm::ivec2 m_position; | ||||
|  | @ -66,9 +78,15 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(WindowResized); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::WindowResized; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(WindowEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(WindowEventCategory) & category; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	const glm::uvec2 m_size; | ||||
|  | @ -82,9 +100,15 @@ public: | |||
| 		return "WindowLostFocus"; | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(WindowLostFocus); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::WindowLostFocus; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(WindowEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(WindowEventCategory) & category; | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| class WindowGainFocusEvent: public Event | ||||
|  | @ -95,9 +119,15 @@ public: | |||
| 		return "WindowGainFocus"; | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(WindowGainFocus); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::WindowGainFocus; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(WindowEventCategory); | ||||
| 	[[nodiscard]] auto has_category(EventCategory category) const -> bool override | ||||
| 	{ | ||||
| 		return static_cast<uint8_t>(WindowEventCategory) & category; | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| } // namespace lt
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue