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.

global.h 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*!
  2. * \file include/global.h
  3. * \brief Global typedefs
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _GLOBAL_H_
  8. #define _GLOBAL_H_
  9. #include "config.h"
  10. // Defaults
  11. #define DEFAULT_CONFIG_PATH "~/.OpenRaider"
  12. #define DEFAULT_CONFIG_FILE "OpenRaider.ini"
  13. #define DEFAULT_WIDTH 640
  14. #define DEFAULT_HEIGHT 480
  15. // Visual C++ does not understand __attribute__
  16. #ifdef _MSC_VER
  17. #define __attribute__(x)
  18. #endif
  19. // Globally include OpenGL header
  20. #ifdef __APPLE__
  21. #include <OpenGL/gl.h>
  22. #else
  23. #ifdef HAVE_WINDOWS_H
  24. #include <windows.h>
  25. #endif
  26. #include <GL/gl.h>
  27. #endif
  28. // If available, use our own assert that prints the call stack
  29. #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
  30. #ifndef NDEBUG
  31. [[noreturn]] void assertImplementation(const char *exp, const char *file, int line);
  32. #define assert(x) (void)((x) || (assertImplementation(#x, __FILE__, __LINE__),0))
  33. #else
  34. #define assert(x)
  35. #endif
  36. #else
  37. // Fall back to the default C assert
  38. #include <cassert>
  39. #endif
  40. // Colors used for Rendering
  41. const float BLACK[] = { 0.0f, 0.0f, 0.0f, 1.0f };
  42. const float DIM_WHITE[] = { 0.5f, 0.5f, 0.5f, 1.0f };
  43. const float WHITE[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  44. const float RED[] = { 1.0f, 0.0f, 0.0f, 1.0f };
  45. const float GREEN[] = { 0.0f, 1.0f, 0.0f, 1.0f };
  46. const float NEXT_PURPLE[] = { 0.3f, 0.3f, 0.5f, 1.0f };
  47. const float OR_BLUE[] = { 0.5f, 0.7f, 1.0f, 1.0f };
  48. const float PINK[] = { 1.0f, 0.0f, 1.0f, 1.0f };
  49. const float YELLOW[] = { 1.0f, 1.0f, 0.0f, 1.0f };
  50. const float CYAN[] = { 0.0f, 1.0f, 1.0f, 1.0f };
  51. // Actions that can be bound to a key and sent to the game engine
  52. typedef enum {
  53. menuAction = 0,
  54. consoleAction, // menu and console should always be the first two items
  55. forwardAction,
  56. backwardAction,
  57. leftAction,
  58. rightAction,
  59. jumpAction,
  60. crouchAction,
  61. useAction,
  62. holsterAction,
  63. walkAction,
  64. ActionEventCount // Should always be at the end
  65. } ActionEvents;
  66. // Keys available for binding
  67. typedef enum {
  68. zeroKey = '0', oneKey = '1', twoKey = '2',
  69. threeKey = '3', fourKey = '4', fiveKey = '5',
  70. sixKey = '6', sevenKey = '7', eightKey = '8',
  71. nineKey = '9', aKey = 'a', bKey = 'b',
  72. cKey = 'c', dKey = 'd', eKey = 'e', fKey = 'f',
  73. gKey = 'g', hKey = 'h', iKey = 'i', jKey = 'j',
  74. kKey = 'k', lKey = 'l', mKey = 'm', nKey = 'n',
  75. oKey = 'o', pKey = 'p', qKey = 'q', rKey = 'r',
  76. sKey = 's', tKey = 't', uKey = 'u', vKey = 'v',
  77. wKey = 'w', xKey = 'x', yKey = 'y', zKey = 'z',
  78. quoteKey, backslashKey, backspaceKey, capslockKey,
  79. commaKey, delKey, upKey, downKey, leftKey, rightKey,
  80. endKey, equalsKey, escapeKey, f1Key, f2Key, f3Key, f4Key, f5Key,
  81. f6Key, f7Key, f8Key, f9Key, f10Key, f11Key, f12Key, backquoteKey,
  82. homeKey, insertKey, leftaltKey, leftctrlKey, leftbracketKey,
  83. leftguiKey, leftshiftKey, minusKey, numlockKey, pagedownKey,
  84. pageupKey, pauseKey, dotKey, rightaltKey, rightctrlKey, enterKey,
  85. rightguiKey, rightbracketKey, rightshiftKey, scrolllockKey,
  86. semicolonKey, slashKey, spaceKey, tabKey,
  87. leftmouseKey, middlemouseKey, rightmouseKey,
  88. unknownKey // Should always be at the end
  89. } KeyboardButton;
  90. ActionEvents stringToActionEvent(const char *action);
  91. KeyboardButton stringToKeyboardButton(const char *key);
  92. #endif