Globals.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef Globals_H
  2. #define Globals_H
  3. #include "Critical.h"
  4. #include "Point.h"
  5. #ifdef WIN32
  6. # include "Mouse.h"
  7. # include "Window.h"
  8. #endif
  9. #ifndef Global
  10. # define Global extern
  11. #endif
  12. struct HINSTANCE__; //! windows.h
  13. namespace Framework
  14. {
  15. class ThreadRegister; //! Thread.h
  16. class Thread; //! Thread.h
  17. class Model3DList; //! Model3DList.h
  18. class TextureList; //! TextureList.h
  19. class File; //! File.h
  20. class DLLRegister; //! DLLRegister.h
  21. namespace Logging
  22. {
  23. class LoggingHandler; //! LoggingHandler.h
  24. }
  25. #ifdef WIN32
  26. Global NativeWindowArray nativeWindows;
  27. Global bool MouseTrack;
  28. Global Mouse mousePointer;
  29. Global bool msgExit;
  30. #endif
  31. Global bool MouseState[3];
  32. Global bool isInitialized;
  33. Global ThreadRegister* thRegister;
  34. Global HINSTANCE__* _hinst;
  35. Global DLLRegister* dlls;
  36. Global bool debugDX;
  37. Global bool cursorVisible;
  38. Global Logging::LoggingHandler* loggingHandler;
  39. Global thread_local int currentThreadId;
  40. Global thread_local int currentThreadLockCount;
  41. #ifdef WIN32
  42. //! Returns the mouse coordinates on the screen
  43. DLLEXPORT Point getMousePos();
  44. //! Sets the position of the mouse on the screen
  45. DLLEXPORT void setMousePos(const Point& pos);
  46. #endif
  47. //! Returns whether a mouse button is currently pressed
  48. //! \param key The button to check
  49. //! Example: getMouseState( M_Left ); (Requires include <MouseEvent.h>)
  50. DLLEXPORT bool getMouseState(int key);
  51. //! Returns whether a keyboard key is currently pressed
  52. //! \param key The key to check
  53. //! Example: getKeyState( T_Enter ); (Requires include
  54. //! <KeyboardEvent.h>)
  55. DLLEXPORT bool getKeyState(unsigned char key);
  56. //! Initializes the framework.
  57. //! Called automatically in the framework's (WinMain)
  58. DLLEXPORT void initFramework(HINSTANCE__* hInst = 0);
  59. //! Releases the memory used by (initFramework).
  60. //! Called automatically in the framework's (WinMain)
  61. DLLEXPORT void releaseFramework();
  62. //! Checks whether a specific pointer points to a valid Thread object
  63. //! \param t The pointer to check
  64. //! \return 1 if the pointer is valid. 0 if the pointer does not
  65. //! point to an existing Thread object
  66. DLLEXPORT bool isThreadOk(Thread* t);
  67. //! Returns the framework's thread register
  68. DLLEXPORT ThreadRegister* getThreadRegister();
  69. //! Returns the DLL register containing all currently dynamically loaded
  70. //! DLL files
  71. DLLEXPORT DLLRegister* getDLLRegister();
  72. //! Sets DirectX to debug mode
  73. DLLEXPORT void setDebugDX(bool debug);
  74. #ifdef WIN32
  75. //! Returns a reference to the mouse
  76. DLLEXPORT Mouse& getMouse();
  77. //! Sets the mouse cursor visibility
  78. DLLEXPORT void setShowCursor(bool visible);
  79. #endif
  80. //! returns the id of the current thread
  81. DLLEXPORT int getCurrentThreadId();
  82. //! returns the amount of locks that the current thread holds
  83. DLLEXPORT int getCurrentThreadLockCount();
  84. } // namespace Framework
  85. #endif