From 931f7d59a0bb053df5995740125ed710101322f2 Mon Sep 17 00:00:00 2001 From: Tamir Atias Date: Sun, 8 Apr 2012 21:23:52 +0300 Subject: [PATCH] [Add] Input stuff in Windows. [Fix] Coordinate system is now correct. --- Bin/VC10/VC10.vcxproj | 2 ++ Bin/VC10/VC10.vcxproj.filters | 9 +++++++++ src/Main/GLWindow.cpp | 7 +++++-- src/Main/GLWindow.h | 2 +- src/Main/Game.cpp | 3 +-- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Bin/VC10/VC10.vcxproj b/Bin/VC10/VC10.vcxproj index 8fbbaa4..16be18b 100644 --- a/Bin/VC10/VC10.vcxproj +++ b/Bin/VC10/VC10.vcxproj @@ -86,6 +86,7 @@ + @@ -98,6 +99,7 @@ + diff --git a/Bin/VC10/VC10.vcxproj.filters b/Bin/VC10/VC10.vcxproj.filters index 0fbc420..a41e568 100644 --- a/Bin/VC10/VC10.vcxproj.filters +++ b/Bin/VC10/VC10.vcxproj.filters @@ -22,6 +22,9 @@ {1354dd04-f0db-4c12-bbfa-ef24daeb2293} + + {5b78104c-8316-4d75-8ad0-3f9a6bfbfde8} + @@ -60,6 +63,9 @@ System + + IO + @@ -92,5 +98,8 @@ System + + IO + \ No newline at end of file diff --git a/src/Main/GLWindow.cpp b/src/Main/GLWindow.cpp index db851fe..fcc389c 100644 --- a/src/Main/GLWindow.cpp +++ b/src/Main/GLWindow.cpp @@ -1,4 +1,4 @@ -#ifdef _WIN32_ +#ifdef _WIN32 #include #include #include @@ -7,12 +7,13 @@ #include "../glx/wglext.h" #include "GLWindow.h" #include "Game.h" +#include "../IO/Input.h" typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int*); PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; GLWindow::GLWindow(HINSTANCE hInstance) : - _isRunning(true), + _isRunning(false), _game(NULL), _hinstance(hInstance), _lastTime(0) @@ -181,6 +182,8 @@ LRESULT GLWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Make the GL3 context current. wglMakeCurrent(_hdc, _hglrc); _isRunning = true; // Mark our window as running now. + + CreateInput(); } break; case WM_DESTROY: // Destroy window. diff --git a/src/Main/GLWindow.h b/src/Main/GLWindow.h index 7414721..6e72fe9 100644 --- a/src/Main/GLWindow.h +++ b/src/Main/GLWindow.h @@ -1,5 +1,5 @@ #pragma once -#ifdef _WIN32_ // Stop makefiles from complaining. +#ifdef _WIN32 // Stop makefiles from complaining. #include #include diff --git a/src/Main/Game.cpp b/src/Main/Game.cpp index 0749b66..0b40ed6 100644 --- a/src/Main/Game.cpp +++ b/src/Main/Game.cpp @@ -67,8 +67,7 @@ void Game::OnResize(int width, int height) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); - - gluPerspective(45.0f, float(width) / float(height), 1.0f, 100.0f); + glOrtho(0.0, 800.0, 0.0, 600.0, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity();