Jelajahi Sumber

Fix warnings

Daniele Bartolini 11 tahun lalu
induk
melakukan
3b416f9a69
3 mengubah file dengan 7 tambahan dan 7 penghapusan
  1. 2 2
      engine/input/keyboard.h
  2. 3 3
      engine/input/mouse.h
  3. 2 2
      engine/input/touch.h

+ 2 - 2
engine/input/keyboard.h

@@ -75,13 +75,13 @@ struct Keyboard
 	/// Returns whether the specified @a b button is pressed in the current frame.
 	bool button_pressed(KeyboardButton::Enum b) const
 	{
-		return bool(~m_last_state[b] & m_current_state[b]);
+		return (~m_last_state[b] & m_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 bool(m_last_state[b] & ~m_current_state[b]);
+		return (m_last_state[b] & ~m_current_state[b]) != 0;
 	}
 
 	/// Returns wheter any button is pressed in the current frame.

+ 3 - 3
engine/input/mouse.h

@@ -66,13 +66,13 @@ public:
 	/// Returns whether the @a b button is pressed in the current frame.
 	bool button_pressed(MouseButton::Enum b)
 	{
-		return bool(~m_last_state[b] & m_current_state[b]);
+		return (~m_last_state[b] & m_current_state[b]) != 0;
 	}
 
 	/// Returns whether the @a b button is released in the current frame.
 	bool button_released(MouseButton::Enum b)
 	{
-		return bool(m_last_state[b] & ~m_current_state[b]);
+		return (m_last_state[b] & ~m_current_state[b]) != 0;
 	}
 
 	/// Returns wheter any button is pressed in the current frame.
@@ -119,7 +119,7 @@ public:
 	/// maximum extent of the cosidered axis.
 	Vector2 cursor_relative_xy()
 	{
-		return Vector2(m_x / m_width, m_y / m_height);
+		return Vector2((float) m_x / m_width, (float) m_y / m_height);
 	}
 
 	/// Sets the relative position of the cursor in window space.

+ 2 - 2
engine/input/touch.h

@@ -56,14 +56,14 @@ public:
 	bool pointer_down(uint8_t p)
 	{
 		if (p >= MAX_POINTER_IDS) return false;
-		return bool(~m_last_state[p] & m_current_state[p]);
+		return (~m_last_state[p] & m_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 bool(m_last_state[p] & ~m_current_state[p]);
+		return (m_last_state[p] & ~m_current_state[p]) != 0;
 	}
 
 	/// Returns wheter any pointer is pressed in the current frame.