Open Source Tomb Raider Engine
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

GLUTSystem.cpp 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  4. * Project : UnRaider
  5. * Author : Terry 'Mongoose' Hendrix II
  6. * Website : http://www.westga.edu/~stu7440/
  7. * Email : stu7440@westga.edu
  8. * Object : GLUTSystem
  9. * License : No use w/o permission (C) 2002 Mongoose
  10. * Comments:
  11. *
  12. *
  13. * This file was generated using Mongoose's C++
  14. * template generator script. <stu7440@westga.edu>
  15. *
  16. *-- History -------------------------------------------------
  17. *
  18. * 2002.08.09:
  19. * Mongoose - Created
  20. =================================================================*/
  21. #include <stdlib.h>
  22. #include <stdio.h>
  23. #include <string.h>
  24. #ifdef __APPLE__
  25. #include <OpenGL/gl.h>
  26. #include <OpenGL/glu.h>
  27. #include <GLUT/glut.h>
  28. #else
  29. #include <GL/gl.h>
  30. #include <GL/glu.h>
  31. #include <GL/glut.h>
  32. #endif
  33. #ifdef PS2_LINUX
  34. # include "ps2.h"
  35. #endif
  36. #include "GLUTSystem.h"
  37. // Mongoose 2003.06.03, Updated to modern times since the wheel
  38. // was invented, no longer propagate crap up to System
  39. GLUTSystem gGlutSystem;
  40. ////////////////////////////////////////////////////////////
  41. // Constructors
  42. ////////////////////////////////////////////////////////////
  43. GLUTSystem::GLUTSystem() : System()
  44. {
  45. }
  46. GLUTSystem::~GLUTSystem()
  47. {
  48. }
  49. ////////////////////////////////////////////////////////////
  50. // Public Accessors
  51. ////////////////////////////////////////////////////////////
  52. ////////////////////////////////////////////////////////////
  53. // Public Mutators
  54. ////////////////////////////////////////////////////////////
  55. void display(void)
  56. {
  57. gGlutSystem.gameFrame();
  58. }
  59. void reshape(int w, int h)
  60. {
  61. gGlutSystem.resizeGL(w, h);
  62. }
  63. void key(unsigned char k, int x, int y)
  64. {
  65. gGlutSystem.handleKeyEvent(k, 0);
  66. }
  67. void special(int key, int x, int y)
  68. {
  69. gGlutSystem.handleKeyEvent(key, 0);
  70. }
  71. void GLUTSystem::shutdown(int i)
  72. {
  73. //#ifdef DEBUG_MEMEORY
  74. //printf("[Mongoose MEMEORY_DEBUG]\nUnfreed memory table:\n");
  75. //dump_memory_report();
  76. //#endif
  77. printf("\n\n\tThanks for testing %s\n", VERSION);
  78. printf("\tPlease file bug reports and submit video card performance\n\n");
  79. printf("\tBuild date : %s @ %s\n", __DATE__, __TIME__);
  80. printf("\tBuild host : %s\n", BUILD_HOST);
  81. printf("\tEmail bugs : mongoose@users.sourceforge.net\n");
  82. printf("\tWeb site : http://openraider.sourceforge.net\n\n");
  83. exit(0);
  84. }
  85. void GLUTSystem::initVideo(unsigned int width, unsigned int height,
  86. bool fullscreen)
  87. {
  88. glutInit(NULL, 0);
  89. printf("@Created OpenGL Context...\n");
  90. m_width = width;
  91. m_height = height;
  92. if (fullscreen)
  93. {
  94. }
  95. glutReshapeFunc(reshape);
  96. glutDisplayFunc(display);
  97. glutKeyboardFunc(key);
  98. glutSpecialFunc(special);
  99. // Start game renderer
  100. initGL();
  101. // Resize context
  102. resizeGL(width, height);
  103. }
  104. void GLUTSystem::runGame()
  105. {
  106. glutMainLoop();
  107. }
  108. void GLUTSystem::toggleFullscreen()
  109. {
  110. }
  111. void GLUTSystem::swapBuffersGL()
  112. {
  113. glutSwapBuffers();
  114. }
  115. ////////////////////////////////////////////////////////////
  116. // Private Accessors
  117. ////////////////////////////////////////////////////////////
  118. ////////////////////////////////////////////////////////////
  119. // Private Mutators
  120. ////////////////////////////////////////////////////////////
  121. ////////////////////////////////////////////////////////////
  122. // Unit Test code
  123. ////////////////////////////////////////////////////////////
  124. #ifdef UNIT_TEST_GLUTSYSTEM
  125. int runGLUTSystemUnitTest(int argc, char *argv[])
  126. {
  127. return 0;
  128. }
  129. int main(int argc, char *argv[])
  130. {
  131. GLUTSystem test;
  132. printf("[GLUTSystem class test]\n");
  133. return runGLUTSystemUnitTest(argc, argv);
  134. }
  135. #endif