Cafu Engine
ToolNewTerrain.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_TOOL_NEW_TERRAIN_HPP_INCLUDED
8 #define CAFU_TOOL_NEW_TERRAIN_HPP_INCLUDED
9 
10 #include "Tool.hpp"
11 #include "Math3D/Vector3.hpp"
12 
13 
14 class MapBrushT;
16 class ViewWindowT;
17 
18 
19 class ToolNewTerrainT : public ToolT
20 {
21  public:
22 
23  ToolNewTerrainT(MapDocumentT& MapDoc, ToolManagerT& ToolMan, wxWindow* ParentOptionsBar);
24 
25  ~ToolNewTerrainT();
26 
27  // Implementations/overrides of ToolT methods.
28  int GetWxEventID() const { return ChildFrameT::ID_MENU_TOOLS_TOOL_NEWTERRAIN; }
29  wxWindow* GetOptionsBar();
30 
31  bool OnKeyDown2D (ViewWindow2DT& ViewWindow, wxKeyEvent& KE);
32  bool OnLMouseDown2D(ViewWindow2DT& ViewWindow, wxMouseEvent& ME);
33  bool OnLMouseUp2D (ViewWindow2DT& ViewWindow, wxMouseEvent& ME);
34  bool OnMouseMove2D (ViewWindow2DT& ViewWindow, wxMouseEvent& ME);
35 
36  bool OnKeyDown3D (ViewWindow3DT& ViewWindow, wxKeyEvent& KE);
37  bool OnLMouseDown3D(ViewWindow3DT& ViewWindow, wxMouseEvent& ME);
38  bool OnMouseMove3D (ViewWindow3DT& ViewWindow, wxMouseEvent& ME);
39 
40  void RenderTool2D(Renderer2DT& Renderer) const;
41  void RenderTool3D(Renderer3DT& Renderer) const;
42 
43  // The TypeSys related declarations for this class.
44  virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; }
45  static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params);
46  static const cf::TypeSys::TypeInfoT TypeInfo;
47 
48 
49  private:
50 
51  bool OnKeyDown(ViewWindowT& ViewWindow, wxKeyEvent& KE);
52  void UpdateNewBrush(ViewWindow2DT& ViewWindow); ///< Updates the m_NewBrush member according to the given drag rectangle.
53 
54  MapBrushT* m_NewBrush; ///< The new brush that is currently being dragged, or NULL when no dragging is in progress.
55  Vector3fT m_DragBegin; ///< The point in world space where the dragging began (first corner of the dragging rectangle).
56  Vector3fT m_DragCurrent; ///< The current point in world space of the drag (second corner of the dragging rectangle).
57 
58  OptionsBar_NewTerrainToolT* m_OptionsBar; ///< The options bar for this tool.
59 };
60 
61 #endif
This class provides auxiliary means for rendering a 3D view.
Definition: Renderer3D.hpp:30
This class implements the rendering into a 2D view.
Definition: Renderer2D.hpp:22
int GetWxEventID() const
Returns the ID of the wxWidgets event (menu selection or toolbar button click) that is associated wit...
Definition: ToolNewTerrain.hpp:28
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
bool OnLMouseDown2D(ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction).
Definition: ToolNewTerrain.cpp:77
bool OnLMouseDown3D(ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction).
Definition: ToolNewTerrain.cpp:226
Definition: MapBrush.hpp:15
This class represents a (superclass of a) 2D or 3D map view window.
Definition: ChildFrameViewWin.hpp:21
Definition: ToolNewTerrain.hpp:19
wxWindow * GetOptionsBar()
Returns the options bar window associated with this tool. NULL if no options bar has been assigned...
Definition: ToolNewTerrain.cpp:63
The options bar for the New Terrain tool.
Definition: ToolOptionsBars.hpp:154
Definition: ChildFrameViewWin2D.hpp:24
Definition: ChildFrameViewWin3D.hpp:21
Definition: ToolManager.hpp:20
This is the base class for all tools in the map editor.
Definition: Tool.hpp:34
Definition: TypeSys.hpp:52
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79