OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Console.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* Handles engine execution in developer mode */
19 
20 #ifndef INC_C4Console
21 #define INC_C4Console
22 
23 #include "editor/C4ConsoleGUI.h"
24 #include "editor/C4EditCursor.h"
25 #include "editor/C4ObjectListDlg.h"
26 #include "editor/C4ToolsDlg.h"
27 
28 #include "platform/C4Window.h"
29 
30 const int C4CNS_ModePlay = 0,
34 
35 #define IDM_NET_CLIENT1 10000
36 #define IDM_NET_CLIENT2 10100
37 #define IDM_PLAYER_QUIT1 10200
38 #define IDM_PLAYER_QUIT2 10300
39 #define IDM_VIEWPORT_NEW1 10400
40 #define IDM_VIEWPORT_NEW2 10500
41 
42 class C4Console: public C4ConsoleGUI
43 {
44 public:
45  C4Console();
46  ~C4Console() override;
47  void Default();
48  void Clear() override;
49  void Close() override;
50  using C4Window::Init;
51  virtual C4Window * Init(C4AbstractApp * app);
52  void Execute();
53  void ClearPointers(C4Object *pObj);
54  bool Message(const char *szMessage, bool fQuery=false);
55  bool In(const char *szText);
56  void DoPlay();
57  void DoHalt();
58  void UpdateInputCtrl();
59  void UpdateMenus();
60  void InitGame();
61  bool TogglePause(); // key callpack: pause
62 public:
63  void CloseGame();
64  bool UpdatePlayerMenu();
65  bool UpdateViewportMenu();
66  void UpdateStatusBars();
67  // Menu
68  void ClearViewportMenu();
69  void UpdateNetMenu();
70  void ClearNetMenu();
71  void PlayerJoin();
72  void ViewportNew();
73  void HelpAbout();
74  bool FileSelect(StdStrBuf *sFilename, const char *szFilter, DWORD dwFlags, bool fSave=false);
75  bool SaveGame(const char * path);
76  bool SaveScenario(const char * path, bool export_packed=false);
77  bool FileSaveAs(bool fSaveGame, bool export_packed=false);
78  bool FileSave();
79  bool FileNew();
80  bool FileOpen(const char *filename=nullptr, bool host_in_network=false);
81  bool FileOpenWPlrs();
82  bool FileCommand();
83  bool FileClose();
84  bool FileQuit();
85  bool FileRecord();
86  void SetCaptionToFilename(const char* szFilename);
87 public:
91 
93  int Time,FPS;
94 
95  // Script MRU: Keep track of recent script executions in global and local windows
97  {
100  };
101 private:
102  std::list<StdCopyStrBuf> recent_script_input[2];
103 public:
104  std::list<const char *> GetScriptSuggestions(class C4PropList *target, RecentScriptInputLists section) const;
105  void RegisterRecentInput(const char *input, RecentScriptInputLists section);
106 };
107 
108 extern C4Console Console;
109 
110 #endif
bool FileSaveAs(bool fSaveGame, bool export_packed=false)
Definition: C4Console.cpp:269
void Execute()
Definition: C4Console.cpp:581
C4EditCursor EditCursor
Definition: C4Console.h:90
int FrameCounter
Definition: C4Console.h:92
RecentScriptInputLists
Definition: C4Console.h:96
void ClearNetMenu()
Definition: C4Console.cpp:569
void HelpAbout()
Definition: C4Console.cpp:449
void ClearViewportMenu()
Definition: C4Console.cpp:475
C4ToolsDlg ToolsDlg
Definition: C4Console.h:88
bool TogglePause()
Definition: C4Console.cpp:617
void UpdateNetMenu()
Definition: C4Console.cpp:542
void RegisterRecentInput(const char *input, RecentScriptInputLists section)
Definition: C4Console.cpp:639
void DoHalt()
Definition: C4Console.cpp:100
~C4Console() override
int Time
Definition: C4Console.h:93
bool FileClose()
Definition: C4Console.cpp:382
void UpdateMenus()
Definition: C4Console.cpp:504
const int C4CNS_ModeEdit
Definition: C4Console.h:31
void UpdateInputCtrl()
Definition: C4Console.cpp:481
void Clear() override
Definition: C4Console.cpp:418
void DoPlay()
Definition: C4Console.cpp:95
const int C4CNS_ModePlay
Definition: C4Console.h:30
void SetCaptionToFilename(const char *szFilename)
Definition: C4Console.cpp:575
void ViewportNew()
Definition: C4Console.cpp:456
const int C4CNS_ModeDraw
Definition: C4Console.h:33
C4ObjectListDlg ObjectListDlg
Definition: C4Console.h:89
void Close() override
Definition: C4Console.cpp:437
bool In(const char *szText)
Definition: C4Console.cpp:65
std::list< const char * > GetScriptSuggestions(class C4PropList *target, RecentScriptInputLists section) const
Definition: C4Console.cpp:622
bool FileOpenWPlrs()
Definition: C4Console.cpp:343
bool FileRecord()
Definition: C4Console.cpp:394
void Default()
Definition: C4Console.cpp:411
bool FileOpen(const char *filename=nullptr, bool host_in_network=false)
Definition: C4Console.cpp:319
bool UpdatePlayerMenu()
Definition: C4Console.cpp:488
bool SaveScenario(const char *path, bool export_packed=false)
Definition: C4Console.cpp:151
void InitGame()
Definition: C4Console.cpp:590
const int C4CNS_ModeCreateObject
Definition: C4Console.h:32
bool FileNew()
Definition: C4Console.cpp:298
int FPS
Definition: C4Console.h:93
void ClearPointers(C4Object *pObj)
Definition: C4Console.cpp:405
bool FileSave()
Definition: C4Console.cpp:262
void CloseGame()
Definition: C4Console.cpp:609
virtual C4Window * Init(WindowKind windowKind, C4AbstractApp *pApp, const char *Title, const C4Rect *size)
Definition: C4AppT.cpp:106
bool FileQuit()
Definition: C4Console.cpp:443
virtual C4Window * Init(C4AbstractApp *app)
Definition: C4Console.cpp:58
bool FileSelect(StdStrBuf *sFilename, const char *szFilter, DWORD dwFlags, bool fSave=false)
Definition: C4Console.cpp:389
bool FileCommand()
bool SaveGame(const char *path)
Definition: C4Console.cpp:127
C4Console Console
Definition: C4Globals.cpp:45
void UpdateStatusBars()
Definition: C4Console.cpp:105
bool UpdateViewportMenu()
Definition: C4Console.cpp:462
uint32_t DWORD
bool Message(const char *szMessage, bool fQuery=false)
Definition: C4Console.cpp:292
void PlayerJoin()
Definition: C4Console.cpp:513