[Add] Input stuff in Windows.
[Fix] Coordinate system is now correct.
This commit is contained in:
parent
60366c7ad0
commit
931f7d59a0
@ -86,6 +86,7 @@
|
|||||||
<ClInclude Include="..\..\src\Actor\Player.h" />
|
<ClInclude Include="..\..\src\Actor\Player.h" />
|
||||||
<ClInclude Include="..\..\src\glx\glext.h" />
|
<ClInclude Include="..\..\src\glx\glext.h" />
|
||||||
<ClInclude Include="..\..\src\glx\wglext.h" />
|
<ClInclude Include="..\..\src\glx\wglext.h" />
|
||||||
|
<ClInclude Include="..\..\src\IO\Input.h" />
|
||||||
<ClInclude Include="..\..\src\Main\Game.h" />
|
<ClInclude Include="..\..\src\Main\Game.h" />
|
||||||
<ClInclude Include="..\..\src\Main\GLWindow.h" />
|
<ClInclude Include="..\..\src\Main\GLWindow.h" />
|
||||||
<ClInclude Include="..\..\src\Math\FPS.h" />
|
<ClInclude Include="..\..\src\Math\FPS.h" />
|
||||||
@ -98,6 +99,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\Actor\Player.cpp" />
|
<ClCompile Include="..\..\src\Actor\Player.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\IO\Input.cpp" />
|
||||||
<ClCompile Include="..\..\src\Main\Game.cpp" />
|
<ClCompile Include="..\..\src\Main\Game.cpp" />
|
||||||
<ClCompile Include="..\..\src\Main\GLWindow.cpp" />
|
<ClCompile Include="..\..\src\Main\GLWindow.cpp" />
|
||||||
<ClCompile Include="..\..\src\Main\main.cpp" />
|
<ClCompile Include="..\..\src\Main\main.cpp" />
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
<Filter Include="System">
|
<Filter Include="System">
|
||||||
<UniqueIdentifier>{1354dd04-f0db-4c12-bbfa-ef24daeb2293}</UniqueIdentifier>
|
<UniqueIdentifier>{1354dd04-f0db-4c12-bbfa-ef24daeb2293}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="IO">
|
||||||
|
<UniqueIdentifier>{5b78104c-8316-4d75-8ad0-3f9a6bfbfde8}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\Main\GLWindow.h">
|
<ClInclude Include="..\..\src\Main\GLWindow.h">
|
||||||
@ -60,6 +63,9 @@
|
|||||||
<ClInclude Include="..\..\src\System\Debug.h">
|
<ClInclude Include="..\..\src\System\Debug.h">
|
||||||
<Filter>System</Filter>
|
<Filter>System</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\IO\Input.h">
|
||||||
|
<Filter>IO</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\Main\main.cpp">
|
<ClCompile Include="..\..\src\Main\main.cpp">
|
||||||
@ -92,5 +98,8 @@
|
|||||||
<ClCompile Include="..\..\src\System\Debug.cpp">
|
<ClCompile Include="..\..\src\System\Debug.cpp">
|
||||||
<Filter>System</Filter>
|
<Filter>System</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\IO\Input.cpp">
|
||||||
|
<Filter>IO</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -1,4 +1,4 @@
|
|||||||
#ifdef _WIN32_
|
#ifdef _WIN32
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@ -7,12 +7,13 @@
|
|||||||
#include "../glx/wglext.h"
|
#include "../glx/wglext.h"
|
||||||
#include "GLWindow.h"
|
#include "GLWindow.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "../IO/Input.h"
|
||||||
|
|
||||||
typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int*);
|
typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int*);
|
||||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
|
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
|
||||||
|
|
||||||
GLWindow::GLWindow(HINSTANCE hInstance) :
|
GLWindow::GLWindow(HINSTANCE hInstance) :
|
||||||
_isRunning(true),
|
_isRunning(false),
|
||||||
_game(NULL),
|
_game(NULL),
|
||||||
_hinstance(hInstance),
|
_hinstance(hInstance),
|
||||||
_lastTime(0)
|
_lastTime(0)
|
||||||
@ -181,6 +182,8 @@ LRESULT GLWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
|||||||
// Make the GL3 context current.
|
// Make the GL3 context current.
|
||||||
wglMakeCurrent(_hdc, _hglrc);
|
wglMakeCurrent(_hdc, _hglrc);
|
||||||
_isRunning = true; // Mark our window as running now.
|
_isRunning = true; // Mark our window as running now.
|
||||||
|
|
||||||
|
CreateInput();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_DESTROY: // Destroy window.
|
case WM_DESTROY: // Destroy window.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifdef _WIN32_ // Stop makefiles from complaining.
|
#ifdef _WIN32 // Stop makefiles from complaining.
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
@ -67,8 +67,7 @@ void Game::OnResize(int width, int height) {
|
|||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
glOrtho(0.0, 800.0, 0.0, 600.0, 0.0, 1.0);
|
||||||
gluPerspective(45.0f, float(width) / float(height), 1.0f, 100.0f);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
Loading…
Reference in New Issue
Block a user