direct input fini
Le code ne fonctionne pas encore, il doit être merge avec le tuto 14.
This commit is contained in:
parent
41b2b9e024
commit
f5554587bd
@ -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.
|
// 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 = 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.
|
// Create and initialize the application class object. This object will handle rendering all the graphics for this application.
|
||||||
m_Application = new ApplicationClass;
|
m_Application = new ApplicationClass;
|
||||||
@ -112,15 +116,15 @@ bool SystemClass::Frame()
|
|||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
|
// Do the input frame processing.
|
||||||
// Check if the user pressed escape and wants to exit the application.
|
result = m_Input->Frame();
|
||||||
if (m_Input->IsKeyDown(VK_ESCAPE))
|
if (!result)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the frame processing for the application class object.
|
// Do the frame processing for the application class object.
|
||||||
result = m_Application->Frame();
|
result = m_Application->Frame(m_Input);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -131,30 +135,7 @@ bool SystemClass::Frame()
|
|||||||
|
|
||||||
LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
|
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)
|
void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight)
|
||||||
|
@ -12,6 +12,7 @@ ApplicationClass::ApplicationClass()
|
|||||||
m_Bitmap = 0;
|
m_Bitmap = 0;
|
||||||
m_Sprite = 0;
|
m_Sprite = 0;
|
||||||
m_Timer = 0;
|
m_Timer = 0;
|
||||||
|
m_MouseStrings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ ApplicationClass::~ApplicationClass()
|
|||||||
|
|
||||||
bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||||
{
|
{
|
||||||
|
char mouseString1[32], mouseString2[32], mouseString3[32];
|
||||||
char modelFilename[128];
|
char modelFilename[128];
|
||||||
char textureFilename1[128], textureFilename2[128];
|
char textureFilename1[128], textureFilename2[128];
|
||||||
char bitmapFilename[128];
|
char bitmapFilename[128];
|
||||||
@ -91,6 +93,32 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the initial mouse strings.
|
||||||
|
strcpy_s(mouseString1, "Mouse X: 0");
|
||||||
|
strcpy_s(mouseString2, "Mouse Y: 0");
|
||||||
|
strcpy_s(mouseString3, "Mouse Button: No");
|
||||||
|
|
||||||
|
// Create and initialize the text objects for the mouse strings.
|
||||||
|
m_MouseStrings = new TextClass[3];
|
||||||
|
|
||||||
|
result = m_MouseStrings[0].Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), screenWidth, screenHeight, 32, m_Font, mouseString1, 10, 10, 1.0f, 1.0f, 1.0f);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = m_MouseStrings[1].Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), screenWidth, screenHeight, 32, m_Font, mouseString1, 10, 35, 1.0f, 1.0f, 1.0f);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = m_MouseStrings[2].Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), screenWidth, screenHeight, 32, m_Font, mouseString1, 10, 60, 1.0f, 1.0f, 1.0f);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the file name of the bitmap file.
|
// Set the file name of the bitmap file.
|
||||||
strcpy_s(bitmapFilename, "stone01.tga");
|
strcpy_s(bitmapFilename, "stone01.tga");
|
||||||
|
|
||||||
@ -156,6 +184,17 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
|
|
||||||
void ApplicationClass::Shutdown()
|
void ApplicationClass::Shutdown()
|
||||||
{
|
{
|
||||||
|
// Release the text objects for the mouse strings.
|
||||||
|
if (m_MouseStrings)
|
||||||
|
{
|
||||||
|
m_MouseStrings[0].Shutdown();
|
||||||
|
m_MouseStrings[1].Shutdown();
|
||||||
|
m_MouseStrings[2].Shutdown();
|
||||||
|
|
||||||
|
delete[] m_MouseStrings;
|
||||||
|
m_MouseStrings = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Release the timer object.
|
// Release the timer object.
|
||||||
if (m_Timer)
|
if (m_Timer)
|
||||||
{
|
{
|
||||||
@ -244,8 +283,11 @@ void ApplicationClass::Shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ApplicationClass::Frame()
|
bool ApplicationClass::Frame(InputClass* Input)
|
||||||
{
|
{
|
||||||
|
int mouseX, mouseY;
|
||||||
|
bool result, mouseDown;
|
||||||
|
|
||||||
float frameTime;
|
float frameTime;
|
||||||
static float rotation = 0.0f;
|
static float rotation = 0.0f;
|
||||||
static float x = 2.f;
|
static float x = 2.f;
|
||||||
@ -253,6 +295,12 @@ bool ApplicationClass::Frame()
|
|||||||
static float z = 0.f;
|
static float z = 0.f;
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
|
// Check if the user pressed escape and wants to exit the application.
|
||||||
|
if (Input->IsEscapePressed())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Update the rotation variable each frame.
|
// Update the rotation variable each frame.
|
||||||
rotation -= 0.0174532925f * 0.1f;
|
rotation -= 0.0174532925f * 0.1f;
|
||||||
if (rotation < 0.0f)
|
if (rotation < 0.0f)
|
||||||
@ -309,6 +357,19 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z)
|
|||||||
// Turn off the Z buffer to begin all 2D rendering.
|
// Turn off the Z buffer to begin all 2D rendering.
|
||||||
m_Direct3D->TurnZBufferOff();
|
m_Direct3D->TurnZBufferOff();
|
||||||
|
|
||||||
|
// Render the mouse text strings using the font shader.
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
m_MouseStrings[i].Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
|
result = m_FontShader->Render(m_Direct3D->GetDeviceContext(), m_MouseStrings[i].GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix,
|
||||||
|
m_Font->GetTexture(), m_MouseStrings[i].GetPixelColor());
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Put the sprite vertex and index buffers on the graphics pipeline to prepare them for drawing.
|
// Put the sprite vertex and index buffers on the graphics pipeline to prepare them for drawing.
|
||||||
result = m_Sprite->Render(m_Direct3D->GetDeviceContext());
|
result = m_Sprite->Render(m_Direct3D->GetDeviceContext());
|
||||||
if (!result)
|
if (!result)
|
||||||
@ -385,3 +446,58 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ApplicationClass::UpdateMouseStrings(int mouseX, int mouseY, bool mouseDown)
|
||||||
|
{
|
||||||
|
char tempString[16], finalString[32];
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
|
||||||
|
// Convert the mouse X integer to string format.
|
||||||
|
sprintf_s(tempString, "%d", mouseX);
|
||||||
|
|
||||||
|
// Setup the mouse X string.
|
||||||
|
strcpy_s(finalString, "Mouse X: ");
|
||||||
|
strcat_s(finalString, tempString);
|
||||||
|
|
||||||
|
// Update the sentence vertex buffer with the new string information.
|
||||||
|
result = m_MouseStrings[0].UpdateText(m_Direct3D->GetDeviceContext(), m_Font, finalString, 10, 10, 1.0f, 1.0f, 1.0f);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the mouse Y integer to string format.
|
||||||
|
sprintf_s(tempString, "%d", mouseY);
|
||||||
|
|
||||||
|
// Setup the mouse Y string.
|
||||||
|
strcpy_s(finalString, "Mouse Y: ");
|
||||||
|
strcat_s(finalString, tempString);
|
||||||
|
|
||||||
|
// Update the sentence vertex buffer with the new string information.
|
||||||
|
result = m_MouseStrings[1].UpdateText(m_Direct3D->GetDeviceContext(), m_Font, finalString, 10, 35, 1.0f, 1.0f, 1.0f);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup the mouse button string.
|
||||||
|
if (mouseDown)
|
||||||
|
{
|
||||||
|
strcpy_s(finalString, "Mouse Button: Yes");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy_s(finalString, "Mouse Button: No");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "textureshaderclass.h"
|
#include "textureshaderclass.h"
|
||||||
#include "spriteclass.h"
|
#include "spriteclass.h"
|
||||||
#include "timerclass.h"
|
#include "timerclass.h"
|
||||||
|
#include "textclass.h"
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// GLOBALS //
|
// GLOBALS //
|
||||||
@ -37,10 +38,12 @@ public:
|
|||||||
|
|
||||||
bool Initialize(int, int, HWND);
|
bool Initialize(int, int, HWND);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
bool Frame();
|
bool Frame(InputClass*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool Render(float, float, float, float);
|
bool Render(float, float, float, float);
|
||||||
|
bool UpdateMouseStrings(int, int, bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
D3DClass* m_Direct3D;
|
D3DClass* m_Direct3D;
|
||||||
CameraClass* m_Camera;
|
CameraClass* m_Camera;
|
||||||
@ -52,6 +55,7 @@ private:
|
|||||||
BitmapClass* m_Bitmap;
|
BitmapClass* m_Bitmap;
|
||||||
SpriteClass* m_Sprite;
|
SpriteClass* m_Sprite;
|
||||||
TimerClass* m_Timer;
|
TimerClass* m_Timer;
|
||||||
|
TextClass* m_MouseStrings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<ClInclude Include="Multitextureshaderclass.h" />
|
<ClInclude Include="Multitextureshaderclass.h" />
|
||||||
<ClInclude Include="Spriteclass.h" />
|
<ClInclude Include="Spriteclass.h" />
|
||||||
<ClInclude Include="systemclass.h" />
|
<ClInclude Include="systemclass.h" />
|
||||||
|
<ClInclude Include="textclass.h" />
|
||||||
<ClInclude Include="textureclass.h" />
|
<ClInclude Include="textureclass.h" />
|
||||||
<ClInclude Include="textureshaderclass.h" />
|
<ClInclude Include="textureshaderclass.h" />
|
||||||
<ClInclude Include="Timerclass.h" />
|
<ClInclude Include="Timerclass.h" />
|
||||||
|
@ -1,172 +1,60 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Fichiers sources">
|
<ClCompile Include="applicationclass.cpp" />
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<ClCompile Include="bitmapclass.cpp" />
|
||||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<ClCompile Include="Cameraclass.cpp" />
|
||||||
</Filter>
|
<ClCompile Include="Colorshaderclass.cpp" />
|
||||||
<Filter Include="Fichiers d%27en-tête">
|
<ClCompile Include="d3dclass.cpp" />
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<ClCompile Include="inputclass.cpp" />
|
||||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
<ClCompile Include="Lightclass.cpp" />
|
||||||
</Filter>
|
<ClCompile Include="Lightshaderclass.cpp" />
|
||||||
<Filter Include="Fichiers de ressources">
|
<ClCompile Include="Main.cpp" />
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<ClCompile Include="modelclass.cpp" />
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<ClCompile Include="Multitextureshaderclass.cpp" />
|
||||||
</Filter>
|
<ClCompile Include="Spriteclass.cpp" />
|
||||||
<Filter Include="shader">
|
<ClCompile Include="Systemclass.cpp" />
|
||||||
<UniqueIdentifier>{b016e481-576e-4d99-bdde-34cc10c55b1d}</UniqueIdentifier>
|
<ClCompile Include="textureclass.cpp" />
|
||||||
</Filter>
|
<ClCompile Include="textureshaderclass.cpp" />
|
||||||
<Filter Include="texture">
|
<ClCompile Include="Timerclass.cpp" />
|
||||||
<UniqueIdentifier>{f76f9761-bbbe-42a8-935d-01f1b9172c38}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="assets">
|
|
||||||
<UniqueIdentifier>{741e1efe-db9b-48a7-9ecb-4c34a696f40e}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Main.cpp">
|
<ClInclude Include="applicationclass.h" />
|
||||||
<Filter>Fichiers sources</Filter>
|
<ClInclude Include="bitmapclass.h" />
|
||||||
</ClCompile>
|
<ClInclude Include="Cameraclass.h" />
|
||||||
<ClCompile Include="Systemclass.cpp">
|
<ClInclude Include="Colorshaderclass.h" />
|
||||||
<Filter>Fichiers sources</Filter>
|
<ClInclude Include="d3dclass.h" />
|
||||||
</ClCompile>
|
<ClInclude Include="inputclass.h" />
|
||||||
<ClCompile Include="inputclass.cpp">
|
<ClInclude Include="lightclass.h" />
|
||||||
<Filter>Fichiers sources</Filter>
|
<ClInclude Include="lightshaderclass.h" />
|
||||||
</ClCompile>
|
<ClInclude Include="modelclass.h" />
|
||||||
<ClCompile Include="applicationclass.cpp">
|
<ClInclude Include="Multitextureshaderclass.h" />
|
||||||
<Filter>Fichiers sources</Filter>
|
<ClInclude Include="Spriteclass.h" />
|
||||||
</ClCompile>
|
<ClInclude Include="systemclass.h" />
|
||||||
<ClCompile Include="d3dclass.cpp">
|
<ClInclude Include="textureclass.h" />
|
||||||
<Filter>Fichiers sources</Filter>
|
<ClInclude Include="textureshaderclass.h" />
|
||||||
</ClCompile>
|
<ClInclude Include="Timerclass.h" />
|
||||||
<ClCompile Include="Colorshaderclass.cpp">
|
<ClInclude Include="textclass.h" />
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="modelclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Cameraclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="textureclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lightshaderclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lightclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Multitextureshaderclass.cpp">
|
|
||||||
<ClCompile Include="bitmapclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="textureshaderclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Spriteclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Timerclass.cpp">
|
|
||||||
<Filter>Fichiers sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="systemclass.h">
|
<Image Include="moss01.tga" />
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
<Image Include="papier.tga" />
|
||||||
</ClInclude>
|
<Image Include="stone01.tga" />
|
||||||
<ClInclude Include="inputclass.h">
|
<Image Include="wall.tga" />
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="applicationclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="d3dclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Colorshaderclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="modelclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Cameraclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="textureclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lightshaderclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Multitextureshaderclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lightclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Lightshaderclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Lightclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="bitmapclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="textureshaderclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Spriteclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Timerclass.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="light.ps" />
|
||||||
<None Include="Color.ps">
|
<None Include="light.vs" />
|
||||||
<Filter>shader</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="Color.vs">
|
|
||||||
<Filter>shader</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="light.vs">
|
|
||||||
<Filter>texture</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="light.ps">
|
|
||||||
<Filter>texture</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="Multitexture.vs" />
|
|
||||||
<None Include="Multitexture.ps" />
|
<None Include="Multitexture.ps" />
|
||||||
<None Include="texture.ps">
|
<None Include="Multitexture.vs" />
|
||||||
<Filter>texture</Filter>
|
<None Include="packages.config" />
|
||||||
</None>
|
<None Include="texture.ps" />
|
||||||
<None Include="texture.vs">
|
<None Include="texture.vs" />
|
||||||
<Filter>texture</Filter>
|
<None Include="Color.ps" />
|
||||||
</None>
|
<None Include="Color.vs" />
|
||||||
<None Include="sphere.obj">
|
|
||||||
<Filter>assets</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="wall.tga">
|
<Text Include="cube.txt" />
|
||||||
<Filter>assets</Filter>
|
<Text Include="sphere.txt" />
|
||||||
</Image>
|
|
||||||
<Image Include="stone01.tga">
|
|
||||||
<Filter>assets</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="papier.tga">
|
|
||||||
<Filter>assets</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="moss01.tga">
|
|
||||||
<Filter>assets</Filter>
|
|
||||||
</Image>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Text Include="cube.txt">
|
|
||||||
<Filter>assets</Filter>
|
|
||||||
</Text>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -21,8 +21,17 @@ InputClass::~InputClass()
|
|||||||
bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int screenHeight)
|
bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int screenHeight)
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize all the keys to being released and not pressed.
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
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;
|
||||||
@ -97,42 +106,30 @@ bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void InputClass::Initialize()
|
|
||||||
//{
|
|
||||||
// int i;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // Initialize all the keys to being released and not pressed.
|
|
||||||
// for (i = 0; i < 256; i++)
|
|
||||||
// {
|
|
||||||
// m_keys[i] = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//void InputClass::KeyDown(unsigned int input)
|
|
||||||
//{
|
void InputClass::KeyDown(unsigned int input)
|
||||||
// // If a key is pressed then save that state in the key array.
|
{
|
||||||
// m_keys[input] = true;
|
// If a key is pressed then save that state in the key array.
|
||||||
// return;
|
m_keys[input] = true;
|
||||||
//}
|
return;
|
||||||
//
|
}
|
||||||
//
|
|
||||||
//void InputClass::KeyUp(unsigned int input)
|
|
||||||
//{
|
void InputClass::KeyUp(unsigned int input)
|
||||||
// // If a key is released then clear that state in the key array.
|
{
|
||||||
// m_keys[input] = false;
|
// If a key is released then clear that state in the key array.
|
||||||
// return;
|
m_keys[input] = false;
|
||||||
//}
|
return;
|
||||||
//
|
}
|
||||||
//
|
|
||||||
//bool InputClass::IsKeyDown(unsigned int key)
|
|
||||||
//{
|
bool InputClass::IsKeyDown(unsigned int key)
|
||||||
// // Return what state the key is in (pressed/not pressed).
|
{
|
||||||
// return m_keys[key];
|
// Return what state the key is in (pressed/not pressed).
|
||||||
//}
|
return m_keys[key];
|
||||||
|
}
|
||||||
|
|
||||||
void InputClass::Shutdown()
|
void InputClass::Shutdown()
|
||||||
{
|
{
|
||||||
|
@ -34,10 +34,10 @@ public:
|
|||||||
bool IsEscapePressed();
|
bool IsEscapePressed();
|
||||||
void GetMouseLocation(int&, int&);
|
void GetMouseLocation(int&, int&);
|
||||||
bool IsMousePressed();
|
bool IsMousePressed();
|
||||||
/*void KeyDown(unsigned int);
|
void KeyDown(unsigned int);
|
||||||
void KeyUp(unsigned int);
|
void KeyUp(unsigned int);
|
||||||
|
|
||||||
bool IsKeyDown(unsigned int);*/
|
bool IsKeyDown(unsigned int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_keys[256];
|
bool m_keys[256];
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#ifndef _SYSTEMCLASS_H_
|
#ifndef _SYSTEMCLASS_H_
|
||||||
#define _SYSTEMCLASS_H_
|
#define _SYSTEMCLASS_H_
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
1
enginecustom/textclass.h
Normal file
1
enginecustom/textclass.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#pragma once
|
Loading…
x
Reference in New Issue
Block a user