Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Console.cpp 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 "main.h"
  16. #include "Console.h"
  17. #include "utils/strings.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(25, (window->mHeight / 4) - 20, 0.75f, color, "Console");
  40. }
  41. }
  42. void Console::handleKeyboard(KeyboardButton key, bool pressed) {
  43. }
  44. void Console::handleText(char *text, bool notFinished) {
  45. printf("Got %s (%s)\n", (notFinished ? "not finished" : "finished"));
  46. }