TerrainInterface.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. #if !defined(AFX_TERRAININTERFACE_H__539D0786_D5B8_4079_A285_DA2C86EC7543__INCLUDED_)
  13. #define AFX_TERRAININTERFACE_H__539D0786_D5B8_4079_A285_DA2C86EC7543__INCLUDED_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif // _MSC_VER > 1000
  17. // TerrainInterface.h : header file
  18. //
  19. #define TEM_HEIGHTMAP 0
  20. #define TEM_LAYER 1
  21. #define CT_EDIT_MODES 2
  22. #define TBM_PAINT 0
  23. #define TBM_SMOOTH 1
  24. #define TBM_FILTER 2
  25. #define TBM_MINIMUM 3
  26. #define TBM_MAXIMUM 4
  27. #define TBM_FLATTEN 5
  28. #define TBM_POSTERIZE 6
  29. #define TBM_RND_NOISE 7
  30. #define TBM_CONTINOUS_NOISE 8
  31. #define TBM_ERASE 9
  32. #define CT_BRUSH_MODES 10
  33. struct CTerrainEditBrush {
  34. FLOAT teb_fHotSpot;
  35. FLOAT teb_fFallOff;
  36. };
  37. extern CTFileName GetBrushTextureName(INDEX iBrush);
  38. extern CTerrainEditBrush atebDefaultEditBrushValues[];
  39. extern CTerrainEditBrush atebCustomEditBrushes[];
  40. extern void InvokeTerrainTilePalette( PIX pixX, PIX pixY);
  41. extern void InvokeTerrainBrushPalette( PIX pixX, PIX pixY);
  42. extern void RenderBrushShape( INDEX iBrush, PIXaabbox2D rect, CDrawPort *pdp);
  43. extern void GetEditingModeInfo(INDEX iMode, INDEX &iIcon, CTString &strText);
  44. extern CBrushPaletteWnd *_pBrushPalette;
  45. extern void GenerateTerrainBrushTexture( INDEX iBrush, FLOAT fHotSpot, FLOAT fFallOff);
  46. extern void GenerateNonExistingTerrainEditBrushes(void);
  47. extern void ApplyImportExport(INDEX iSelectedItem);
  48. extern void DisplayHeightMapWindow(CPoint pt);
  49. void GetBrushModeInfo(INDEX iMode, INDEX &iIcon, CTString &strText);
  50. #define CT_BRUSHES 32
  51. #define BRUSH_PALETTE_WIDTH (128-1)
  52. #define BRUSH_PALETTE_HEIGHT (256-1)
  53. #define TILE_PALETTE_WIDTH (256-1)
  54. #define TILE_PALETTE_HEIGHT (256-1)
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CTerrainInterface window
  57. struct CTIButton {
  58. FLOAT tib_fx;
  59. FLOAT tib_fy;
  60. FLOAT tib_fdx;
  61. FLOAT tib_fdy;
  62. INDEX tib_iIcon;
  63. COLOR tib_colBorderColor;
  64. COLOR tib_colFill;
  65. FLOAT tib_fDataMin;
  66. FLOAT tib_fDataMax;
  67. FLOAT tib_fDataDelta;
  68. BOOL tib_bWrapData;
  69. BOOL tib_bMouseTrapForMove;
  70. BOOL tib_bContinueTesting;
  71. FLOAT *tib_pfData1;
  72. FLOAT *tib_pfData2;
  73. INDEX tib_iLayer;
  74. CTString tib_strToolTip;
  75. void (*tib_pOnRender)(CTIButton *ptib, CDrawPort *pdp);
  76. void (*tib_pOnLeftClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp);
  77. void (*tib_pOnLeftClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp);
  78. void (*tib_pOnRightClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp);
  79. void (*tib_pOnRightClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp);
  80. void (*tib_pPreRender)(CTIButton *ptib, CDrawPort *pdp);
  81. // misc functions
  82. void (*tib_pOnDropFiles)(CTIButton *ptib, CPoint pt, CDrawPort *pdp, CTFileName fnFile);
  83. CTString (*tib_pGetClickMoveData)(CTIButton *ptib, CPoint pt, CDrawPort *pdp, BOOL bLmb);
  84. BOOL (*tib_pIsEnabled)(CTIButton *ptib);
  85. // construction
  86. CTIButton();
  87. void SetData( FLOAT fDataMin, FLOAT fDataMax, FLOAT fDataDelta,
  88. BOOL bWrap=FALSE, FLOAT *pfData1=NULL, FLOAT *pfData2=NULL);
  89. void SetFunctions(
  90. void (*pOnRender)(CTIButton *ptib, CDrawPort *pdp)=NULL,
  91. void (*pOnLeftClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp)=NULL,
  92. void (*pOnLeftClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp)=NULL,
  93. void (*pOnRightClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp)=NULL,
  94. void (*pOnRighClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp)=NULL,
  95. void (*pPreRender)(CTIButton *ptib, CDrawPort *pdp)=NULL);
  96. };
  97. class CTerrainInterface : public CWnd
  98. {
  99. // Construction
  100. public:
  101. CTerrainInterface();
  102. void InitializeInterface(CDrawPort *pdp);
  103. CDrawPort *m_pDrawPort;
  104. CViewPort *m_pViewPort;
  105. COleDataSource m_DataSource;
  106. INDEX m_iBrush;
  107. INDEX m_iOpacity;
  108. INDEX m_iEditMode;
  109. CPoint m_ptMouse;
  110. CPoint m_ptMouseDown;
  111. CPoint m_ptMouseDownScreen;
  112. CPoint m_ptMouseCenter;
  113. CPoint m_ptMouseCenterScreen;
  114. CUpdateableRT m_udTerrainPage;
  115. CUpdateableRT m_udTerrainPageCanvas;
  116. // Attributes
  117. public:
  118. // Operations
  119. public:
  120. void OnIdle(void);
  121. int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const;
  122. void HideCursor(void);
  123. void UnhideCursor(void);
  124. // Overrides
  125. // ClassWizard generated virtual function overrides
  126. //{{AFX_VIRTUAL(CTerrainInterface)
  127. public:
  128. virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  129. virtual BOOL PreTranslateMessage(MSG* pMsg);
  130. //}}AFX_VIRTUAL
  131. // Implementation
  132. public:
  133. virtual ~CTerrainInterface();
  134. void RenderInterface(CDrawPort *pDP);
  135. BOOL IsClicked(CTIButton &tib, CPoint pt) const;
  136. // Generated message map functions
  137. protected:
  138. //{{AFX_MSG(CTerrainInterface)
  139. afx_msg void OnPaint();
  140. afx_msg void OnDestroy();
  141. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  142. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  143. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  144. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  145. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  146. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  147. afx_msg void OnDropFiles(HDROP hDropInfo);
  148. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  149. //}}AFX_MSG
  150. DECLARE_MESSAGE_MAP()
  151. };
  152. /////////////////////////////////////////////////////////////////////////////
  153. //{{AFX_INSERT_LOCATION}}
  154. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  155. #endif // !defined(AFX_TERRAININTERFACE_H__539D0786_D5B8_4079_A285_DA2C86EC7543__INCLUDED_)