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;
|
delete[] m_MouseStrings;
|
||||||
m_MouseStrings = 0;
|
m_MouseStrings = 0;
|
||||||
|
}
|
||||||
// Release the text object for the fps string.
|
// Release the text object for the fps string.
|
||||||
if (m_FpsString)
|
if (m_FpsString)
|
||||||
{
|
{
|
||||||
@ -472,10 +473,12 @@ bool ApplicationClass::Frame(InputClass* Input)
|
|||||||
static float x = 6.f;
|
static float x = 6.f;
|
||||||
static float y = 3.f;
|
static float y = 3.f;
|
||||||
static float z = 0.f;
|
static float z = 0.f;
|
||||||
bool result;
|
|
||||||
|
|
||||||
// Check if the user pressed escape and wants to exit the application.
|
// Check if the user pressed escape and wants to exit the application.
|
||||||
if (Input->IsEscapePressed())
|
if (Input->IsEscapePressed())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Update the frames per second each frame.
|
// Update the frames per second each frame.
|
||||||
result = UpdateFps();
|
result = UpdateFps();
|
||||||
@ -507,6 +510,19 @@ bool ApplicationClass::Frame(InputClass* Input)
|
|||||||
return false;
|
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.
|
// Update the system stats.
|
||||||
m_Timer->Frame();
|
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.
|
// 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);
|
result = m_MouseStrings[2].UpdateText(m_Direct3D->GetDeviceContext(), m_Font, finalString, 10, 60, 1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
bool ApplicationClass::UpdateFps()
|
bool ApplicationClass::UpdateFps()
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "fontclass.h"
|
#include "fontclass.h"
|
||||||
#include "textclass.h"
|
#include "textclass.h"
|
||||||
#include "fpsclass.h"
|
#include "fpsclass.h"
|
||||||
|
#include "inputclass.h"
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// GLOBALS //
|
// GLOBALS //
|
||||||
@ -49,6 +50,7 @@ private:
|
|||||||
bool Render(float, float, float, float);
|
bool Render(float, float, float, float);
|
||||||
bool UpdateMouseStrings(int, int, bool);
|
bool UpdateMouseStrings(int, int, bool);
|
||||||
bool UpdateFps();
|
bool UpdateFps();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
D3DClass* m_Direct3D;
|
D3DClass* m_Direct3D;
|
||||||
CameraClass* m_Camera;
|
CameraClass* m_Camera;
|
||||||
|
@ -30,8 +30,6 @@ bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int
|
|||||||
m_keys[i] = false;
|
m_keys[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Store the screen size which will be used for positioning the mouse cursor.
|
// Store the screen size which will be used for positioning the mouse cursor.
|
||||||
m_screenWidth = screenWidth;
|
m_screenWidth = screenWidth;
|
||||||
m_screenHeight = screenHeight;
|
m_screenHeight = screenHeight;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user