MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TileRenderer.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  TileRenderer.h SDL_Surface renderer for the Tile structure
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
27 #ifndef TILERENDERER_H
28 #define TILERENDERER_H
29 
30 #include "Drawing.h"
31 #include "ElementTable.h"
32 #include "Tile.h"
33 #include "Panel.h"
34 #include "Point.h"
35 #include "SDL.h"
36 
37 
38 namespace MFM
39 {
41  {
42  private:
43  bool m_drawGrid;
44  enum DrawRegionType { FULL, NO, EDGE, AGE, AGE_ONLY, MAX} m_drawMemRegions;
45  bool m_drawDataHeat;
46  u32 m_atomDrawSize;
47 
48  bool m_renderSquares;
49 
50  u32 m_gridColor;
51 
52  u32 m_cacheColor;
53  u32 m_sharedColor;
54  u32 m_visibleColor;
55  u32 m_hiddenColor;
56  u32 m_selectedHiddenColor;
57  u32 m_selectedPausedColor;
58 
59  SPoint m_windowTL;
60 
61  Point<u32> m_dimensions;
62 
63  template <class CC>
64  void RenderMemRegions(Drawing & drawing, SPoint& pt,
65  bool renderCache, bool selected, bool lowlight);
66 
67  template <class CC>
68  void RenderVisibleRegionOutlines(Drawing & drawing, SPoint& pt, bool renderCache,
69  bool selected, bool lowlight);
70 
71  template <class CC>
72  void RenderMemRegion(Drawing & drawing, SPoint& pt, int regID,
73  u32 color, bool renderCache);
74 
75  template <class CC>
76  void RenderGrid(Drawing & drawing, SPoint* pt, bool renderCache);
77 
78  void RenderAtomBG(Drawing & drawing, SPoint& offset, Point<int>& atomloc,
79  u32 color);
80 
81  template <class CC>
82  void RenderAtoms(Drawing & drawing, SPoint& pt, Tile<CC>& tile,
83  bool renderCache, bool lowlight);
84 
85  template <class CC>
86  void RenderAtom(Drawing & drawing, const SPoint& atomLoc, const UPoint& rendPt,
87  Tile<CC>& tile, bool lowlight);
88 
89  template <class CC>
90  void RenderBadAtom(Drawing& drawing, const UPoint& rendPt);
91 
92  template <class CC>
93  u32 GetAtomColor(Tile<CC>& tile, const typename CC::ATOM_TYPE& atom, u32 selector = 0);
94 
95  template <class CC>
96  u32 GetDataHeatColor(Tile<CC>& tile, const typename CC::ATOM_TYPE& atom);
97 
98  template <class CC>
99  void RenderEventWindow(Drawing & drawing, SPoint& offset, Tile<CC>& tile, bool renderCache);
100 
101  public:
102 
103  TileRenderer();
104 
105  template <class CC>
106  void RenderTile(Drawing & drawing, Tile<CC>& t, SPoint& loc, bool renderWindow,
107  bool renderCache, bool selected, SPoint* selectedAtom, SPoint* cloneOrigin);
108 
109  void SetDimensions(Point<u32> dimensions)
110  {
111  m_dimensions = dimensions;
112  }
113 
114  bool* GetGridEnabledPointer()
115  {
116  return &m_drawGrid;
117  }
118 
119  void ToggleDrawAtomsAsSquares()
120  {
121  m_renderSquares = !m_renderSquares;
122  }
123 
124  bool* GetDrawDataHeatPointer()
125  {
126  return &m_drawDataHeat;
127  }
128 
129  const SPoint& GetWindowTL() const
130  {
131  return m_windowTL;
132  }
133 
134  void SetWindowTL(const SPoint & newTL)
135  {
136  m_windowTL = newTL;
137  }
138 
139  void IncreaseAtomSize(SPoint around)
140  {
141  ChangeAtomSize(true, around);
142  }
143 
144  void DecreaseAtomSize(SPoint around)
145  {
146  ChangeAtomSize(false, around);
147  }
148 
149  void ChangeAtomSize(bool increase, SPoint around) ;
150 
151  u32 GetAtomSize()
152  {
153  return m_atomDrawSize;
154  }
155 
156  void ToggleGrid();
157 
158  void ToggleMemDraw();
159 
160  void ToggleDataHeat();
161 
162  void MoveUp(u8 amount);
163 
164  void MoveDown(u8 amount);
165 
166  void MoveLeft(u8 amount);
167 
168  void MoveRight(u8 amount);
169  };
170 } /* namespace MFM */
171 
172 #include "TileRenderer.tcc"
173 
174 #endif /*TILERENDERER_H*/
Definition: EventWindow.h:41
Definition: TileRenderer.h:40
Definition: Drawing.h:44