Colobot
pausemanager.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
24 #pragma once
25 
26 #include "common/make_unique.h"
27 
28 #include <string>
29 #include <vector>
30 #include <memory>
31 
32 class CRobotMain;
33 
34 
36 {
37  PAUSE_NONE = 0,
38  PAUSE_ENGINE = (1<<0),
40  PAUSE_PHOTO = (1<<2),
42  PAUSE_MUTE_SOUND = (1<<4),
43 };
44 inline PauseType& operator|=(PauseType& a, const PauseType& b)
45 {
46  return a = static_cast<PauseType>(static_cast<unsigned int>(a) | static_cast<unsigned int>(b));
47 }
48 inline PauseType operator|(PauseType a, const PauseType& b)
49 {
50  return a |= b;
51 }
52 inline PauseType& operator&=(PauseType& a, const PauseType& b)
53 {
54  return a = static_cast<PauseType>(static_cast<unsigned int>(a) & static_cast<unsigned int>(b));
55 }
56 inline PauseType operator&(PauseType a, const PauseType& b)
57 {
58  return a &= b;
59 }
60 
61 enum PauseMusic
62 {
63  PAUSE_MUSIC_NONE = 0,
64  PAUSE_MUSIC_EDITOR = 1,
65  PAUSE_MUSIC_SATCOM = 2,
66 };
67 
68 struct ActivePause;
69 
71 {
72 public:
73  CPauseManager();
74  ~CPauseManager();
75 
76  ActivePause* ActivatePause(PauseType type, PauseMusic music = PAUSE_MUSIC_NONE);
77  void DeactivatePause(ActivePause* pause);
78 
79  void FlushPause();
80 
81  PauseType GetPause();
82  bool IsPauseType(PauseType type);
83 
84 private:
85  //static std::string GetPauseName(PauseType pause);
86  void Update();
87 
88 private:
89  CRobotMain* m_main;
90 
91  std::vector<std::unique_ptr<ActivePause>> m_activePause;
92  PauseMusic m_lastPauseMusic = PAUSE_MUSIC_NONE;
93 };
Definition: pausemanager.cpp:30
do not send events to objects
Definition: pausemanager.h:41
PauseType
Definition: pausemanager.h:35
photo mode, TODO: remove
Definition: pausemanager.h:40
Definition: robotmain.h:152
pause all the CEngine classes
Definition: pausemanager.h:38
mute sound
Definition: pausemanager.h:42
Definition: pausemanager.h:70
hide the shortcuts
Definition: pausemanager.h:39