Daniele Bartolini 11 yıl önce
ebeveyn
işleme
0ac80bce3f
3 değiştirilmiş dosya ile 63 ekleme ve 63 silme
  1. 15 15
      engine/input/keyboard.h
  2. 26 26
      engine/input/mouse.h
  3. 22 22
      engine/input/touch.h

+ 15 - 15
engine/input/keyboard.h

@@ -39,10 +39,10 @@ namespace crown
 struct Keyboard
 {
 	Keyboard()
-		: m_modifier(0), m_last_button(KeyboardButton::NONE)
+		: _modifier(0), _last_button(KeyboardButton::NONE)
 	{
-		memset(m_last_state, 0, KeyboardButton::COUNT);
-		memset(m_current_state, 0, KeyboardButton::COUNT);
+		memset(_last_state, 0, KeyboardButton::COUNT);
+		memset(_current_state, 0, KeyboardButton::COUNT);
 	}
 
 	/// Returns whether the specified @a modifier is pressed.
@@ -53,53 +53,53 @@ struct Keyboard
 	/// Crown currently supports three different modifier keys: Shift, Ctrl and Alt.
 	bool modifier_pressed(ModifierButton::Enum modifier) const
 	{
-		return (m_modifier & (uint8_t) modifier) == modifier;
+		return (_modifier & (uint8_t) modifier) == modifier;
 	}
 
 	/// Returns whether the specified @a b button is pressed in the current frame.
 	bool button_pressed(KeyboardButton::Enum b) const
 	{
-		return (~m_last_state[b] & m_current_state[b]) != 0;
+		return (~_last_state[b] & _current_state[b]) != 0;
 	}
 
 	/// Returns whether the specified @a b button is released in the current frame.
 	bool button_released(KeyboardButton::Enum b) const
 	{
-		return (m_last_state[b] & ~m_current_state[b]) != 0;
+		return (_last_state[b] & ~_current_state[b]) != 0;
 	}
 
 	/// Returns wheter any button is pressed in the current frame.
 	bool any_pressed()
 	{
-		return button_pressed(m_last_button);
+		return button_pressed(_last_button);
 	}
 
 	/// Returns whether any button is released in the current frame.
 	bool any_released()
 	{
-		return button_released(m_last_button);
+		return button_released(_last_button);
 	}
 
 	//-------------------------------------------------------------------------
 	void set_button_state(KeyboardButton::Enum b, bool state)
 	{
-		m_last_button = b;
-		m_current_state[b] = state;
+		_last_button = b;
+		_current_state[b] = state;
 	}
 
 	//-------------------------------------------------------------------------
 	void update()
 	{
-		memcpy(m_last_state, m_current_state, KeyboardButton::COUNT);
+		memcpy(_last_state, _current_state, KeyboardButton::COUNT);
 	}
 
 public:
 
-	uint8_t m_modifier;
+	uint8_t _modifier;
 
-	KeyboardButton::Enum m_last_button;
-	uint8_t m_last_state[KeyboardButton::COUNT];
-	uint8_t m_current_state[KeyboardButton::COUNT];
+	KeyboardButton::Enum _last_button;
+	uint8_t _last_state[KeyboardButton::COUNT];
+	uint8_t _current_state[KeyboardButton::COUNT];
 };
 
 } // namespace crown

+ 26 - 26
engine/input/mouse.h

