diff --git a/Bin/LibD b/Bin/LibD deleted file mode 100755 index 4eac3ac..0000000 Binary files a/Bin/LibD and /dev/null differ diff --git a/src/Main/GLWindow.h b/src/Main/GLWindow.h index 53bee91..d115c7b 100644 --- a/src/Main/GLWindow.h +++ b/src/Main/GLWindow.h @@ -12,10 +12,10 @@ public: bool Create(int width, int height, int bpp, bool fullscreen); void Destroy(bool); void ProcessEvents(void); - void AttachGame(Game* game) { _game = game; } + void AttachGame(Game* game) { _game = game; } - bool IsRunning(void) { return _isRunning; } - void SwapBuffers(void) { SwapBuffers(_hdc); } + bool IsRunning(void) { return _isRunning; } + void SwapBuffers(void) { SwapBuffers(_hdc); } static LRESULT CALLBACK StaticWndProc(HWND wnd, UINT msg, WPARAP wParam, LPARAM lParam); LRESULT CALLBACK WndProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -27,15 +27,15 @@ private: Game* GetAttachedGame(void) { return _game; } // A pointer to the application. - Game* _game; - bool _isRunning; - bool _isFullScreen; - float _lastTime; + Game* _game; + bool _isRunning; + bool _isFullScreen; + float _lastTime; - HWND _hwnd; // Window handle. - HGLRC _hglrc; // Rendering context. - HDC _hdc; // Device context. - RECT _windowRect; // Window bound. - HINSTANCE _hinstance; // Application instance. - WNDCLASSEX _windowClass; + HWND _hwnd; // Window handle. + HGLRC _hglrc; // Rendering context. + HDC _hdc; // Device context. + RECT _windowRect; // Window bound. + HINSTANCE _hinstance; // Application instance. + WNDCLASSEX _windowClass; } diff --git a/src/Main/Game.cpp b/src/Main/Game.cpp index 240a1cb..ff81f28 100644 --- a/src/Main/Game.cpp +++ b/src/Main/Game.cpp @@ -27,7 +27,7 @@ void Game::Prepare(float dt) { const float SPEED = 15.0f; _rotationAngle += SPEED*dt; if(_rotationAngle > 360.0f) { - _rotationAngle -= 360.0f; + _rotationAngle -= 360.0f; } } diff --git a/src/Main/LGLXWindow.cpp b/src/Main/LGLXWindow.cpp index 76a4c7b..4037f86 100644 --- a/src/Main/LGLXWindow.cpp +++ b/src/Main/LGLXWindow.cpp @@ -11,7 +11,7 @@ using std::string; //typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display* dpy, GLXFBConfig config, -// GLXContext share_context, bool direct, const int* attrib_list); +// GLXContext share_context, bool direct, const int* attrib_list); unsigned int GetTickCount(void) { struct timeval t; @@ -23,18 +23,18 @@ unsigned int GetTickCount(void) { } LGLXWindow::LGLXWindow(void) : - _game(NULL), - _isRunning(true), - _lastTime(0), - _display(NULL), - _xWindow(0), - _glContext(0), - _screenID(0), - _isFullscreen(false), - _width(0), - _height(0), - _bpp(0), - _GL3Supported(false) {} + _game(NULL), + _isRunning(true), + _lastTime(0), + _display(NULL), + _xWindow(0), + _glContext(0), + _screenID(0), + _isFullscreen(false), + _width(0), + _height(0), + _bpp(0), + _GL3Supported(false) {} LGLXWindow::~LGLXWindow(void) { @@ -57,61 +57,61 @@ bool LGLXWindow::Create(int width, int height, int bpp, bool fullscreen) { XF86VidModeModeInfo **modes; if(!XF86VidModeGetAllModeLines(_display, _screenID, &modeNum, &modes)) { - std::cerr << "Could not query the video modes." << std::endl; - return false; + std::cerr << "Could not query the video modes." << std::endl; + return false; } _XF86DeskMode = *modes[0]; int bestMode = -1; for(int i = 0; i < modeNum; i++) { - if((modes[i]->hdisplay == width) && (modes[i]->vdisplay == height)) { - bestMode = i; + if((modes[i]->hdisplay == width) && (modes[i]->vdisplay == height)) { + bestMode = i; } } if(bestMode == -1) { - std::cerr << "Could not find a suitable graphics mode." << std::endl; - return false; + std::cerr << "Could not find a suitable graphics mode." << std::endl; + return false; } int doubleBufferedAttribList[] = { - GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, - GLX_BLUE_SIZE, 4, - GLX_DEPTH_SIZE, 16, - None + GLX_RGBA, GLX_DOUBLEBUFFER, + GLX_RED_SIZE, 4, + GLX_GREEN_SIZE, 4, + GLX_BLUE_SIZE, 4, + GLX_DEPTH_SIZE, 16, + None }; XVisualInfo* vi = NULL; // Attempt to create a double buffered window. vi = glXChooseVisual(_display, _screenID, doubleBufferedAttribList); if(!vi) { - std::cerr << "Could not create a double buffere window.. Sux.." <screen), vi->visual, AllocNone); - _XSetAttr.colormap = cmap; - _XSetAttr.border_pixel = 0; - _XSetAttr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | - StructureNotifyMask; + _XSetAttr.colormap = cmap; + _XSetAttr.border_pixel = 0; + _XSetAttr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | + StructureNotifyMask; _XSetAttr.override_redirect = False; //unsigned long windowAttributes = CWBorderPixel | CWColormap | CWEventMask; @@ -138,8 +138,8 @@ bool LGLXWindow::Create(int width, int height, int bpp, bool fullscreen) { } _xWindow = XCreateWindow(_display, RootWindow(_display, vi->screen), - 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, - CWBorderPixel | CWColormap | CWEventMask, &_XSetAttr); + 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, + CWBorderPixel | CWColormap | CWEventMask, &_XSetAttr); string title = "LibD"; if(fullscreen) { @@ -147,7 +147,7 @@ bool LGLXWindow::Create(int width, int height, int bpp, bool fullscreen) { XMapRaised(_display, _xWindow); XGrabKeyboard(_display, _xWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); XGrabPointer(_display, _xWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, - _xWindow, None, CurrentTime); + _xWindow, None, CurrentTime); } else { Atom wmDelete = XInternAtom(_display, "WM_DELETE_WINDOW", True); XSetWMProtocols(_display, _xWindow, &wmDelete, 1); @@ -159,17 +159,17 @@ bool LGLXWindow::Create(int width, int height, int bpp, bool fullscreen) { glXMakeCurrent(_display, _xWindow, _glContext); - int posX = 0; - int posY = 0; + int posX = 0; + int posY = 0; Window winDummy; unsigned int borderDummy; - _width = (unsigned) width; + _width = (unsigned) width; _height = (unsigned) height; - _bpp = (unsigned) bpp; + _bpp = (unsigned) bpp; XGetGeometry(_display, _xWindow, &winDummy, &posX, &posY, - &_width, &_height, &borderDummy, &_bpp); + &_width, &_height, &borderDummy, &_bpp); // Init the time. _lastTime = GetTickCount(); @@ -202,17 +202,17 @@ void LGLXWindow::ProcessEvents(void) { break; case ConfigureNotify: { - int width = event.xconfigure.width; - int height = event.xconfigure.height; + int width = event.xconfigure.width; + int height = event.xconfigure.height; GetAttachedGame()->OnResize(width, height); } break; case KeyPress: { if(XLookupKeysym(&event.xkey, 0) == XK_Escape) { - _isRunning = false; + _isRunning = false; } - // Register the key press with keyboard interface. + // Register the key press with keyboard interface. } break; case KeyRelease: diff --git a/src/Main/main.cpp b/src/Main/main.cpp index 89daef3..8e8e129 100644 --- a/src/Main/main.cpp +++ b/src/Main/main.cpp @@ -18,10 +18,10 @@ int WINAPI winMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdLine, int main(int argc, char** argv) { #endif // Get our window settings. - const int windowWidth = 800; - const int windowHeight = 600; - const int windowBPP = 16; - const int windowFullscreen = false; + const int windowWidth = 800; + const int windowHeight = 600; + const int windowBPP = 16; + const int windowFullscreen = false; #ifdef _WIN32_ // This is our window. @@ -41,29 +41,29 @@ int main(int argc, char** argv) { #ifdef _WIN32_ MessageBox(NULL, "Unable to create the OpenGL Window", "An error occured", MB_ICONERROR | MB_OK); #endif - programWindow.Destroy(); // Reset the display and exit. + programWindow.Destroy(); // Reset the display and exit. return 1; } - if(!game.Init()) { // Initialize our game. + if(!game.Init()) { // Initialize our game. #ifdef _WIN32_ MessageBox(NULL, "Could not initialize the application", "An error occured", MB_ICONERROR | MB_OK); #endif - programWindow.Destroy(); // Reset the display and exit. + programWindow.Destroy(); // Reset the display and exit. return 1; } // This is the main loop, we render frames until IsRunning returns false. while(programWindow.IsRunning()) { - programWindow.ProcessEvents(); // Process any window events. + programWindow.ProcessEvents(); // Process any window events. // We get the time that passed since the last frame. float elapsedTime = programWindow.GetElapsedSeconds(); - game.Prepare(elapsedTime); // Do any pre-rendering logic. - game.Render(); // Render the scene. + game.Prepare(elapsedTime); // Do any pre-rendering logic. + game.Render(); // Render the scene. programWindow.SwapBuffers(); } - game.Shutdown(); // Free any resouces. - programWindow.Destroy(); // Destroy the program window. + game.Shutdown(); // Free any resouces. + programWindow.Destroy(); // Destroy the program window. return 0; }