/src/C4GraphicsSystem.h

https://bitbucket.org/randrian/openclonk2 · C Header · 125 lines · 95 code · 9 blank · 21 comment · 0 complexity · 0d3f255f40adf13be9665c1e5cf92cd1 MD5 · raw file

  1. /*
  2. * OpenClonk, http://www.openclonk.org
  3. *
  4. * Copyright (c) 1998-2000, 2008 Matthes Bender
  5. * Copyright (c) 2001, 2005, 2008 Sven Eberhardt
  6. * Copyright (c) 2005 G?nther Brammer
  7. * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
  8. *
  9. * Portions might be copyrighted by other authors who have contributed
  10. * to OpenClonk.
  11. *
  12. * Permission to use, copy, modify, and/or distribute this software for any
  13. * purpose with or without fee is hereby granted, provided that the above
  14. * copyright notice and this permission notice appear in all copies.
  15. * See isc_license.txt for full license and disclaimer.
  16. *
  17. * "Clonk" is a registered trademark of Matthes Bender.
  18. * See clonk_trademark_license.txt for full license.
  19. */
  20. /* Operates viewports, message board and draws the game */
  21. #ifndef INC_C4GraphicsSystem
  22. #define INC_C4GraphicsSystem
  23. #include <C4FacetEx.h>
  24. #include <C4MessageBoard.h>
  25. #include <C4UpperBoard.h>
  26. #include <C4Video.h>
  27. #include <C4Shape.h>
  28. class C4Game;
  29. class C4LoaderScreen;
  30. extern C4Game Game;
  31. const float C4GFX_ZoomStep = 1.1040895f;
  32. class C4GraphicsSystem
  33. {
  34. public:
  35. C4GraphicsSystem();
  36. ~C4GraphicsSystem();
  37. C4MessageBoard MessageBoard;
  38. C4UpperBoard UpperBoard;
  39. int32_t iRedrawBackground;
  40. bool ShowHelp;
  41. bool ShowVertices;
  42. bool ShowAction;
  43. bool ShowCommand;
  44. bool ShowEntrance;
  45. bool ShowPathfinder;
  46. bool ShowNetstatus;
  47. bool ShowSolidMask;
  48. BYTE DarkColorTable[256];
  49. bool fSetPalette;
  50. uint32_t dwGamma[C4MaxGammaRamps*3]; // gamma ramps
  51. bool fSetGamma; // must gamma ramp be reassigned?
  52. C4Video Video;
  53. C4LoaderScreen *pLoaderScreen;
  54. void Default();
  55. void Clear();
  56. bool StartDrawing();
  57. void FinishDrawing();
  58. void Execute();
  59. void FlashMessage(const char *szMessage);
  60. void FlashMessageOnOff(const char *strWhat, bool fOn);
  61. void SetDarkColorTable();
  62. void DeactivateDebugOutput();
  63. void MouseMove(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, class C4Viewport *pVP); // pVP specified for console mode viewports only
  64. void SetMouseInGUI(bool fInGUI, bool fByMouse);
  65. void SortViewportsByPlayerControl();
  66. void ClearPointers(C4Object *pObj);
  67. //void UpdateMouse(HWND hwnd, int32_t iX, int32_t iY, int32_t iB);
  68. void RecalculateViewports();
  69. bool Init();
  70. bool InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst);
  71. void EnableLoaderDrawing(); // reset black screen loader flag
  72. bool SaveScreenshot(bool fSaveAll);
  73. bool DoSaveScreenshot(bool fSaveAll, const char *szFilename);
  74. bool SetPalette();
  75. bool CreateViewport(int32_t iPlayer, bool fSilent);
  76. bool CloseViewport(int32_t iPlayer, bool fSilent);
  77. int32_t GetAudibility(int32_t iX, int32_t iY, int32_t *iPan, int32_t iAudibilityRadius=0);
  78. int32_t GetViewportCount();
  79. C4Viewport* GetViewport(int32_t iPlayer);
  80. C4Viewport* GetFirstViewport() { return FirstViewport; }
  81. inline void InvalidateBg() { iRedrawBackground=2; }
  82. inline void OverwriteBg() { InvalidateBg(); }
  83. void SetGamma(DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, int32_t iRampIndex); // set gamma ramp
  84. void ApplyGamma(); // apply gamma ramp to ddraw
  85. bool CloseViewport(C4Viewport * cvp);
  86. #ifdef _WIN32
  87. C4Viewport* GetViewport(HWND hwnd);
  88. BOOL RegisterViewportClass(HINSTANCE hInst);
  89. #endif
  90. protected:
  91. C4Viewport *FirstViewport;
  92. bool fViewportClassRegistered;
  93. C4Facet ViewportArea;
  94. C4RectList BackgroundAreas; // rectangles covering background without viewports in fullscreen
  95. char FlashMessageText[C4MaxTitle+1];
  96. int32_t FlashMessageTime,FlashMessageX,FlashMessageY;
  97. void DrawHelp();
  98. void DrawFlashMessage();
  99. void DrawHoldMessages();
  100. void DrawFullscreenBackground();
  101. void ClearFullscreenBackground();
  102. int32_t SeekLoaderScreens(C4Group &rFromGrp, const char *szWildcard, int32_t iLoaderCount, char *szDstName, C4Group **ppDestGrp);
  103. void MouseMoveToViewport(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam);
  104. public:
  105. bool ToggleShowSolidMask();
  106. bool ToggleShowNetStatus();
  107. bool ToggleShowVertices();
  108. bool ToggleShowAction();
  109. bool ViewportNextPlayer();
  110. bool ToggleShowHelp();
  111. bool FreeScroll(C4Vec2D vScrollBy); // key callback: Scroll ownerless viewport by some offset
  112. bool ViewportZoomOut();
  113. bool ViewportZoomIn();
  114. };
  115. extern C4GraphicsSystem GraphicsSystem;
  116. #endif