direct input fini

Le code ne fonctionne pas encore, il doit être merge avec le tuto 14.
This commit is contained in:
GolfOcean334
2024-03-29 14:38:48 +01:00
parent 41b2b9e024
commit f5554587bd
9 changed files with 214 additions and 225 deletions

View File

@@ -31,7 +31,11 @@ bool SystemClass::Initialize()
// Create and initialize the input object. This object will be used to handle reading the keyboard input from the user.
m_Input = new InputClass;
m_Input->Initialize();
result = m_Input->Initialize(m_hinstance, m_hwnd, screenWidth, screenHeight);
if (!result)
{
return false;
}
// Create and initialize the application class object. This object will handle rendering all the graphics for this application.
m_Application = new ApplicationClass;
@@ -112,15 +116,15 @@ bool SystemClass::Frame()
{
bool result;
// Check if the user pressed escape and wants to exit the application.
if (m_Input->IsKeyDown(VK_ESCAPE))
// Do the input frame processing.
result = m_Input->Frame();
if (!result)
{
return false;
}
// Do the frame processing for the application class object.
result = m_Application->Frame();
result = m_Application->Frame(m_Input);
if (!result)
{
return false;
@@ -131,30 +135,7 @@ bool SystemClass::Frame()
LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
{
switch (umsg)
{
// Check if a key has been pressed on the keyboard.
case WM_KEYDOWN:
{
// If a key is pressed send it to the input object so it can record that state.
m_Input->KeyDown((unsigned int)wparam);
return 0;
}
// Check if a key has been released on the keyboard.
case WM_KEYUP:
{
// If a key is released then send it to the input object so it can unset the state for that key.
m_Input->KeyUp((unsigned int)wparam);
return 0;
}
// Any other messages send to the default message handler as our application won't make use of them.
default:
{
return DefWindowProc(hwnd, umsg, wparam, lparam);
}
}
return DefWindowProc(hwnd, umsg, wparam, lparam);
}
void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight)