Global.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifdef WIN32
  2. #include <Windows.h>
  3. #include <GdiPlus.h>
  4. #pragma comment( lib, "gdiplus.lib" )
  5. #include "Fenster.h"
  6. #include "Maus.h"
  7. #include "Model3DList.h"
  8. #include "TexturList.h"
  9. #endif
  10. #define Global
  11. #include "Globals.h"
  12. #include "Thread.h"
  13. void Framework::initFramework()
  14. {
  15. if( istInitialisiert )
  16. return;
  17. #ifdef WIN32
  18. Gdiplus::GdiplusStartupInput gdiplusStartupInput;
  19. ULONG_PTR gdiplusToken;
  20. Gdiplus::GdiplusStartup( &gdiplusToken, &gdiplusStartupInput, 0 );
  21. msgExit = 0;
  22. MausTrack = 1;
  23. for( int i = 0; i < 255; ++i )
  24. TastenStand[ i ] = 0;
  25. for( int i = 0; i < 3; ++i )
  26. MausStand[ i ] = 0;
  27. Model3DList::init();
  28. m3dRegister = new Model3DList();
  29. TexturList::init();
  30. texturRegister = new TexturList();
  31. #endif
  32. istInitialisiert = 1;
  33. thRegister = new ThreadRegister();
  34. }
  35. void Framework::releaseFramework()
  36. {
  37. if( !istInitialisiert )
  38. return;
  39. thRegister->cleanUpClosedThreads();
  40. delete thRegister;
  41. #ifdef WIN32
  42. m3dRegister->release();
  43. Model3DList::destroy();
  44. texturRegister->release();
  45. TexturList::destroy();
  46. #endif
  47. istInitialisiert = 0;
  48. }
  49. bool Framework::istThreadOk( Thread *t )
  50. {
  51. return thRegister->isThread( t );
  52. }
  53. // Gibt das Thread Register des Frameworks zurück
  54. Framework::ThreadRegister *Framework::getThreadRegister()
  55. {
  56. return thRegister;
  57. }
  58. #ifdef WIN32
  59. const Framework::Punkt &Framework::getMausPos()
  60. {
  61. return mausPos;
  62. }
  63. bool Framework::getMausStand( int taste )
  64. {
  65. return MausStand[ taste ];
  66. }
  67. void Framework::setTastenStand( unsigned char taste, bool st )
  68. {
  69. TastenStand[ taste ] = st;
  70. }
  71. bool Framework::getTastenStand( unsigned char taste )
  72. {
  73. return TastenStand[ taste ];
  74. }
  75. // Gibt das Model3DData Register des Frameworks ohne erhöhten reference Counter zurück
  76. Framework::Model3DList *Framework::zM3DRegister()
  77. {
  78. return m3dRegister;
  79. }
  80. // Gibt das Textur Register des Frameworks ohne erhöhten reference Counter zurück
  81. Framework::TexturList *Framework::zTexturRegister()
  82. {
  83. return texturRegister;
  84. }
  85. #endif