Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Console.cpp 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. * \file src/Console.cpp
  3. * \brief Console 'overlay'
  4. *
  5. * \author xythobuz
  6. */
  7. #ifdef __APPLE__
  8. #include <OpenGL/gl.h>
  9. #include <OpenGL/glu.h>
  10. #else
  11. #include <GL/gl.h>
  12. #include <GL/glu.h>
  13. #endif
  14. #include "config.h"
  15. #include "Console.h"
  16. #include "main.h"
  17. #include "utils/time.h"
  18. Console::Console() {
  19. mVisible = false;
  20. }
  21. Console::~Console() {
  22. }
  23. void Console::setVisible(bool visible) {
  24. mVisible = visible;
  25. gOpenRaider->mWindow->setTextInput(mVisible);
  26. }
  27. bool Console::isVisible() {
  28. return mVisible;
  29. }
  30. void Console::display() {
  31. Window *window = gOpenRaider->mWindow;
  32. unsigned char color[4] = {0xFF, 0xFF, 0xFF, 0xFF};
  33. if (mVisible) {
  34. // Draw half-transparent *overlay*
  35. glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
  36. glDisable(GL_TEXTURE_2D);
  37. glRecti(0, 0, window->mWidth, window->mHeight / 2);
  38. glEnable(GL_TEXTURE_2D);
  39. gOpenRaider->mWindow->drawText(10, 10, 0.50f, color, "%lus uptime %s", systemTimerGet() / 1000, VERSION);
  40. }
  41. }
  42. void Console::handleKeyboard(KeyboardButton key, bool pressed) {
  43. if (pressed && (key == enter)) {
  44. }
  45. }
  46. void Console::handleText(char *text, bool notFinished) {
  47. printf("Got %s (%s)\n", text, (notFinished ? "not finished" : "finished"));
  48. }