@@ -55,34 +55,34 @@ struct Mouse
 {
 	//-----------------------------------------------------------------------------
 	Mouse()
-		: m_last_button(MouseButton::NONE)
+		: _last_button(MouseButton::NONE)
 	{
-		memset(m_last_state, 0, MouseButton::COUNT);
-		memset(m_current_state, 0, MouseButton::COUNT);
+		memset(_last_state, 0, MouseButton::COUNT);
+		memset(_current_state, 0, MouseButton::COUNT);
 	}
 
 	/// Returns whether the @a b button is pressed in the current frame.
 	bool button_pressed(MouseButton::Enum b)
 	{
-		return (~m_last_state[b] & m_current_state[b]) != 0;
+		return (~_last_state[b] & _current_state[b]) != 0;
 	}
 
 	/// Returns whether the @a b button is released in the current frame.
 	bool button_released(MouseButton::Enum b)
 	{
-		return (m_last_state[b] & ~m_current_state[b]) != 0;
+		return (_last_state[b] & ~_current_state[b]) != 0;
 	}
 
 	/// Returns wheter any button is pressed in the current frame.
 	bool any_pressed()
 	{
-		return button_pressed(m_last_button);
+		return button_pressed(_last_button);
 	}
 
 	/// Returns whether any button is released in the current frame.
 	bool any_released()
 	{
-		return button_released(m_last_button);
+		return button_released(_last_button);
 	}
 
 	/// Returns the position of the cursor in window space.
@@ -92,7 +92,7 @@ struct Mouse
 	/// to right and +Y extends from top to bottom.
 	Vector2 cursor_xy()
 	{
-		return Vector2(m_x, m_y);
+		return Vector2(_x, _y);
 	}
 
 	/// Sets the position of the cursor in window space.
@@ -102,8 +102,8 @@ struct Mouse
 	/// to right and +Y extends from top to bottom.
 	void set_cursor_xy(const Vector2& position)
 	{
-		m_x = (uint16_t) position.x;
-		m_y = (uint16_t) position.y;
+		_x = (uint16_t) position.x;
+		_y = (uint16_t) position.y;
 	}
 
 	/// Returns the relative position of the cursor in window space.
@@ -117,7 +117,7 @@ struct Mouse
 	/// maximum extent of the cosidered axis.
 	Vector2 cursor_relative_xy()
 	{
-		return Vector2((float) m_x / m_width, (float) m_y / m_height);
+		return Vector2((float) _x / _width, (float) _y / _height);
 	}
 
 	/// Sets the relative position of the cursor in window space.
@@ -131,21 +131,21 @@ struct Mouse
 	/// maximum extent of the cosidered axis.
 	void set_cursor_relative_xy(const Vector2& position)
 	{
-		set_cursor_xy(Vector2(position.x * (float) m_width, position.y * (float) m_height));
+		set_cursor_xy(Vector2(position.x * (float) _width, position.y * (float) _height));
 	}
 
 	//-----------------------------------------------------------------------------
 	void set_position(uint16_t x, uint16_t y)
 	{
-		m_x = x;
-		m_y = y;
+		_x = x;
+		_y = y;
 	}
 
 	//-----------------------------------------------------------------------------
 	void set_metrics(uint16_t width, uint16_t height)
 	{
-		m_width = width;
-		m_height = height;
+		_width = width;
+		_height = height;
 	}
 
 	//-----------------------------------------------------------------------------
@@ -153,29 +153,29 @@ struct Mouse
 	{
 		set_position(x, y);
 
-		m_last_button = b;
-		m_current_state[b] = state;
+		_last_button = b;
+		_current_state[b] = state;
 	}
 
 	//-----------------------------------------------------------------------------
 	void update()
 	{
-		memcpy(m_last_state, m_current_state, MouseButton::COUNT);
+		memcpy(_last_state, _current_state, MouseButton::COUNT);
 	}
 
 public:
 
-	MouseButton::Enum m_last_button;
-	uint8_t m_last_state[MouseButton::COUNT];
-	uint8_t m_current_state[MouseButton::COUNT];
+	MouseButton::Enum _last_button;
+	uint8_t _last_state[MouseButton::COUNT];
+	uint8_t _current_state[MouseButton::COUNT];
 
 	// Position within the window
-	uint16_t m_x;
-	uint16_t m_y;
+	uint16_t _x;
+	uint16_t _y;
 
 	// Window size
-	uint16_t m_width;
-	uint16_t m_height;
+	uint16_t _width;
+	uint16_t _height;
 };
 
 } // namespace crown

