WorldSim  inDev
2D tile-based sandbox RPG with procedurally generated fantasy world simulator 🌏
Menu_WorldSimulator.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef WORLDSIM_MENU_WORLDSIMULATOR_HPP
3 #define WORLDSIM_MENU_WORLDSIMULATOR_HPP
4 
5 /* WorldSim: Menu_WorldSimulator.hpp
6 #include "Menu_WorldSimulator.hpp" */
7 
13 #include "World_Viewer.hpp"
14 #include "World_Viewer_Minimap.hpp"
15 
16 #include "Menu_Tribes.hpp"
17 #include "Menu_Civs.hpp"
18 #include "Menu_World.hpp"
19 #include "Menu_Character.hpp"
20 #include "Menu_Biome.hpp"
21 #include "Menu_Flora.hpp"
22 #include "Menu_Creatures.hpp"
23 
24 
25 class Menu_WorldSimulator: public GUI_Interface
26 {
27 private:
28  GUI_Manager guiManager;
29  Wildcat::Font* font;
30  /* Texture to draw in the background of this menu. */
31  Texture* backgroundTexture;
32 
33  /* Colours / theme. */
34  ColourRGB <unsigned char> cNormal;
35  ColourRGB <unsigned char> cSelected;
36  ColourRGB <unsigned char> cDropPanel;
37  ColourRGB <unsigned char> cHighlight;
38 
39  /* Button: Resume or commence simulation of the world map. */
40  GUI_Button buttonStartSimulation;
41  /* Button: Pause the simulation so the player can look around the world as it currently exists. */
42  GUI_Button buttonPauseSimulation;
43  /* Number entry: Simulation speed. */
44  GUI_CycleButton cycleSimulationSpeed;
45  /* Textbox: Caption for simulation speed. */
46  GUI_TextBox textSimulationSpeed;
47  /* Button: Step the simulation forward by a certain amount of time. (Day/Month/Year). */
48  GUI_Button buttonIncrementDay;
49  GUI_Button buttonIncrementMonth;
50  GUI_Button buttonIncrementYear;
51  GUI_Button buttonIncrementContinuous;
52 
53  //GUI_Button buttonIncrementContinuous;
54 
55  /* Menu for investigating an individual tribe */
56  GUI_Button buttonTribeMenu;
57  /* Menu for seeing info about the world. */
58  GUI_Button buttonWorldMenu;
59  /* Menu for a list of all biomes. */
60  GUI_Button buttonBiomeMenu;
61  /* List of all characters in the game. */
62  GUI_Button buttonCharacterMenu;
63  /* Toggle tribal territory visibility */
64  GUI_Button buttonTerritoryView;
65  /* List of all Civs in the game */
66  GUI_Button buttonCivMenu;
67  /* Switch to subterranean view on local map */
68  GUI_Button buttonSubterraneanView;
69  /* Button: Switch between 1/4 or fullscreen view of world map. */
70  GUI_Button buttonExpandMap;
71 
72  /* Button to view list of all Flora in World */
73  GUI_Button buttonFlora;
74  /* Button to view list of all Creatures in the World */
75  GUI_Button buttonCreaturesMenu;
76 
77  // Base world view modes
78  // Toggle Textures
79  GUI_Button buttonMinimapBaseTexture;
80  // Toggle landmass/biome view
81  GUI_Button buttonMinimapBaseLand;
82 
83  bool simulateWorld;
84 
85  bool fullScreenWorldView;
86 
87  /* Submenus */
88  Menu_Tribes menuTribes;
89  Menu_Civs menuCivs;
90  Menu_World menuWorld;
91  Menu_Characters menuCharacter;
92  Menu_Biome menuBiome;
93  Menu_Flora menuFlora;
94  Menu_Creatures menuCreatures;
95 
96 public:
97 
98 
100  {
101  backgroundTexture=&TEX_NEW_GAME_BACKGROUND;
102 
104  worldViewer.active = true;
105 
106  minimap.world = &world;
107  minimap.active=true;
108 
109  simulateWorld=false;
110 
111  buttonExpandMap.text="Expand";
112  buttonExpandMap.setColours(cNormal,cHighlight,0);
113  //buttonExpandMap.setPanel(0,0,32,32);
114  buttonExpandMap.texture = &TEX_GUI_EXPAND;
115 
116  fullScreenWorldView=true;
117 
118  menuTribes.active=false;
119  menuWorld.active=false;
120  menuCharacter.active=false;
121  menuBiome.active=false;
122  menuFlora.active=false;
123  menuCreatures.active=false;
124  minimap.active=true;
125  }
126 
127  void setFont(Wildcat::Font* _font)
128  {
129  font = _font;
130  guiManager.setFont(_font);
131  }
132 
133  void init()
134  {
135  /* Initialise theme. */
136  cNormal.set(200,200,200);
137  cSelected.set(180,180,180);
138  cDropPanel.set(170,170,170);
139  cHighlight.set(170,170,170);
140 
141  cycleSimulationSpeed.wrap=false;
142  cycleSimulationSpeed.currentOption=0;
143  cycleSimulationSpeed.addOption("PAUSED");
144  cycleSimulationSpeed.addOption("1x");
145  cycleSimulationSpeed.addOption("60x");
146  cycleSimulationSpeed.addOption("100x");
147  cycleSimulationSpeed.addOption("1,000x");
148  cycleSimulationSpeed.addOption("10,000x");
149  cycleSimulationSpeed.addOption("100,000x");
150  cycleSimulationSpeed.addOption("1,000,000x");
151  cycleSimulationSpeed.addOption("10,000,000x");
152  cycleSimulationSpeed.addOption("100,000,000x");
153  cycleSimulationSpeed.texCycleButton=&TEX_GUI_DECREMENT;
154  cycleSimulationSpeed.setColours(cNormal,cHighlight,0);
155 
156  textSimulationSpeed.text="Speed:";
157  textSimulationSpeed.setColours(cNormal);
158 
159  buttonIncrementDay.text = "+D";
160  buttonIncrementDay.setColours(cNormal,cHighlight,0);
161  buttonIncrementMonth.text = "+M";
162  buttonIncrementMonth.setColours(cNormal,cHighlight,0);
163  buttonIncrementYear.text = "+Y";
164  buttonIncrementYear.setColours(cNormal,cHighlight,0);
165  buttonIncrementContinuous.text = "+++";
166  buttonIncrementContinuous.setColours(cNormal,cHighlight,0);
167  buttonTribeMenu.text="Tri";
168  buttonTribeMenu.setColours(cNormal,cHighlight,0);
169  buttonWorldMenu.text="Wor";
170  buttonWorldMenu.setColours(cNormal,cHighlight,0);
171  buttonBiomeMenu.text="Bio";
172  buttonBiomeMenu.setColours(cNormal,cHighlight,0);
173  buttonCharacterMenu.text="Cha";
174  buttonCharacterMenu.setColours(cNormal,cHighlight,0);
175  buttonCivMenu.text="Civ";
176  buttonCivMenu.setColours(cNormal,cHighlight,0);
177  buttonSubterraneanView.text = "Sub";
178  buttonSubterraneanView.setColours(cNormal,cHighlight,0);
179  buttonTerritoryView.text="Ter";
180  buttonTerritoryView.setColours(cNormal,cHighlight,0);
181  buttonFlora.text="F";
182  buttonFlora.setColours(cNormal,cHighlight,0);
183  buttonCreaturesMenu.text="Crt";
184  buttonCreaturesMenu.setColours(cNormal,cHighlight,0);
185 
186  buttonMinimapBaseTexture.init("", &TEX_GUI_MINIMAP_BASE_TEXTUREMODE, cNormal, cHighlight, 0, true);
187  buttonMinimapBaseLand.init("", &TEX_GUI_MINIMAP_BASE_LANDMODE, cNormal, cHighlight, 0, true);
188 
189  guiManager.add(&minimap);
190 
191  guiManager.add(&textSimulationSpeed);
192  guiManager.add(&cycleSimulationSpeed);
193  guiManager.add(&buttonIncrementDay);
194  guiManager.add(&buttonIncrementMonth);
195  guiManager.add(&buttonIncrementYear);
196  guiManager.add(&buttonIncrementContinuous);
197 
198  guiManager.add(&buttonTribeMenu);
199  guiManager.add(&buttonWorldMenu);
200  guiManager.add(&buttonBiomeMenu);
201  guiManager.add(&buttonCharacterMenu);
202  guiManager.add(&buttonCivMenu);
203  guiManager.add(&buttonFlora);
204  guiManager.add(&buttonCreaturesMenu);
205  guiManager.add(&buttonTerritoryView);
206  guiManager.add(&buttonSubterraneanView);
207 
208  /* GUI Minimap Buttons */
209  guiManager.add(&buttonMinimapBaseTexture);
210  guiManager.add(&buttonMinimapBaseLand);
211 
212  /* Submenus */
213  guiManager.add(&menuTribes);
214  guiManager.add(&menuCivs);
215  guiManager.add(&menuWorld);
216  guiManager.add(&menuCharacter);
217  guiManager.add(&menuBiome);
218  guiManager.add(&menuFlora);
219  guiManager.add(&menuCreatures);
220 
221  textSimulationSpeed.active=true;
222  cycleSimulationSpeed.active=true;
223 
224  buttonIncrementDay.active=true;
225  buttonIncrementMonth.active=true;
226  buttonIncrementYear.active=true;
227  buttonIncrementContinuous.active=true;
228 
229  buttonTribeMenu.active=true;
230  buttonWorldMenu.active=true;
231  buttonBiomeMenu.active=true;
232  buttonCharacterMenu.active=true;
233  buttonCivMenu.active=true;
234  buttonFlora.active=true;
235  buttonCreaturesMenu.active=true;
236  buttonTerritoryView.active=true;
237  buttonSubterraneanView.active=true;
238 
239  buttonExpandMap.active = false;
240  buttonStartSimulation.active = false;
241  buttonPauseSimulation.active = false;
242 
243  menuTribes.init();
244  menuCivs.init();
245  menuWorld.init();
246  menuCharacter.init();
247  menuBiome.init();
248  menuFlora.init();
249  menuCreatures.init();
250  //minimap.init();
251 
253  eventResize();
254  }
255 
256  void render()
257  {
258  // if ( active == false )
259  // {
260  // if ( menuAdventureMode.active )
261  // {
262  // menuAdventureMode.render();
263  // return;
264  // }
265 
266  // return;
267  // }
268  /* Draw background texture. */
269  if ( fullScreenWorldView==true)
270  {
271  Renderer::placeTexture4(panelX1,panelY1,panelX2,panelY2,backgroundTexture,true);
272  }
273  else
274  {
275  Renderer::placeTexture4(panelX1,panelY1,panelX2,panelY2,backgroundTexture,true);
276  }
277 
278  /* Preview world view. */
280 
281  // MESSAGE CONSOLE
282  const int nY = panelY2-panelY1;
283  Renderer::placeColour4a(200,200,250,125,panelX1,panelY1+120,panelX1+220,panelY2);
284  int currentY = panelY2-2;
285  int iMessage = vConsoleMessage.size()-1;
286 
287  int linesDrawn = 0;
288 
289  while (currentY>panelY1+120 && iMessage>=0 && iMessage<vConsoleMessage.size() )
290  {
291  linesDrawn = font8x8.drawText(vConsoleMessage(iMessage),panelX1,currentY,panelX1+220,currentY-38,false,false);
292  --iMessage;
293  currentY-=linesDrawn*9;
294  currentY-=2;
295  }
296 
297 
298 
299  // Minimap
300  // I think we can assume it'll be a square, although in future a rectangle may be more realistic.
301  Renderer::placeColour4a(250,200,250,250,panelX1,panelY1,panelX1+220,panelY1+220);
302 
303 
304  // Tile info panel
305  Renderer::placeColour4a(200,250,250,250,panelX1,panelY1+236,panelX1+220,panelY1+356);
306 
307  //if (world.queryWorldX != -1 && world.queryWorldY != -1)
309  {
311 
312  if ( tile != 0 )
313  {
314  // Tile stats
315  font8x8.drawText
316  (Stream() << tile->getTerrainName() << " ("<<world.queryWorldX<<", "<<world.queryWorldY<<")",
317  panelX1,panelY1+310,panelX1+220,panelY1+320,false,true);
318  font8x8.drawText
320  panelX1,panelY1+300,panelX1+220,panelY1+310,false,true);
321  font8x8.drawText
323  panelX1,panelY1+290,panelX1+220,panelY1+300,false,true);
324  font8x8.drawText(Stream() << tile->baseMetal << " metal",
325  panelX1,panelY1+280,panelX1+220,panelY1+290,false,true);
326  // Elevation
327  font8x8.drawText
328  (Stream() << "Elevation: "<< tile->centerHeight << "m",
329  panelX1,panelY1+270,panelX1+220,panelY1+280,false,true);
330  // Tile image
331  Renderer::setTextureMode();
332  Renderer::placeTexture4(panelX1, panelY1+236, panelX1+32, panelY1+268, tile->currentTexture(), false);
333  }
334  }
335 
336  // Map info panel
337  Renderer::placeColour4a(250,200,250,250,panelX1,panelY1+356,panelX1+220,panelY1+476);
339  {
341 
342  if ( tile != 0 )
343  {
344  if (tile->data && tile->data->aLocalTile.isSafe(world.queryWorldXLocal,world.queryWorldYLocal))
345  {
346 
347  if ( tile->data->aLocalTile(world.queryWorldXLocal,world.queryWorldYLocal).objStatic )
348  {
349  const std::string sName =
350  tile->data->aLocalTile(world.queryWorldXLocal,world.queryWorldYLocal).objStatic->getName();
351  font8x8.drawText
352  (Stream() << sName,
353  panelX1,panelY1+418,panelX1+220,panelY1+428,false,true);
354  }
355 
356  font8x8.drawText
357  (Stream() << tile->data->aLocalTile
359  << " ("<<world.queryWorldXLocal<<", "<<world.queryWorldYLocal<<")",
360  panelX1,panelY1+408,panelX1+220,panelY1+418,false,true);
361 
362 
363 
364  font8x8.drawText
365  (Stream() << tile->getTerrainName() << " ("<<world.queryWorldXLocal<<", "<<world.queryWorldYLocal<<")",
366  panelX1,panelY1+398,panelX1+220,panelY1+408,false,true);
367  font8x8.drawText
368  (Stream() << "Elevation: "<< tile->data->aLocalTile
370  panelX1,panelY1+388,panelX1+220,panelY1+398,false,true);
371  }
372  // Tile image
373  Renderer::setTextureMode();
374  Renderer::placeTexture4(panelX1, panelY1+356, panelX1+32, panelY1+388, tile->currentTexture(), false);
375  }
376  }
377 
378  buttonExpandMap.render();
379 
380  // DATE
381  Renderer::placeColour4a(150,150,150,255,panelX2-208,panelY2-20,panelX2,panelY2-10);
382  std::string strDate = world.calendar.toString();
383  font8x8.drawText("DATE: "+strDate,panelX2-208,panelY2-20,panelX2,panelY2-10, false, true);
384 
385  worldPop=0;
386  for (int i=0;i<world.vTribe.size();++i)
387  {
388  worldPop+=world.vTribe(i)->vCharacter.size();
389  }
390 
391  //Population
392  Renderer::placeColour4a(150,150,150,255,panelX2-380,panelY2-20,panelX2-208,panelY2-10);
393  font8x8.drawText("Pop: "+DataTools::toString(worldPop),panelX2-380,panelY2-20,panelX2-208,panelY2-10, false, true);
394 
395  guiManager.render();
396  }
397 
398  void logicTick()
399  {
400  //textDate.text = world.date.toString("-");
401 
402  if(active)
403  {
404  if ( cycleSimulationSpeed.getCurrentOption() == "PAUSED" )
405  {
406  //PAUSE_LOGIC=true;
407  //std::cout<<"Simulation paused.\n";
408  TIME_SCALE=0;
409  }
410  if ( cycleSimulationSpeed.getCurrentOption() == "1x" )
411  {
412  //PAUSE_LOGIC=false;
413  TIME_SCALE = 1;
414  }
415  else if ( cycleSimulationSpeed.getCurrentOption() == "60x" )
416  {
417  //PAUSE_LOGIC=false;
418  TIME_SCALE = 60;
419  }
420  else if ( cycleSimulationSpeed.getCurrentOption() == "100x" )
421  {
422  //PAUSE_LOGIC=false;
423  TIME_SCALE = 100;
424  }
425  else if ( cycleSimulationSpeed.getCurrentOption() == "1,000x" )
426  {
427  //PAUSE_LOGIC=false;
428  TIME_SCALE = 1000;
429  }
430  else if ( cycleSimulationSpeed.getCurrentOption() == "10,000x" )
431  {
432  //PAUSE_LOGIC=false;
433  TIME_SCALE = 10000;
434  }
435  else if ( cycleSimulationSpeed.getCurrentOption() == "100,000x" )
436  {
437  //PAUSE_LOGIC=false;
438  TIME_SCALE = 100000;
439  }
440  else if ( cycleSimulationSpeed.getCurrentOption() == "1,000,000x" )
441  {
442  //PAUSE_LOGIC=false;
443  TIME_SCALE = 1000000;
444  }
445  else if ( cycleSimulationSpeed.getCurrentOption() == "10,000,000x" )
446  {
447  //PAUSE_LOGIC=false;
448  TIME_SCALE = 10000000;
449  }
450  else if ( cycleSimulationSpeed.getCurrentOption() == "100,000,000x" )
451  {
452  //PAUSE_LOGIC=false;
453  TIME_SCALE = 100000000;
454  }
455 
456  }
457  }
458 
459  bool keyboardEvent (Keyboard* _keyboard)
460  {
461  // ESCAPE - Close all submenus and go back to main game.
462  // If all submenus are already closed, bring up main menu.
463  // If time is progressing, pause it.
464  if(_keyboard->isPressed(Keyboard::ESCAPE))
465  {
466  menuTribes.active = false;
467  menuCivs.active = false;
468  menuFlora.active = false;
469  menuFlora.menuFloraDetails.active = false;
470  menuCreatures.active = false;
471  menuCreatures.menuCreatureDetails.active = false;
472  menuWorld.active = false;
473  menuCharacter.active = false;
474  menuBiome.active = false;
475  menuBiome.menuBiomeDetails.active = false;
476  minimap.active = true;
477 
478 
479  //Clear the backlog so time stops progressing.
481  buttonIncrementContinuous.text = "+++";
483 
484  _keyboard->keyUp(Keyboard::ESCAPE);
485  }
486 
487  // TAB will switch between adventure mode and god mode.
488  if(_keyboard->isPressed(Keyboard::TAB))
489  {
490  if (playerCharacter == 0 )
491  {
492  std::cout<<"No character selected, selecting random character.\n";
493  //Automatically select a random character so we can go straight into adventure mode.
495  }
496 
497  if ( playerCharacter != 0 )
498  {
499  std::cout<<"Entering adventure mode.\n";
500 
502  {
504 
505  menuTribes.active = false;
506  menuCivs.active = false;
507  menuFlora.active = false;
508  menuCreatures.active = false;
509  menuWorld.active = false;
510  menuCharacter.active = false;
511  menuBiome.active = false;
512  minimap.active = false;
513  //active = false;
514 
516  }
517  else
518  {
519  std::cout<<"Error: world.prepareAdventureMode(~) failed.\n";
520  }
521 
522  _keyboard->keyUp(Keyboard::TAB);
523  }
524  else
525  {
526  std::cout<<"Error: No player pointer.\n";
527  }
528  }
529 
530  guiManager.keyboardEvent(_keyboard);
531 
532  worldViewer.keyboardEvent(_keyboard);
533  return false;
534  }
535 
536  bool mouseEvent (Mouse* _mouse)
537  {
538  worldViewer.mouseEvent(_mouse);
539  buttonExpandMap.mouseEvent(_mouse);
540 
541  if(buttonExpandMap.clicked==true)
542  {
543  fullScreenWorldView=!fullScreenWorldView;
544 
545  if (fullScreenWorldView==true)
546  {
547  worldViewer.setPanel(panelX1,panelY1,panelX2,panelY2);
548  buttonExpandMap.setPanel(panelX1,panelY1,panelX1+16,panelY1+16);
549  }
550  else
551  {
552  worldViewer.setPanel(panelX1+(panelX2/2),panelY1+(panelY2/2),panelX2,panelY2);
553  buttonExpandMap.setPanel
554  (panelX1+(panelX2/2),panelY1+(panelY2/2),panelX1+(panelX2/2)+16,panelY1+(panelY2/2)+16);
555  }
556 
557  buttonExpandMap.unclick();
558  eventResize();
559  }
560 
561  if (buttonIncrementDay.clicked==true)
562  {
563  buttonIncrementDay.unclick();
564  world.incrementTicks(86400);
565  }
566  if (buttonIncrementMonth.clicked==true)
567  {
568  buttonIncrementMonth.unclick();
569  world.incrementTicks(2592000);
570  }
571  if (buttonIncrementYear.clicked==true)
572  {
573  buttonIncrementYear.unclick();
574  world.ticksBacklog+=31104000;
575  }
576  if (buttonIncrementContinuous.clicked==true)
577  {
578  buttonIncrementContinuous.unclick();
579  //world.ticksBacklog+=311040000;
581 
583  {
584  buttonIncrementContinuous.text = "---";
585  }
586  else
587  {
588  buttonIncrementContinuous.text = "+++";
589  }
590 
591  std::cout<<"Incrementing continuously: "<<world.incrementContinuous<<".\n";
592  }
593 
594  if (buttonTribeMenu.clicked==true)
595  {
596  menuTribes.init();
597  menuTribes.active=true;
598  buttonTribeMenu.unclick();
599  }
600 
601  if (buttonWorldMenu.clicked==true)
602  {
603  std::cout<<"Worldmenu\n";
604  menuWorld.init();
605  menuWorld.active=true;
606  buttonWorldMenu.unclick();
607  }
608 
609  if (buttonCharacterMenu.clicked==true)
610  {
611  std::cout<<"Character menu\n";
612  menuCharacter.init();
613  menuCharacter.active=true;
614  buttonCharacterMenu.unclick();
615  }
616 
617  if (buttonCivMenu.clicked==true)
618  {
619  std::cout<<"Civ menu\n";
620  menuCivs.init();
621  menuCivs.active=true;
622  buttonCivMenu.unclick();
623  }
624 
625  if (buttonFlora.clicked==true)
626  {
627  std::cout<<"Flora menu\n";
628  menuFlora.init();
629  menuFlora.active=true;
630  buttonFlora.unclick();
631  }
632 
633  if (buttonCreaturesMenu.clicked==true)
634  {
635  std::cout<<"Creatures menu\n";
636  menuCreatures.init();
637  menuCreatures.active=true;
638  buttonCreaturesMenu.unclick();
639  }
640 
641 
642 
643 
644 
645 
646  if (buttonBiomeMenu.clicked==true)
647  {
648  std::cout<<"Biome menu\n";
649  menuBiome.init();
650  menuBiome.active=true;
651  buttonBiomeMenu.unclick();
652  }
653 
654  if (buttonMinimapBaseTexture.clicked==true)
655  {
656  std::cout<<"Toggle texture/colour mode\n";
658  buttonMinimapBaseTexture.unclick();
659  }
660  if (buttonMinimapBaseLand.clicked==true)
661  {
662  std::cout<<"Toggle texture/colour mode\n";
664  buttonMinimapBaseLand.unclick();
665  }
666  if (buttonTerritoryView.clicked==true)
667  {
668  std::cout<<"Toggle territory visibility.\n";
670  buttonTerritoryView.unclick();
671  }
672  if (buttonSubterraneanView.clicked==true)
673  {
674  std::cout<<"Toggle subterranean mode\n";
676  buttonSubterraneanView.unclick();
677  }
678 
679  //buttonMinimapBaseTexture.setPanel(panelX1,panelY1,panelX1+32,panelY1+16);
680  //buttonMinimapBaseColour.setPanel(panelX1+32,panelY1,panelX1+64,panelY1+16);
681  //buttonMinimapBaseLand.setPanel(panelX1+64,panelY1,panelX1+96,panelY1+16);
682 
683  /* If the guiManager did something with the mouse event. */
684  if(guiManager.mouseEvent(_mouse)==true)
685  {
686 
687  }
688 
689  if (menuTribes.lastRowClicked != -1 )
690  {
691  if ( world.vTribe.isSafe(menuTribes.lastRowClicked) )
692  {
693  Tribe* t = world.vTribe(menuTribes.lastRowClicked);
695  }
696 
697  menuTribes.lastRowClicked=-1;
698  }
699 
700  // maybe some kind of EVENT class would work better for this kind of thing?
701  if (menuWorld.lastRowClicked != -1 )
702  {
703  if ( world.vLandmass.isSafe(menuWorld.lastRowClicked) )
704  {
705  World_Landmass* l = menuWorld.selectedLandmass;
706  if ( l != 0 )
707  {
709  }
710  }
711  menuWorld.lastRowClicked=-1;
712  }
713  if (menuBiome.lastRowClicked != -1 )
714  {
715  if ( world.vBiome.isSafe(menuBiome.lastRowClicked) )
716  {
717  World_Biome* b = menuBiome.selectedBiome;
718  if ( b != 0 )
719  {
721  }
722  }
723  menuBiome.lastRowClicked=-1;
724  }
725 
726  return false;
727  }
728 
729  void eventResize()
730  {
731  /* World preview takes top-right quarter of screen. */
732 
733  int panelSizeX = panelX2-panelX1;
734  int panelSizeY = panelY2-panelY1;
735 
736  int worldPreviewX1=panelX1+(panelSizeX/2);
737  int worldPreviewY1=panelY1+(panelSizeY/2);
738 
739  /* Left column, centered. */
740  const int leftColumnCenterX = panelX1+(panelNX/4);
741 
742  Renderer::placeColour4(0,0,0,worldPreviewX1,worldPreviewY1,panelX2,panelY2);
743  worldViewer.setPanel(worldPreviewX1,worldPreviewY1,panelX2,panelY2);
744 
745  textSimulationSpeed.setPanel(panelX2-200, panelY2-30, panelX2-100, panelY2-20);
746  cycleSimulationSpeed.setPanel(panelX2-150, panelY2-30, panelX2, panelY2-20);
747 
748  buttonIncrementDay.setPanel(panelX2-120, panelY2-40, panelX2-160, panelY2-30);
749  buttonIncrementMonth.setPanel(panelX2-80, panelY2-40, panelX2-120, panelY2-30);
750  buttonIncrementYear.setPanel(panelX2-40, panelY2-40, panelX2-80, panelY2-30);
751  buttonIncrementContinuous.setPanel(panelX2, panelY2-40, panelX2-40, panelY2-30);
752 
753  buttonTribeMenu.setPanel(panelX2-180, panelY2-40, panelX2-220, panelY2-30);
754  buttonWorldMenu.setPanel(panelX2-220, panelY2-40, panelX2-260, panelY2-30);
755  buttonCharacterMenu.setPanel(panelX2-260, panelY2-40, panelX2-300, panelY2-30);
756  buttonBiomeMenu.setPanel(panelX2-300, panelY2-40, panelX2-340, panelY2-30);
757  buttonTerritoryView.setPanel(panelX2-340, panelY2-40, panelX2-380, panelY2-30);
758  buttonCivMenu.setPanel(panelX2-380, panelY2-40, panelX2-420, panelY2-30);
759  buttonSubterraneanView.setPanel(panelX2-420, panelY2-40, panelX2-460, panelY2-30);
760 
761  buttonFlora.setPanel(panelX2-460, panelY2-40, panelX2-500, panelY2-30);
762  buttonCreaturesMenu.setPanel(panelX2-500, panelY2-40, panelX2-540, panelY2-30);
763 
764  buttonMinimapBaseTexture.setPanel(panelX1,panelY1,panelX1+32,panelY1+16);
765  buttonMinimapBaseLand.setPanel(panelX1+32,panelY1,panelX1+64,panelY1+16);
766 
767  menuTribes.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
768  menuCivs.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
769  menuWorld.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
770  menuCharacter.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
771  menuBiome.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
772  menuFlora.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
773  menuCreatures.setPanel(panelX1,panelY1+5,panelX2,panelY2-40);
774  minimap.setPanel(panelX1,panelY1+16,panelX1+220,panelY1+236);
775 
776  if (fullScreenWorldView==true)
777  {
778  worldViewer.setPanel(panelX1,panelY1,panelX2,panelY2);
779  buttonExpandMap.setPanel(panelX1,panelY1,panelX1+16,panelY1+16);
780  }
781  else
782  {
783  worldViewer.setPanel(panelX1+(panelX2/2),panelY1+(panelY2/2),panelX2,panelY2);
784  buttonExpandMap.setPanel
785  (panelX1+(panelX2/2),panelY1+(panelY2/2),panelX1+(panelX2/2)+16,panelY1+(panelY2/2)+16);
786  }
787  }
788 
789 };
790 
791 #endif
void init()
Definition: Menu_Creatures.hpp:60
unsigned short int centerHeight
Definition: World_Local.hpp:214
Definition: Menu_World.hpp:15
Definition: Driver_GlobalObjects.hpp:114
Definition: Menu_Biome.hpp:19
Vector< World_Landmass * > vLandmass
Definition: World.hpp:112
World * world
Definition: World_Viewer.hpp:170
int centerX
Definition: World_Biome.hpp:77
long long unsigned int ticksBacklog
Definition: World.hpp:76
short int baseMetal
Definition: World_Local.hpp:185
void logicTick()
Definition: Menu_WorldSimulator.hpp:398
World world
Definition: Driver.cpp:43
Definition: Menu_Character.hpp:20
void setCenterTile(const double _centerTileX, const double _centerTileY, const int _subTileX=LOCAL_MAP_SIZE/2, const int _subTileY=LOCAL_MAP_SIZE/2)
Definition: World_Viewer.hpp:414
bool tilesetMode
Definition: World_Viewer.hpp:187
void render()
Definition: World_Viewer.hpp:603
bool prepareAdventureMode(Character *)
Definition: World.cpp:2285
int worldPop
Definition: Driver_Settings.cpp:132
Definition: Driver_Settings.cpp:111
Definition: Menu_Creatures.hpp:18
bool keyboardEvent(Keyboard *_keyboard)
Definition: Menu_WorldSimulator.hpp:459
WorldViewer worldViewer
Definition: World_Viewer.hpp:1214
WorldViewer_Minimap minimap
Definition: World_Viewer_Minimap.hpp:145
Menu_SpeciesDetails menuCreatureDetails
Definition: Menu_Creatures.hpp:44
Definition: World_Biome.hpp:46
Wildcat::Font font8x8
Definition: Driver_GlobalObjects.hpp:49
int worldY
Definition: WorldObjectGlobal.hpp:22
Definition: World_Local.hpp:58
Vector< std::string > vConsoleMessage
Definition: Driver_GlobalObjects.hpp:34
bool isUnderground
Definition: WorldObject.hpp:24
std::string getTerrainName()
Definition: World_Local.cpp:2822
Character * playerCharacter
Definition: Driver_Settings.cpp:105
int worldX
Definition: WorldObjectGlobal.hpp:22
void init()
Definition: Menu_Tribes.hpp:56
int queryWorldY
Definition: World.hpp:72
void render()
Definition: Menu_WorldSimulator.hpp:256
void init()
Definition: Menu_Biome.hpp:59
bool landMode
Definition: World_Viewer.hpp:189
Menu_WorldSimulator()
Definition: Menu_WorldSimulator.hpp:99
enumMenu activeMenu
Definition: Driver_Settings.cpp:113
void init()
Definition: Menu_Civs.hpp:55
int queryWorldX
Definition: World.hpp:72
int centerX
Definition: World_Landmass.hpp:21
World_Local * getTile(const int, const int)
Definition: World.cpp:2277
void setPanel(const int _x1, const int _y1, const int _x2, const int _y2)
Definition: World_Viewer.hpp:398
void eventResize()
Definition: Menu_WorldSimulator.hpp:729
World simulator menu. The player can simulate the world to build up civilisation, before jumping in...
Definition: Menu_WorldSimulator.hpp:25
bool territoryView
Definition: World_Viewer.hpp:186
int centerY
Definition: World_Landmass.hpp:21
Definition: Menu_Flora.hpp:19
Definition: World_Landmass.hpp:13
bool incrementContinuous
Definition: World.hpp:77
Menu_Biome_Details menuBiomeDetails
Definition: Menu_Biome.hpp:44
Character * getRandomCharacter()
Definition: World.cpp:501
bool isSafe(int _x, int _y)
Definition: World.cpp:470
int lastRowClicked
Definition: Menu_Biome.hpp:41
void setFont(Wildcat::Font *_font)
Definition: Menu_WorldSimulator.hpp:127
bool mouseEvent(Mouse *mouse)
Definition: World_Viewer.hpp:341
Definition: Tribe.hpp:21
int lastRowClicked
Definition: Menu_World.hpp:36
int TIME_SCALE
Definition: Driver_Settings.cpp:169
int centerY
Definition: World_Biome.hpp:77
World_Biome * selectedBiome
Definition: Menu_Biome.hpp:42
Vector< World_Biome * > vBiome
Definition: World.hpp:113
World * world
Definition: World_Viewer_Minimap.hpp:26
Menu_FloraDetails menuFloraDetails
Definition: Menu_Flora.hpp:43
void init()
Definition: Menu_Character.hpp:62
Data * data
Definition: World_Local.hpp:154
void incrementTicks(int)
Definition: World.cpp:934
bool active
Definition: World_Viewer.hpp:146
void init()
Definition: Menu_Flora.hpp:62
Definition: Menu_Tribes.hpp:15
int queryWorldYLocal
Definition: World.hpp:74
std::string getLandmassName(const int, const int)
Definition: World.cpp:2056
void init()
Definition: Menu_WorldSimulator.hpp:133
bool mouseEvent(Mouse *_mouse)
Definition: Menu_WorldSimulator.hpp:536
bool keyboardEvent(Keyboard *_keyboard)
Definition: World_Viewer.hpp:261
Definition: Menu_Civs.hpp:15
int queryWorldXLocal
Definition: World.hpp:74
void init()
Definition: Menu_World.hpp:51
Vector< Tribe * > vTribe
Definition: World.hpp:125
bool subterraneanMode
Definition: World_Viewer.hpp:188
World_Landmass * selectedLandmass
Definition: Menu_World.hpp:35
virtual Texture * currentTexture()
Definition: World_Local.cpp:2832
int lastRowClicked
Definition: Menu_Tribes.hpp:38
std::string getBiomeName(const int, const int)
Definition: World.cpp:2084
void centerView()
Definition: World_Viewer.hpp:249
Calendar calendar
Definition: World.hpp:131