Fix some double->float conversions.

This commit is contained in:
Rachel Bryk
2014-11-09 15:02:18 -05:00
parent 71d8165a86
commit e9cb629723
6 changed files with 19 additions and 19 deletions

View File

@ -136,7 +136,7 @@ KeyboardMouse::KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIREC
AddInput(new Cursor(!!(i&2), (&m_state_in.cursor.x)[i/2], !!(i&1)));
}
void GetMousePos(float* const x, float* const y)
void GetMousePos(ControlState* const x, ControlState* const y)
{
POINT point = { 1, 1 };
GetCursorPos(&point);
@ -151,8 +151,8 @@ void GetMousePos(float* const x, float* const y)
unsigned int win_height = rect.bottom - rect.top;
// Return the mouse position as a range from -1 to 1
*x = (float)point.x / (float)win_width * 2 - 1;
*y = (float)point.y / (float)win_height * 2 - 1;
*x = (ControlState)point.x / (ControlState)win_width * 2 - 1;
*y = (ControlState)point.y / (ControlState)win_height * 2 - 1;
}
bool KeyboardMouse::UpdateInput()

View File

@ -25,7 +25,7 @@ private:
DIMOUSESTATE2 mouse;
struct
{
float x, y;
ControlState x, y;
} cursor;
};
@ -68,10 +68,10 @@ private:
public:
std::string GetName() const;
bool IsDetectable() { return false; }
Cursor(u8 index, const float& axis, const bool positive) : m_index(index), m_axis(axis), m_positive(positive) {}
Cursor(u8 index, const ControlState& axis, const bool positive) : m_index(index), m_axis(axis), m_positive(positive) {}
ControlState GetState() const;
private:
const float& m_axis;
const ControlState& m_axis;
const u8 m_index;
const bool m_positive;
};