+ 22 - 22
engine/input/touch.h

@@ -45,36 +45,36 @@ struct Touch
 {
 	//-----------------------------------------------------------------------------
 	Touch()
-		: m_last_pointer(0xFF)
+		: _last_pointer(0xFF)
 	{
-		memset(m_last_state, 0, MAX_POINTER_IDS);
-		memset(m_current_state, 0, MAX_POINTER_IDS);
+		memset(_last_state, 0, MAX_POINTER_IDS);
+		memset(_current_state, 0, MAX_POINTER_IDS);
 	}
 
 	/// Returns whether the @a p pointer is pressed in the current frame.
 	bool pointer_down(uint8_t p)
 	{
 		if (p >= MAX_POINTER_IDS) return false;
-		return (~m_last_state[p] & m_current_state[p]) != 0;
+		return (~_last_state[p] & _current_state[p]) != 0;
 	}
 
 	/// Returns whether the @a p pointer is released in the current frame.
 	bool pointer_up(uint8_t p)
 	{
 		if (p >= MAX_POINTER_IDS) return false;
-		return (m_last_state[p] & ~m_current_state[p]) != 0;
+		return (_last_state[p] & ~_current_state[p]) != 0;
 	}
 
 	/// Returns wheter any pointer is pressed in the current frame.
 	bool any_down()
 	{
-		return pointer_down(m_last_pointer);
+		return pointer_down(_last_pointer);
 	}
 
 	/// Returns whether any pointer is released in the current frame.
 	bool any_up()
 	{
-		return pointer_up(m_last_pointer);
+		return pointer_up(_last_pointer);
 	}
 
 	/// Returns the position of the pointer @a p in window space.
@@ -85,22 +85,22 @@ struct Touch
 	Vector2 pointer_xy(uint8_t p)
 	{
 		if (p >= MAX_POINTER_IDS) return vector2::ZERO;
-		return Vector2(m_x[p], m_y[p]);
+		return Vector2(_x[p], _y[p]);
 	}
 
 	//-----------------------------------------------------------------------------
 	void set_position(uint8_t p, uint16_t x, uint16_t y)
 	{
 		if (p >= MAX_POINTER_IDS) return;
-		m_x[p] = x;
-		m_y[p] = y;
+		_x[p] = x;
+		_y[p] = y;
 	}
 
 	//-----------------------------------------------------------------------------
 	void set_metrics(uint16_t width, uint16_t height)
 	{
-		m_width = width;
-		m_height = height;
+		_width = width;
+		_height = height;
 	}
 
 	//-----------------------------------------------------------------------------
@@ -108,28 +108,28 @@ struct Touch
 	{
 		set_position(p, x, y);
 
-		m_last_pointer = p;
-		m_current_state[p] = state;
+		_last_pointer = p;
+		_current_state[p] = state;
 	}
 
 	//-----------------------------------------------------------------------------
 	void update()
 	{
-		memcpy(m_last_state, m_current_state, MAX_POINTER_IDS);
+		memcpy(_last_state, _current_state, MAX_POINTER_IDS);
 	}
 
 public:
 
-	uint8_t m_last_pointer;
-	uint8_t m_last_state[MAX_POINTER_IDS];
-	uint8_t m_current_state[MAX_POINTER_IDS];
+	uint8_t _last_pointer;
+	uint8_t _last_state[MAX_POINTER_IDS];
+	uint8_t _current_state[MAX_POINTER_IDS];
 
-	uint16_t m_x[MAX_POINTER_IDS];
-	uint16_t m_y[MAX_POINTER_IDS];
+	uint16_t _x[MAX_POINTER_IDS];
+	uint16_t _y[MAX_POINTER_IDS];
 
 	// Window size
-	uint16_t m_width;
-	uint16_t m_height;
+	uint16_t _width;
+	uint16_t _height;
 };
 
 } // namespace crown