Added mouse buttons and an origin line.

This commit is contained in:
jaynus 2015-05-13 21:11:34 -07:00
parent e23d59c2d3
commit c0678927e3
3 changed files with 19 additions and 5 deletions

View File

@ -33,7 +33,7 @@ namespace ace {
return result;
}
d3d_display::d3d_display() : _fullscreen(false) {}
d3d_display::d3d_display() : _fullscreen(false), _leftMouseButton(false) {}
d3d_display::~d3d_display() {}
bool d3d_display::render_thread(uint32_t w, uint32_t h, bool f) {
@ -390,12 +390,18 @@ namespace ace {
break;
}
}
}
else if (raw->header.dwType == RIM_TYPEMOUSE) {
} else if (raw->header.dwType == RIM_TYPEMOUSE) {
RAWMOUSE mouseCurrState = raw->data.mouse;
if ((mouseCurrState.lLastX != _last_mouse_state.lLastY) || (mouseCurrState.lLastX != _last_mouse_state.lLastY))
{
if (raw->data.mouse.ulButtons & RI_MOUSE_LEFT_BUTTON_DOWN) {
_leftMouseButton = true;
}
if(raw->data.mouse.ulButtons & RI_MOUSE_LEFT_BUTTON_UP) {
_leftMouseButton = false;
}
if (((mouseCurrState.lLastX != _last_mouse_state.lLastY) || (mouseCurrState.lLastX != _last_mouse_state.lLastY)) && _leftMouseButton) {
_camera.camYaw += mouseCurrState.lLastX * 0.005f;
_camera.camPitch += mouseCurrState.lLastY * 0.005f;
_last_mouse_state = mouseCurrState;

View File

@ -109,6 +109,7 @@ namespace ace {
DirectX::XMFLOAT4X4 _View;
DirectX::XMFLOAT4X4 _Projection;
bool _leftMouseButton;
RAWMOUSE _last_mouse_state;
camera_movement _camera;

View File

@ -79,6 +79,13 @@ namespace ace {
const XMVECTORF32 yaxis = { 0.f, 0.f, 20.f };
DrawGrid(*_Batch, xaxis, yaxis, g_XMZero, 20, 20, Colors::Gray);
// Draw the red line for nou
_Batch->Begin();
const XMVECTORF32 v1 = { 0.f, 100.f, 0.f };
const XMVECTORF32 v2 = { 0.f, -100.f, 0.f };
_Batch->DrawLine(VertexPositionColor(v1, Colors::Red), VertexPositionColor(v2, Colors::Red));
_Batch->End();
if (_active_vehicle) {
DrawObject(_active_vehicle->fire_lod, *_Batch, *_active_vehicle->object, Colors::Gray);
}