MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AbstractGUIDriver.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  AbstractGUIDriver.h Base class for all GUI-based MFM drivers
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 
28 #ifndef ABSTRACTGUIDRIVER_H
29 #define ABSTRACTGUIDRIVER_H
30 
31 #include <sys/stat.h> /* for mkdir */
32 #include <sys/types.h> /* for mkdir */
33 #include <errno.h> /* for errno */
34 #include "Utils.h" /* for GetDateTimeNow */
35 #include "Logger.h"
36 #include "AssetManager.h"
37 #include "AbstractButton.h"
38 #include "AbstractCheckbox.h"
39 #include "AtomViewPanel.h"
40 #include "Tile.h"
41 #include "GridRenderer.h"
42 #include "GridPanel.h"
43 #include "TextPanel.h"
44 #include "ToolboxPanel.h"
45 #include "TeeByteSink.h"
46 #include "StatsRenderer.h"
47 #include "Element_Empty.h" /* Need common elements */
48 #include "Element_Dreg.h"
49 #include "Element_Res.h"
50 #include "Element_Wall.h"
51 #include "Element_Consumer.h"
52 #include "ExternalConfig.h"
53 #include "FileByteSource.h"
54 #include "Keyboard.h"
55 #include "Camera.h"
56 #include "AbstractDriver.h"
57 #include "VArguments.h"
58 #include "SDL.h"
59 #include "SDL_ttf.h"
60 #include "HelpPanel.h"
61 #include "MovablePanel.h"
62 
63 namespace MFM
64 {
65 #define FRAMES_PER_SECOND 100.0
66 
67 #define CAMERA_SLOW_SPEED 2
68 #define CAMERA_FAST_SPEED 50
69 
70 #define STATS_WINDOW_WIDTH 288
71 
72 #define STATS_START_WINDOW_WIDTH STATS_WINDOW_WIDTH // Why two constants?
73 #define STATS_START_WINDOW_HEIGHT 120
74 
75  /* super speedy for now */
76 #define MINIMAL_START_WINDOW_WIDTH 1
77 #define MINIMAL_START_WINDOW_HEIGHT 1
78 
79 
80 #define MAX_PATH_LENGTH 1000
81 #define MIN_PATH_RESERVED_LENGTH 100
82 
83  template<class GC>
84  class AbstractGUIDriver : public AbstractDriver<GC>
85  {
86  private:
87  typedef AbstractDriver<GC> Super;
88 
89  protected:
90  typedef typename Super::OurGrid OurGrid;
91  typedef typename Super::CC CC;
92  enum { W = GC::GRID_WIDTH};
93  enum { H = GC::GRID_HEIGHT};
94 
95  bool m_startPaused;
96  bool m_thisUpdateIsEpoch;
97  bool m_bigText;
98  u32 m_thisEpochAEPS;
99  bool m_captureScreenshots;
100  u32 m_saveStateIndex;
101  u32 m_epochSaveStateIndex;
102 
103  bool m_keyboardPaused; // Toggled by keyboard space, ' ', SDLK_SPACE
104  bool m_singleStep; // Toggled by Step check box, 's', SDLK_SPACE
105  bool m_mousePaused; // Set if any buttons down, clear if all up
106  bool m_gridPaused; // Set if keyboard || mouse paused, checked by UpdateGrid
107  bool m_reinitRequested;
108  void RequestReinit()
109  {
110  m_reinitRequested = true;
111  }
112 
113  bool m_renderStats;
114  u32 m_ticksLastStopped;
115 
116  //s32 m_recordScreenshotPerAEPS;
117  //s32 m_maxRecordScreenshotPerAEPS;
118  //s32 m_countOfScreenshotsAtThisAEPS;
119  //s32 m_countOfScreenshotsPerRate;
120  //u32 m_nextEventCountsAEPS;
121  //u32 m_nextScreenshotAEPS;
122  //u32 m_nextTimeBasedDataAEPS;
123 
124  Keyboard m_keyboard;
125  Camera camera;
126  SDL_Surface* screen;
127  Panel m_rootPanel;
128  Drawing m_rootDrawing;
129 
130  u32 m_screenWidth;
131  u32 m_screenHeight;
132 
133 
134  /************************************/
135  /*******ABSTRACT BUTTONS*************/
136  /************************************/
137 
139  {
140  public:
141  void SetDriver(AbstractGUIDriver & driver)
142  {
143  m_driver = &driver;
144  }
145 
146  void SetGridRenderer(GridRenderer& grend)
147  {
148  m_grend = &grend;
149  }
150 
151  protected:
152  AbstractGUIDriver * m_driver;
153 
154  GridRenderer* m_grend;
155 
156  AbstractGridButton(const char* title) :
157  AbstractButton(title), m_driver(0),
158  m_grend(NULL)
159  { }
160  };
161 
163  {
164  public:
165  void SetDriver(AbstractGUIDriver & driver)
166  {
167  m_driver = &driver;
168  }
169 
170  protected:
171  AbstractGUIDriver * m_driver;
172 
173  AbstractGridCheckbox(const char* title) :
175  m_driver(0)
176  { }
177  };
178 
179  /************************************/
180  /******CONCRETE BUTTONS**************/
181  /************************************/
182 
183 
185  {
186  public:
187  ClearButton() : AbstractGridButton("Clear Tile")
188  {
189  AbstractButton::SetName("ClearButton");
190  Panel::SetDimensions(200,40);
191  AbstractButton::SetRenderPoint(SPoint(2, 250));
192  }
193 
194  virtual void OnClick(u8 button)
195  {
196  OurGrid & grid = AbstractGridButton::m_driver->GetGrid();
197  GridRenderer & grend = AbstractGridButton::m_driver->GetGridRenderer();
198 
199  const SPoint selTile = grend.GetSelectedTile();
200  if(selTile.GetX() >= 0 && selTile.GetX() < W &&
201  selTile.GetY() >= 0 && selTile.GetY() < H)
202  {
203  grid.EmptyTile(grend.GetSelectedTile());
204  }
205  }
206  } m_clearButton;
207 
209  {
210  public:
211  ClearGridButton() : AbstractGridButton("Clear Grid")
212  {
213  AbstractButton::SetName("ClearGridButton");
214  Panel::SetDimensions(200,40);
215  AbstractButton::SetRenderPoint(SPoint(2, 250));
216  }
217 
218  virtual void OnClick(u8 button)
219  {
220  OurGrid & grid = AbstractGridButton::m_driver->GetGrid();
221 
222  grid.Clear();
223  }
224  } m_clearGridButton;
225 
227  {
228  public:
229  NukeButton() : AbstractGridButton("Nuke")
230  {
231  AbstractButton::SetName("NukeButton");
232  Panel::SetDimensions(200,40);
233  AbstractButton::SetRenderPoint(SPoint(2, 100));
234  }
235 
236  virtual void OnClick(u8 button)
237  {
238  AbstractGridButton::m_driver->GetGrid().RandomNuke();
239  }
240  } m_nukeButton;
241 
243  {
244  XRayButton() : AbstractGridButton("XRay")
245  {
246  AbstractButton::SetName("XRayButton");
247  Panel::SetDimensions(200,40);
248  AbstractButton::SetRenderPoint(SPoint(2, 150));
249  }
250 
251  virtual void OnClick(u8 button)
252  {
253  AbstractGridButton::m_driver->GetGrid().XRay();
254  }
255  } m_xrayButton;
256 
258  {
259  public:
261  {
262  AbstractButton::SetName("GridRunButton");
263  Panel::SetDimensions(200, 25);
264  AbstractButton::SetRenderPoint(SPoint(2, 0));
265  }
266 
267  virtual void OnCheck(bool value)
268  { }
269  }m_gridRunButton;
270 
272  {
274  {
275  AbstractButton::SetName("GridRenderButton");
276  Panel::SetDimensions(200,25);
277  AbstractButton::SetRenderPoint(SPoint(2, 25));
278  }
279 
280  virtual void OnCheck(bool value)
281  { }
282  } m_gridRenderButton;
283 
285  {
286  HeatmapButton() : AbstractGridCheckbox("Heatmap")
287  {
288  AbstractButton::SetName("HeatmapButton");
289  Panel::SetDimensions(200,25);
290  AbstractButton::SetRenderPoint(SPoint(2, 50));
291  }
292 
293  virtual void OnCheck(bool value)
294  { }
295  } m_heatmapButton;
296 
298  {
299  public:
301  {
302  AbstractButton::SetName("GridStepButton");
303  Panel::SetDimensions(200, 40);
304  AbstractButton::SetRenderPoint(SPoint(2, 200));
305  }
306 
307  virtual void OnClick(u8 button)
308  {
309  AbstractGridButton::m_driver->m_singleStep = true;
310  AbstractGridButton::m_driver->m_keyboardPaused = false;
311  }
312  }m_gridStepButton;
313 
315  {
316  TileViewButton() : AbstractGridButton("Change Tile View")
317  {
318  AbstractButton::SetName("TileViewButton");
319  Panel::SetDimensions(200,40);
320  AbstractButton::SetRenderPoint(SPoint(2, 200));
321  }
322 
323  virtual void OnClick(u8 button)
324  {
325  AbstractGridButton::m_driver->GetGridRenderer().ToggleMemDraw();
326  }
327  } m_tileViewButton;
328 
330  {
331  SaveButton() : AbstractGridButton("Save State")
332  {
333  AbstractButton::SetName("SaveButton");
334  Panel::SetDimensions(200, 40);
335  AbstractButton::SetRenderPoint(SPoint(2, 300));
336  }
337 
338  virtual void OnClick(u8 button)
339  {
340  AbstractGridButton::m_driver->SaveGridWithNextFilename();
341  }
342 
343  private:
344 
345  }m_saveButton;
346 
348  {
349  private:
350  u32 m_currentScreenshot;
351  SDL_Surface* m_screen;
352  Camera* m_camera;
353  AbstractDriver<GC>* m_driver;
354 
355  public:
356  ScreenshotButton() :
357  AbstractGridButton("Screenshot"),
358  m_currentScreenshot(0),
359  m_screen(NULL),
360  m_camera(NULL)
361  {
362  AbstractButton::SetName("Screenshot");
363  Panel::SetDimensions(200, 40);
364  }
365 
366  void SetScreen(SDL_Surface* screen)
367  {
368  m_screen = screen;
369  }
370 
371  void SetCamera(Camera* camera)
372  {
373  m_camera = camera;
374  }
375 
376  void SetDriver(AbstractDriver<GC>* driver)
377  {
378  m_driver = driver;
379  }
380 
381  virtual void OnClick(u8 button)
382  {
383  if(m_driver && m_screen && m_camera)
384  {
385  const char * path = m_driver->GetSimDirPathTemporary("screenshot/%010d.png",
386  ++m_currentScreenshot);
387  LOG.Debug("Screenshot saved at %s", path);
388 
389  m_camera->DrawSurface(m_screen, path);
390  }
391  else
392  {
393  LOG.Debug("Screenshot not saved; screen is null. Use SetScreen() first.");
394  }
395  }
396  }m_screenshotButton;
397 
399  {
400  QuitButton() : AbstractGridButton("Quit")
401  {
402  AbstractButton::SetName("QuitButton");
403  Panel::SetDimensions(200,40);
404  AbstractButton::SetRenderPoint(SPoint(2, 350));
405  }
406 
407  virtual void OnClick(u8 button)
408  {
409  exit(0);
410  }
411  } m_quitButton;
412 
414  {
415  ReloadButton() : AbstractGridButton("Reload")
416  {
417  AbstractButton::SetName("ReloadButton");
418  Panel::SetDimensions(200,40);
419  AbstractButton::SetRenderPoint(SPoint(2, 350));
420  }
421 
422  virtual void OnClick(u8 button)
423  {
424  AbstractGridButton::m_driver->LoadFromConfigurationPath();
425  }
426  } m_reloadButton;
427 
429  {
430  PauseTileButton() : AbstractGridButton("Pause Tile")
431  {
432  AbstractButton::SetName("PauseTileButton");
433  Panel::SetDimensions(200, 40);
434  AbstractButton::SetRenderPoint(SPoint(2, 400));
435  }
436 
437  virtual void OnClick(u8 button)
438  {
439  SPoint selectedTile = AbstractGridButton::m_grend->GetSelectedTile();
440 
441  if(selectedTile.GetX() >= 0 && selectedTile.GetY() >= 0)
442  {
443  AbstractGridButton::m_driver->GetGrid().SetTileToExecuteOnly(
444  selectedTile,
445  !AbstractGridButton::m_driver->GetGrid().GetTileExecutionStatus(selectedTile));
446  }
447 
448  }
449  }m_pauseTileButton;
450 
452  {
453  BGRButton() : AbstractGridCheckbox("Writes fault")
454  {
455  AbstractButton::SetName("BGRButton");
456  Panel::SetDimensions(200,25);
457  AbstractButton::SetRenderPoint(SPoint(2, 75));
458  Panel::SetVisibility(true);
459  }
460 
461  virtual void OnCheck(bool value)
462  {
463  AbstractGridCheckbox::m_driver->GetGrid().SetBackgroundRadiation(
464  this->IsChecked());
465  }
466  } m_bgrButton;
467 
468  HelpPanel m_helpPanel;
469 
470  protected: /* Need these for our buttons at driver level */
471  GridRenderer m_grend;
472  StatsRenderer<GC> m_srend;
473 
474  GridRenderer & GetGridRenderer()
475  {
476  return m_grend;
477  }
478 
479  virtual void PostUpdate()
480  {
481  /* Update the stats renderer */
482  m_statisticsPanel.SetAEPS(Super::GetAEPS());
483  m_statisticsPanel.SetAER(Super::GetRecentAER()); // Use backwards averaged value
484  m_statisticsPanel.SetAEPSPerFrame(Super::GetAEPSPerFrame());
485  m_statisticsPanel.SetOverheadPercent(Super::GetOverheadPercent());
486  }
487 
488  virtual void DoEpochEvents(OurGrid& grid, u32 epochs, u32 epochAEPS)
489  {
490  Super::DoEpochEvents(grid, epochs, epochAEPS);
491  m_thisUpdateIsEpoch = true;
492  m_thisEpochAEPS = epochAEPS;
493  }
494 
495  virtual void OnceOnly(VArguments& args)
496  {
498  {
499 
500  ByteSink * old = LOG.SetByteSink(m_logSplitter);
501  m_logSplitter.SetSink1(old);
502  m_logSplitter.SetSink2(&m_logPanel.GetByteSink());
503  }
504 
505  // Let the parent 'go first'!
506  Super::OnceOnly(args);
507 
508  /*
509  if (m_countOfScreenshotsPerRate > 0) {
510  m_maxRecordScreenshotPerAEPS = m_recordScreenshotPerAEPS;
511  m_recordScreenshotPerAEPS = 1;
512  m_countOfScreenshotsAtThisAEPS = 0;
513  }
514  */
515 
516  if (!getenv("SDL_VIDEO_ALLOW_SCREENSAVER")) // If user isn't already messing with this
517  putenv((char *) "SDL_VIDEO_ALLOW_SCREENSAVER=1"); // Old school sdl 1.2 mechanism
518 
519  SDL_Init(SDL_INIT_EVERYTHING);
520  TTF_Init();
521 
522  SetScreenSize(m_screenWidth, m_screenHeight);
523 
524  m_rootPanel.SetName("Root");
525  m_gridPanel.SetBorder(Drawing::BLACK);
526  m_gridPanel.SetGridRenderer(&m_grend);
527  m_gridPanel.SetToolboxPanel(&m_toolboxPanel);
528  m_gridPanel.SetGrid(&Super::GetGrid());
529 
530  m_statisticsPanel.SetStatsRenderer(&m_srend);
531  m_statisticsPanel.SetGrid(&Super::GetGrid());
532  m_statisticsPanel.SetAEPS(Super::GetAEPS());
533  m_statisticsPanel.SetAER(Super::GetRecentAER());
534  m_statisticsPanel.SetAEPSPerFrame(Super::GetAEPSPerFrame());
535  m_statisticsPanel.SetOverheadPercent(Super::GetOverheadPercent());
536  m_statisticsPanel.SetVisibility(false);
537 
538  m_rootPanel.Insert(&m_gridPanel, NULL);
539  m_gridPanel.Insert(&m_statisticsPanel, NULL);
540  m_statisticsPanel.Insert(&m_buttonPanel, NULL);
541  m_buttonPanel.SetVisibility(true);
542 
543  m_gridPanel.Insert(&m_logPanel, NULL);
544  m_logPanel.SetVisibility(false);
545  m_logPanel.SetDimensions(m_screenWidth, 160);
546  m_logPanel.SetDesiredSize(U32_MAX, 160);
547  m_logPanel.SetAnchor(ANCHOR_SOUTH);
548  m_logPanel.SetFont(AssetManager::Get(FONT_ASSET_LOGGER));
549 
550  m_toolboxPanel.SetName("Toolbox");
551  m_toolboxPanel.SetVisibility(false);
552  m_toolboxPanel.SetBigText(m_bigText);
553  m_toolboxPanel.SetBackground(Drawing::GREY60);
554  m_toolboxPanel.SetAnchor(ANCHOR_WEST);
555  m_toolboxPanel.SetAnchor(ANCHOR_NORTH);
556  m_gridPanel.Insert(&m_toolboxPanel, NULL);
557  m_toolboxPanel.RebuildControllers();
558 
559  m_helpPanel.SetName("Help");
560  m_helpPanel.SetDimensions(m_screenWidth / 3, m_screenHeight);
561  m_helpPanel.SetAnchor(ANCHOR_WEST);
562  m_gridPanel.Insert(&m_helpPanel, NULL);
563 
564  m_rootPanel.Print(STDOUT);
565 
566  m_srend.OnceOnly();
567 
568  SDL_WM_SetCaption(MFM_VERSION_STRING_LONG, NULL);
569 
570  m_ticksLastStopped = 0;
571 
572  m_reinitRequested = false;
573 
574  OnceOnlyButtons();
575 
576  // Again to 'set' stuff?
577  SetScreenSize(m_screenWidth, m_screenHeight);
578  }
579 
580  private:
581 
582  void OnceOnlyButtons()
583  {
584  m_statisticsPanel.SetAnchor(ANCHOR_EAST);
585 
586  m_buttonPanel.InsertCheckbox(&m_heatmapButton);
587  m_buttonPanel.InsertCheckbox(&m_gridRenderButton);
588  m_buttonPanel.InsertCheckbox(&m_gridRunButton);
589  m_buttonPanel.InsertCheckbox(&m_bgrButton);
590 
591  m_buttonPanel.InsertButton(&m_gridStepButton);
592  m_buttonPanel.InsertButton(&m_clearButton);
593  m_buttonPanel.InsertButton(&m_clearGridButton);
594  m_buttonPanel.InsertButton(&m_xrayButton);
595  m_buttonPanel.InsertButton(&m_nukeButton);
596  m_buttonPanel.InsertButton(&m_tileViewButton);
597  m_buttonPanel.InsertButton(&m_pauseTileButton);
598  m_buttonPanel.InsertButton(&m_saveButton);
599  m_buttonPanel.InsertButton(&m_screenshotButton);
600  m_buttonPanel.InsertButton(&m_reloadButton);
601  m_buttonPanel.InsertButton(&m_quitButton);
602 
603  m_screenshotButton.SetDriver(this);
604  m_screenshotButton.SetScreen(screen);
605  m_screenshotButton.SetCamera(&camera);
606 
607  m_pauseTileButton.SetGridRenderer(m_grend);
608 
609  m_gridRenderButton.SetExternalValue(m_grend.GetGridEnabledPointer());
610  m_heatmapButton.SetExternalValue(m_grend.GetDrawDataHeatPointer());
612  GetBackgroundRadiationEnabledPointer());
613  m_gridRunButton.SetExternalValue(&m_keyboardPaused);
614 
615  m_buttonPanel.SetButtonDrivers(*this);
616  m_buttonPanel.InsertButtons();
617 
618  m_buttonPanel.SetAnchor(ANCHOR_SOUTH);
619  m_buttonPanel.SetAnchor(ANCHOR_EAST);
620  }
621 
622  void Update(OurGrid& grid)
623  {
624  KeyboardUpdate(grid);
625 
626  if (m_singleStep)
627  {
628  m_keyboardPaused = false;
629  }
630 
631  m_gridPaused = m_keyboardPaused || m_mousePaused;
632  if (!m_gridPaused)
633  {
634  Super::UpdateGrid(grid);
635  if (m_singleStep)
636  {
637  m_keyboardPaused = true;
638  m_singleStep = false;
639  }
640  }
641  else
642  {
643  const s32 ONE_THOUSAND = 1000;
644  const s32 ONE_MILLION = ONE_THOUSAND*ONE_THOUSAND;
645 
646  Sleep(0,33*ONE_MILLION); // 33 ms ~= 30 fps idle
647  }
648  }
649 
650  inline void ToggleStatsView()
651  {
652  m_statisticsPanel.ToggleVisibility();
653  m_grend.SetDimensions(Point<u32>(m_screenWidth - (m_renderStats ? STATS_WINDOW_WIDTH : 0)
654  , m_screenHeight));
655  }
656 
657  inline void ToggleLogView()
658  {
659  m_logPanel.ToggleVisibility();
660  }
661 
662  inline void ToggleToolbox()
663  {
664  m_toolboxPanel.ToggleVisibility();
665  m_gridPanel.SetPaintingEnabled(m_toolboxPanel.IsVisible());
666  }
667 
668  void KeyboardUpdate(OurGrid& grid)
669  {
670  u8 speed = m_keyboard.ShiftHeld() ?
671  CAMERA_FAST_SPEED : CAMERA_SLOW_SPEED;
672 
673  if(m_keyboard.IsDown(SDLK_q) && m_keyboard.CtrlHeld())
674  {
675  exit(0);
676  }
677 
678  /* View Control */
679  if(m_keyboard.SemiAuto(SDLK_a))
680  {
681  m_srend.SetDisplayAER(1 + m_srend.GetDisplayAER());
682  }
683  if(m_keyboard.SemiAuto(SDLK_i))
684  {
685  ToggleStatsView();
686  }
687  if(m_keyboard.SemiAuto(SDLK_g))
688  {
689  m_grend.ToggleGrid();
690  }
691  if(m_keyboard.SemiAuto(SDLK_b))
692  {
693  m_buttonPanel.ToggleVisibility();
694  }
695  if(m_keyboard.SemiAuto(SDLK_m))
696  {
697  m_grend.ToggleMemDraw();
698  }
699  if(m_keyboard.SemiAuto(SDLK_k))
700  {
701  m_grend.ToggleDataHeatmap();
702  }
703  if(m_keyboard.SemiAuto(SDLK_h))
704  {
705  m_helpPanel.ToggleVisibility();
706  }
707  if(m_keyboard.SemiAuto(SDLK_l))
708  {
709  ToggleLogView();
710  }
711  if(m_keyboard.SemiAuto(SDLK_p))
712  {
713  m_grend.ToggleTileSeparation();
714  }
715  if(m_keyboard.SemiAuto(SDLK_v))
716  {
717  m_gridPanel.ToggleAtomViewPanel();
718  }
719  if(m_keyboard.SemiAuto(SDLK_o))
720  {
721  m_gridPanel.ToggleDrawAtomsAsSquares();
722  }
723 
724  if(m_keyboard.SemiAuto(SDLK_ESCAPE))
725  {
726  m_gridPanel.DeselectAtomAndTile();
727  }
728 
729  /* Camera Recording */
730  if(m_keyboard.SemiAuto(SDLK_r))
731  {
732  m_captureScreenshots = !m_captureScreenshots;
733  if (m_captureScreenshots)
734  LOG.Message("Capturing screenshots every %d AEPS", this->GetAEPSPerEpoch());
735  else
736  LOG.Message("Not capturing screenshots");
737  }
738 
739  if(m_keyboard.SemiAuto(SDLK_t))
740  {
741  ToggleToolbox();
742  }
743 
744  /* Camera Movement*/
745  if(m_keyboard.IsDown(SDLK_LEFT))
746  {
747  m_grend.MoveLeft(speed);
748  }
749  if(m_keyboard.IsDown(SDLK_DOWN))
750  {
751  m_grend.MoveDown(speed);
752  }
753  if(m_keyboard.IsDown(SDLK_UP))
754  {
755  m_grend.MoveUp(speed);
756  }
757  if(m_keyboard.IsDown(SDLK_RIGHT))
758  {
759  m_grend.MoveRight(speed);
760  }
761 
762  /* Speed Control */
763  if(m_keyboard.SemiAuto(SDLK_SPACE))
764  {
765  m_keyboardPaused = !m_keyboardPaused;
766  }
767  if(m_keyboard.SemiAuto(SDLK_s))
768  {
769  m_singleStep = true;
770  m_keyboardPaused = false;
771  }
772  if(m_keyboard.IsDown(SDLK_COMMA))
773  {
774  Super::DecrementAEPSPerFrame(m_keyboard.CtrlHeld() ? 10 : 1);
775  }
776  if(m_keyboard.IsDown(SDLK_PERIOD))
777  {
778  Super::IncrementAEPSPerFrame(m_keyboard.CtrlHeld() ? 10 : 1);
779  }
780 
781  m_keyboard.Flip();
782  }
783 
784  public:
785 
786  void SaveGridWithNextFilename()
787  {
788  const char* filename =
789  Super::GetSimDirPathTemporary("save/%D.mfs", m_saveStateIndex++);
790  Super::SaveGrid(filename);
791  }
792 
793  void SaveGridWithConstantFilename(const char* filename)
794  {
795  const char* finalName =
796  Super::GetSimDirPathTemporary("%s", filename);
797  Super::SaveGrid(finalName);
798  }
799 
800  AbstractGUIDriver() :
801  m_startPaused(true),
802  m_thisUpdateIsEpoch(false),
803  m_bigText(false),
804  m_captureScreenshots(false),
805  m_saveStateIndex(0),
806  m_epochSaveStateIndex(0),
807  m_renderStats(false),
808  m_screenWidth(SCREEN_INITIAL_WIDTH),
809  m_screenHeight(SCREEN_INITIAL_HEIGHT),
810  m_selectedTool(TOOL_SELECTOR),
811  m_toolboxPanel(&m_selectedTool),
812  m_buttonPanel()
813  { }
814 
815  ~AbstractGUIDriver()
816  {
818  }
819 
820  virtual void ReinitUs()
821  {
822  /*
823  m_nextEventCountsAEPS = 0;
824  m_nextScreenshotAEPS = 0;
825  m_nextTimeBasedDataAEPS = 0;
826  */
827  }
828 
829  virtual void PostReinit(VArguments& args)
830  {
831  HandleResize();
832 
833  m_renderStats = false;
834 
835  m_toolboxPanel.AddButtons();
836  }
837 
838  virtual void PostReinitPhysics()
839  {
840  for(u32 i = 0; i < AbstractDriver<GC>::m_neededElementCount; i++)
841  {
842  GetStatsRenderer().DisplayStatsForElement(AbstractDriver<GC>::GetGrid(),
844  this->RegisterToolboxElement(AbstractDriver<GC>::m_neededElements[i]);
845  }
846  }
847 
848  virtual void HandleResize()
849  { }
850 
851  void ToggleTileView()
852  {
853  m_grend.ToggleMemDraw();
854  }
855 
856  void RegisterToolboxElement(Element<CC>* element)
857  {
858  m_toolboxPanel.RegisterElement(element);
859  }
860 
861  /*********************************
862  * GUI SPECIFIC DRIVER ARGUMENTS *
863  *********************************/
864 
865  static void ConfigStatsOnlyView(const char* not_used, void* driverptr)
866  {
867  AbstractGUIDriver* driver = (AbstractGUIDriver<GC>*)driverptr;
868 
869 
870  driver->m_screenWidth = STATS_START_WINDOW_WIDTH;
871  driver->m_screenHeight = STATS_START_WINDOW_HEIGHT;
872  driver->ToggleStatsView();
873  driver->m_srend.SetDisplayAER(driver->m_srend.GetMaxDisplayAER());
874  }
875 
876  static void ConfigMinimalView(const char* not_used, void* driverptr)
877  {
878  AbstractGUIDriver* driver = (AbstractGUIDriver<GC>*)driverptr;
879 
880  driver->m_screenWidth = MINIMAL_START_WINDOW_HEIGHT;
881  driver->m_screenHeight = MINIMAL_START_WINDOW_WIDTH;
882  }
883 
884  static void SetRecordScreenshotPerAEPSFromArgs(const char* aeps, void* driverptr)
885  {
886  AbstractGUIDriver* driver = (AbstractGUIDriver<GC>*)driverptr;
887 
888  driver->m_captureScreenshots = true;
889  }
890 
891  static void SetStartPausedFromArgs(const char* not_used, void* driverptr)
892  {
893  AbstractGUIDriver& driver = *((AbstractGUIDriver*)driverptr);
894 
895  driver.m_startPaused = false;
896  }
897 
898  static void DontShowHelpPanelOnStart(const char* not_used, void* driverptr)
899  {
900  AbstractGUIDriver& driver = *((AbstractGUIDriver*)driverptr);
901 
902  driver.m_helpPanel.SetVisibility(false);
903  }
904 
905  static void SetIncreaseTextSizeFlag(const char* not_used, void* driverptr)
906  {
907  AbstractGUIDriver& driver = *((AbstractGUIDriver*)driverptr);
908 
909  LOG.Debug("Increase text size.\n");
910 
911  driver.m_bigText = true;
912  }
913 
915  {
917 
918  this->RegisterSection("GUI switches");
919 
920  this->RegisterArgument("Start with only the statistics view on the screen.",
921  "--startwithoutgrid", &ConfigStatsOnlyView, this, false);
922 
923  this->RegisterArgument("Start with a minimal-sized window.",
924  "--startminimal", &ConfigMinimalView, this, false);
925 
926  this->RegisterArgument("Capture a screenshot every epoch",
927  "-p|--pngs", &SetRecordScreenshotPerAEPSFromArgs, this, false);
928 
929  this->RegisterArgument("Simulation begins upon program startup.",
930  "--run", &SetStartPausedFromArgs, this, false);
931 
932  this->RegisterArgument("Help panel is not shown upon startup.",
933  "-n| --nohelp", &DontShowHelpPanelOnStart, this, false);
934 
935  this->RegisterArgument("Increase button and text size.",
936  "--bigtext", &SetIncreaseTextSizeFlag, this, false);
937  }
938 
939  EditingTool m_selectedTool;
940 
941  GridPanel<GC> m_gridPanel;
942 
943  ToolboxPanel<CC> m_toolboxPanel;
944 
946  {
947  StatsRenderer<GC>* m_srend;
948  OurGrid* m_mainGrid;
949  double m_AEPS;
950  double m_AER;
951  double m_overheadPercent;
952  u32 m_aepsPerFrame;
953 
954  public:
955  StatisticsPanel() : m_srend(NULL)
956  {
957  SetName("Statistics Panel");
958  SetDimensions(STATS_START_WINDOW_WIDTH,
959  SCREEN_INITIAL_HEIGHT);
960  SetDesiredSize(STATS_START_WINDOW_WIDTH,
961  U32_MAX);
962  SetRenderPoint(SPoint(100000, 0));
963  SetForeground(Drawing::WHITE);
964  SetBackground(Drawing::DARK_PURPLE);
965  m_AEPS = m_AER = 0.0;
966  m_aepsPerFrame = 0;
967  m_overheadPercent = 0.0;
968  }
969 
970  void SetStatsRenderer(StatsRenderer<GC>* srend)
971  {
972  m_srend = srend;
973  }
974 
975  void SetGrid(OurGrid* mainGrid)
976  {
977  m_mainGrid = mainGrid;
978  }
979 
980  void SetAEPS(double aeps)
981  {
982  m_AEPS = aeps;
983  }
984 
985  void SetAER(double aer)
986  {
987  m_AER = aer;
988  }
989 
990  void SetOverheadPercent(double overheadPercent)
991  {
992  m_overheadPercent = overheadPercent;
993  }
994 
995  void SetAEPSPerFrame(u32 apf)
996  {
997  m_aepsPerFrame = apf;
998  }
999 
1000  protected:
1001  virtual void PaintComponent(Drawing& drawing)
1002  {
1003  this->Panel::PaintComponent(drawing);
1004  m_srend->RenderGridStatistics(drawing, *m_mainGrid,
1005  m_AEPS, m_AER, m_aepsPerFrame,
1006  m_overheadPercent, false);
1007  }
1008 
1009  virtual void PaintBorder(Drawing & config)
1010  { /* No border please */ }
1011 
1012  virtual bool HandlePostDrag(MouseButtonEvent& mbe)
1013  {
1014  return true; /* Eat the event to keep the grid from taking it */
1015  }
1016  }m_statisticsPanel;
1017 
1018  struct ButtonPanel : public Panel
1019  {
1020  static const u32 MAX_BUTTONS = 16;
1021  static const u32 CHECKBOX_SPACING_HEIGHT = 32;
1022  static const u32 BUTTON_SPACING_HEIGHT = 34;
1023  static const u32 BUTTON_HEIGHT = 30;
1024  static const u32 BUTTON_WIDTH = STATS_START_WINDOW_WIDTH;
1025 
1026  virtual void PaintBorder(Drawing & config)
1027  { /* No border please */ }
1028 
1029  ButtonPanel() :
1030  m_checkboxCount(0),
1031  m_buttonCount(0)
1032  {
1033  SetName("ButtonPanel");
1034  SetDimensions(STATS_START_WINDOW_WIDTH,
1035  SCREEN_INITIAL_HEIGHT / 2);
1036  SetDesiredSize(U32_MAX, SCREEN_INITIAL_HEIGHT / 2);
1037  SetAnchor(ANCHOR_SOUTH);
1038  /*
1039  SetRenderPoint(SPoint(0,
1040  SCREEN_INITIAL_HEIGHT / 2));
1041  */
1042  SetForeground(Drawing::WHITE);
1043  SetBackground(Drawing::DARK_PURPLE);
1044  SetFont(AssetManager::Get(FONT_ASSET_ELEMENT));
1045  }
1046 
1047  void InsertCheckbox(AbstractGridCheckbox* checkbox)
1048  {
1049  if(m_checkboxCount >= MAX_BUTTONS)
1050  {
1051  FAIL(OUT_OF_ROOM);
1052  }
1053 
1054  m_checkboxes[m_checkboxCount++] = checkbox;
1055 
1056  Pack();
1057  }
1058 
1059  void InsertButton(AbstractGridButton* button)
1060  {
1061  if(m_buttonCount >= MAX_BUTTONS)
1062  {
1063  FAIL(OUT_OF_ROOM);
1064  }
1065 
1066  m_buttons[m_buttonCount++] = button;
1067 
1068  Pack();
1069  }
1070 
1071  void SetButtonDrivers(AbstractGUIDriver& driver)
1072  {
1073  for(u32 i = 0; i < m_checkboxCount; i++)
1074  {
1075  m_checkboxes[i]->SetDriver(driver);
1076  }
1077 
1078  for(u32 i = 0; i < m_buttonCount; i++)
1079  {
1080  m_buttons[i]->SetDriver(driver);
1081  }
1082  }
1083 
1084  void InsertButtons()
1085  {
1086  for(u32 i = 0; i < m_checkboxCount; i++)
1087  {
1088  Panel::Insert(m_checkboxes[i], NULL);
1089  }
1090 
1091  for(u32 i = 0; i < m_buttonCount; i++)
1092  {
1093  Panel::Insert(m_buttons[i], NULL);
1094  m_buttons[i]->SetDimensions(SPoint(BUTTON_WIDTH, BUTTON_HEIGHT));
1095  }
1096  }
1097 
1098  private:
1099  AbstractGridCheckbox* m_checkboxes[MAX_BUTTONS];
1100  AbstractGridButton* m_buttons[MAX_BUTTONS];
1101 
1102  u32 m_checkboxCount;
1103  u32 m_buttonCount;
1104 
1105  void Pack()
1106  {
1107  for(u32 i = 0; i < m_checkboxCount; i++)
1108  {
1109  m_checkboxes[i]->SetRenderPoint(SPoint(2, i * CHECKBOX_SPACING_HEIGHT));
1110  }
1111 
1112  for(u32 i = 0; i < m_buttonCount; i++)
1113  {
1114  m_buttons[i]->SetRenderPoint(SPoint(2, m_checkboxCount * CHECKBOX_SPACING_HEIGHT +
1115  i * BUTTON_SPACING_HEIGHT));
1116  }
1117 
1118  Panel::SetDimensions(STATS_WINDOW_WIDTH,
1119  m_checkboxCount * CHECKBOX_SPACING_HEIGHT +
1120  m_buttonCount * BUTTON_SPACING_HEIGHT);
1121  }
1122 
1123  }m_buttonPanel;
1124 
1125  TextPanel<120,100> m_logPanel; // 120 for timestamp and 96 BPA..
1126  TeeByteSink m_logSplitter;
1127 
1128  void SetScreenSize(u32 width, u32 height)
1129  {
1130  m_screenWidth = width;
1131  m_screenHeight = height;
1132  screen = SDL_SetVideoMode(m_screenWidth, m_screenHeight, 32,
1133  SDL_SWSURFACE | SDL_RESIZABLE);
1134 
1136 
1137  if (screen == 0)
1138  {
1139  FAIL(ILLEGAL_STATE);
1140  }
1141 
1142  UPoint newDimensions(width, height);
1143 
1144  m_rootPanel.SetDimensions(m_screenWidth, m_screenHeight);
1145  m_gridPanel.SetDimensions(m_screenWidth, m_screenHeight);
1146 
1147  m_rootPanel.SetRenderPoint(SPoint(0, 0));
1148  m_rootPanel.SetForeground(Drawing::BLUE);
1149  m_rootPanel.SetBackground(Drawing::RED);
1150  m_rootPanel.HandleResize(newDimensions);
1151 
1152  m_rootDrawing.Reset(screen, AssetManager::Get(FONT_ASSET_ELEMENT));
1153 
1154  if(m_renderStats)
1155  {
1156  m_grend.SetDimensions(UPoint(m_screenWidth - STATS_WINDOW_WIDTH,m_screenHeight));
1157  }
1158  else
1159  {
1160  m_grend.SetDimensions(UPoint(m_screenWidth,m_screenHeight));
1161  }
1162 
1163  m_srend.SetDrawPoint(SPoint(0,0));
1164  m_srend.SetDimensions(UPoint(STATS_WINDOW_WIDTH, m_screenHeight));
1165 
1166  printf("Screen resize: %d x %d\n", width, height);
1167  HandleResize();
1168  }
1169 
1170  StatsRenderer<GC> & GetStatsRenderer()
1171  {
1172  return m_srend;
1173  }
1174 
1175  void RunHelper()
1176  {
1177  m_keyboardPaused = m_startPaused;
1178  m_singleStep = false;
1179 
1180  bool running = true;
1181 
1182  SDL_Event event;
1183  s32 lastFrame = SDL_GetTicks();
1184 
1185  u32 mouseButtonsDown = 0;
1186  ButtonPositionArray dragStartPositions;
1187 
1188  while(running)
1189  {
1190  while(SDL_PollEvent(&event))
1191  {
1192  switch(event.type)
1193  {
1194  case SDL_VIDEORESIZE:
1195  SetScreenSize(event.resize.w, event.resize.h);
1196  break;
1197 
1198  case SDL_QUIT:
1199  running = false;
1200  break;
1201 
1202  case SDL_MOUSEBUTTONUP:
1203  mouseButtonsDown &= ~(1<<(event.button.button));
1204  dragStartPositions[event.button.button].Set(-1,-1);
1205  goto mousebuttondispatch;
1206 
1207  case SDL_MOUSEBUTTONDOWN:
1208  mouseButtonsDown |= 1<<(event.button.button);
1209  dragStartPositions[event.button.button].Set(event.button.x,event.button.y);
1210  // FALL THROUGH
1211 
1212  mousebuttondispatch:
1213  {
1214  MouseButtonEvent mbe(m_keyboard, event, m_selectedTool);
1215  m_rootPanel.Dispatch(mbe,
1216  Rect(SPoint(),
1217  UPoint(m_screenWidth,m_screenHeight)));
1218  }
1219  break;
1220 
1221  case SDL_MOUSEMOTION:
1222  {
1223  MouseMotionEvent mme(m_keyboard, event,
1224  mouseButtonsDown, dragStartPositions, m_selectedTool);
1225  m_rootPanel.Dispatch(mme,
1226  Rect(SPoint(),
1227  UPoint(m_screenWidth,m_screenHeight)));
1228  }
1229  break;
1230 
1231  case SDL_KEYDOWN:
1232  case SDL_KEYUP:
1233  m_keyboard.HandleEvent(&event.key);
1234  break;
1235 
1236  }
1237  }
1238 
1239  m_mousePaused = mouseButtonsDown != 0;
1240 
1241  /* Limit framerate */
1242  s32 sleepMS = (s32)
1243  ((1000.0 / FRAMES_PER_SECOND) -
1244  (SDL_GetTicks() - lastFrame));
1245  if(sleepMS > 0)
1246  {
1247  SDL_Delay(sleepMS);
1248  }
1249  lastFrame = SDL_GetTicks();
1250 
1251 
1252  m_thisUpdateIsEpoch = false; // Assume it's not
1253 
1254  Update(Super::GetGrid());
1255 
1256  m_rootDrawing.Clear();
1257 
1258  m_rootPanel.Paint(m_rootDrawing);
1259 
1260  if (m_thisUpdateIsEpoch)
1261  {
1262  if (m_captureScreenshots)
1263  {
1264  const char * path = Super::GetSimDirPathTemporary("vid/%010d.png", m_thisEpochAEPS);
1265 
1266  camera.DrawSurface(screen,path);
1267  }
1268  {
1269  /*
1270  const char * path = Super::GetSimDirPathTemporary("tbd/data.dat");
1271  bool exists = true;
1272  {
1273  FILE* fp = fopen(path, "r");
1274  if (!fp) exists = false;
1275  else fclose(fp);
1276  }
1277  FILE* fp = fopen(path, "a");
1278  FileByteSink fbs(fp);
1279  m_srend.WriteRegisteredCounts(fbs, !exists, Super::GetGrid(),
1280  Super::GetAEPS(),
1281  Super::GetAER(),
1282  Super::GetAEPSPerFrame(),
1283  Super::GetOverheadPercent(), true);
1284  fclose(fp);
1285  */
1287  }
1288 
1289  }
1290 
1291  if(Super::GetHaltAfterAEPS() > 0 &&
1292  Super::GetAEPS() > Super::GetHaltAfterAEPS())
1293  {
1294  // Free final save if --haltafteraeps. Hope for good-looking corpse
1295  SaveGridWithConstantFilename("save/final.mfs");
1296  running = false;
1297  }
1298 
1299  SDL_Flip(screen);
1300  }
1301 
1302  SDL_FreeSurface(screen);
1303  TTF_Quit();
1304  SDL_Quit();
1305  }
1306  };
1307 } /* namespace MFM */
1308 
1309 #endif /* ABSTRACTGUIDRIVER_H */
Definition: Rect.h:40
virtual void DoEpochEvents(OurGrid &grid, u32 epochs, u32 epochAEPS)
Definition: AbstractGUIDriver.h:488
virtual void OnCheck(bool value)
Definition: AbstractGUIDriver.h:280
Definition: AbstractGUIDriver.h:428
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:251
void DecrementAEPSPerFrame(u32 amount)
Definition: AbstractDriver.h:303
Definition: AbstractCheckbox.h:146
virtual void OnceOnly(VArguments &args)
Definition: AbstractDriver.h:392
virtual void PaintComponent(Drawing &drawing)
Definition: AbstractGUIDriver.h:1001
void SetDimensions(const SPoint &dimensions)
Definition: AbstractButton.h:186
Definition: Panel.h:115
void IncrementAEPSPerFrame(u32 amount)
Definition: AbstractDriver.h:322
Definition: AbstractGUIDriver.h:84
ByteSink * SetByteSink(ByteSink &byteSink)
Definition: Logger.h:171
Definition: Keyboard.h:36
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:218
Definition: AbstractGUIDriver.h:257
Definition: Panel.h:91
Definition: AbstractDriver.h:67
Definition: AbstractGUIDriver.h:297
Definition: Panel.h:74
Definition: AbstractGUIDriver.h:138
Definition: AbstractGUIDriver.h:184
virtual void AddDriverArguments()
Definition: AbstractDriver.h:912
Definition: AbstractButton.h:44
u32 SetForeground(const u32 color)
Definition: Panel.h:256
void UpdateGrid(OurGrid &grid)
Definition: AbstractDriver.h:239
virtual void HandleResize(const UPoint &parentSize)
Definition: Panel.cpp:265
Definition: MovablePanel.h:34
virtual bool IsChecked() const
Definition: AbstractCheckbox.h:183
AbstractButton()
Definition: AbstractButton.cpp:14
Definition: HelpPanel.h:40
virtual void OnceOnly(VArguments &args)
Definition: AbstractGUIDriver.h:495
virtual void OnCheck(bool value)
Definition: AbstractGUIDriver.h:461
void Clear()
Definition: Drawing.cpp:91
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:323
void SetAnchor(const GUIAnchor anchor)
Definition: Panel.cpp:243
T GetY() const
Definition: Point.tcc:40
Definition: AbstractGUIDriver.h:1018
const char * GetSimDirPathTemporary(const char *format,...) const
Definition: AbstractDriver.h:746
Definition: GridRenderer.h:46
Definition: Grid.h:47
virtual void PostUpdate()
Definition: AbstractGUIDriver.h:479
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:407
Definition: AbstractGUIDriver.h:451
Definition: AbstractGUIDriver.h:284
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:236
Definition: AbstractGUIDriver.h:208
virtual void PaintComponent(Drawing &config)
Definition: Panel.cpp:230
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:437
Definition: AbstractGUIDriver.h:329
Definition: Camera.h:47
Definition: ByteSink.h:47
void AddDriverArguments()
Definition: AbstractGUIDriver.h:914
ByteSink * SetSink1(ByteSink *sink)
Definition: TeeByteSink.h:108
Definition: AbstractGUIDriver.h:398
virtual void PostReinitPhysics()
Definition: AbstractGUIDriver.h:838
virtual void OnCheck(bool value)
Definition: AbstractGUIDriver.h:267
GC::CORE_CONFIG CC
Definition: AbstractDriver.h:75
virtual void OnCheck(bool value)
Definition: AbstractGUIDriver.h:293
void Clear()
Definition: Grid.tcc:502
Definition: StatsRenderer.h:44
Definition: AbstractGUIDriver.h:162
void Debug(const char *format,...)
Definition: Logger.h:301
Definition: AbstractGUIDriver.h:226
Definition: AbstractGUIDriver.h:271
Definition: AbstractGUIDriver.h:347
Definition: AbstractGUIDriver.h:242
Definition: GridPanel.h:49
Definition: AbstractGUIDriver.h:314
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:381
Definition: AbstractGUIDriver.h:945
static void Destroy()
Definition: AssetManager.h:191
void RunHelper()
Definition: AbstractGUIDriver.h:1175
ByteSink * SetSink2(ByteSink *sink)
Definition: TeeByteSink.h:125
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:194
void Reset(SDL_Surface *dest, TTF_Font *font)
Definition: Drawing.cpp:75
void Message(const char *format,...)
Definition: Logger.h:287
virtual bool Dispatch(MouseEvent &event, const Rect &rect)
Definition: Panel.cpp:310
void SetExternalValue(bool *ptr)
Definition: AbstractCheckbox.h:168
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:422
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:307
virtual void PaintBorder(Drawing &config)
Definition: AbstractGUIDriver.h:1009
Definition: VArguments.h:48
Definition: ToolboxPanel.h:46
void EmptyTile(const SPoint &tileLoc)
Definition: Grid.h:300
virtual void PaintBorder(Drawing &config)
Definition: AbstractGUIDriver.h:1026
static void Initialize()
Definition: AssetManager.h:152
virtual void DoEpochEvents(OurGrid &grid, u32 epochs, u32 epochAEPS)
Definition: AbstractDriver.h:797
virtual void PostReinit(VArguments &args)
Definition: AbstractGUIDriver.h:829
TTF_Font * SetFont(TTF_Font *newFont)
Definition: Panel.cpp:135
Definition: Drawing.h:44
virtual void OnClick(u8 button)
Definition: AbstractGUIDriver.h:338
u32 SetBackground(const u32 color)
Definition: Panel.h:220
Definition: AbstractGUIDriver.h:413
#define U32_MAX
Definition: itype.h:95
T GetX() const
Definition: Point.tcc:34