diff --git a/enginecustom/applicationclass.cpp b/enginecustom/applicationclass.cpp index 725dbac..06c2289 100644 --- a/enginecustom/applicationclass.cpp +++ b/enginecustom/applicationclass.cpp @@ -305,6 +305,7 @@ void ApplicationClass::Shutdown() delete[] m_MouseStrings; m_MouseStrings = 0; + } // Release the text object for the fps string. if (m_FpsString) { @@ -472,10 +473,12 @@ bool ApplicationClass::Frame(InputClass* Input) static float x = 6.f; static float y = 3.f; static float z = 0.f; - bool result; // Check if the user pressed escape and wants to exit the application. if (Input->IsEscapePressed()) + { + return false; + } // Update the frames per second each frame. result = UpdateFps(); @@ -507,6 +510,19 @@ bool ApplicationClass::Frame(InputClass* Input) return false; } + // Get the location of the mouse from the input object, + Input->GetMouseLocation(mouseX, mouseY); + + // Check if the mouse has been pressed. + mouseDown = Input->IsMousePressed(); + + // Update the mouse strings each frame. + result = UpdateMouseStrings(mouseX, mouseY, mouseDown); + if (!result) + { + return false; + } + // Update the system stats. m_Timer->Frame(); @@ -736,6 +752,7 @@ bool ApplicationClass::UpdateMouseStrings(int mouseX, int mouseY, bool mouseDown // Update the sentence vertex buffer with the new string information. result = m_MouseStrings[2].UpdateText(m_Direct3D->GetDeviceContext(), m_Font, finalString, 10, 60, 1.0f, 1.0f, 1.0f); +} bool ApplicationClass::UpdateFps() { diff --git a/enginecustom/applicationclass.h b/enginecustom/applicationclass.h index 83af995..906c1b5 100644 --- a/enginecustom/applicationclass.h +++ b/enginecustom/applicationclass.h @@ -21,6 +21,7 @@ #include "fontclass.h" #include "textclass.h" #include "fpsclass.h" +#include "inputclass.h" ///////////// // GLOBALS // @@ -49,6 +50,7 @@ private: bool Render(float, float, float, float); bool UpdateMouseStrings(int, int, bool); bool UpdateFps(); + private: D3DClass* m_Direct3D; CameraClass* m_Camera; diff --git a/enginecustom/inputclass.cpp b/enginecustom/inputclass.cpp index 81bc72f..c50216a 100644 --- a/enginecustom/inputclass.cpp +++ b/enginecustom/inputclass.cpp @@ -30,8 +30,6 @@ bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int m_keys[i] = false; } - return; - // Store the screen size which will be used for positioning the mouse cursor. m_screenWidth = screenWidth; m_screenHeight = screenHeight;