Globals.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 Critical logC;
  35. Global HINSTANCE__* _hinst;
  36. Global DLLRegister* dlls;
  37. Global bool debugDX;
  38. Global bool cursorVisible;
  39. Global Logging::LoggingHandler* loggingHandler;
  40. #ifdef WIN32
  41. //! Returns the mouse coordinates on the screen
  42. DLLEXPORT Point getMousePos();
  43. //! Sets the position of the mouse on the screen
  44. DLLEXPORT void setMousePos(const Point& pos);
  45. #endif
  46. //! Returns whether a mouse button is currently pressed
  47. //! \param key The button to check
  48. //! Example: getMouseState( M_Left ); (Requires include <MouseEvent.h>)
  49. DLLEXPORT bool getMouseState(int key);
  50. //! Returns whether a keyboard key is currently pressed
  51. //! \param key The key to check
  52. //! Example: getKeyState( T_Enter ); (Requires include
  53. //! <KeyboardEvent.h>)
  54. DLLEXPORT bool getKeyState(unsigned char key);
  55. //! Initializes the framework.
  56. //! Called automatically in the framework's (WinMain)
  57. DLLEXPORT void initFramework(HINSTANCE__* hInst = 0);
  58. //! Releases the memory used by (initFramework).
  59. //! Called automatically in the framework's (WinMain)
  60. DLLEXPORT void releaseFramework();
  61. //! Checks whether a specific pointer points to a valid Thread object
  62. //! \param t The pointer to check
  63. //! \return 1 if the pointer is valid. 0 if the pointer does not
  64. //! point to an existing Thread object
  65. DLLEXPORT bool isThreadOk(Thread* t);
  66. //! Returns the framework's thread register
  67. DLLEXPORT ThreadRegister* getThreadRegister();
  68. //! Returns the DLL register containing all currently dynamically loaded
  69. //! DLL files
  70. DLLEXPORT DLLRegister* getDLLRegister();
  71. //! Sets DirectX to debug mode
  72. DLLEXPORT void setDebugDX(bool debug);
  73. #ifdef WIN32
  74. //! Returns a reference to the mouse
  75. DLLEXPORT Mouse& getMouse();
  76. //! Sets the mouse cursor visibility
  77. DLLEXPORT void setShowCursor(bool visible);
  78. #endif
  79. } // namespace Framework
  80. #endif