Position de la souris sur l'écran + savoir si on appuie sur clic gauche ou non
This commit is contained in:
parent
ebaf200fb8
commit
b3148d9dfa
@ -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()
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user