1/*
2 * LegacyClonk
3 *
4 * Copyright (c) RedWolf Design
5 * Copyright (c) 2005, Sven2
6 * Copyright (c) 2017-2020, The LegacyClonk 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// Startup screen for non-parameterized engine start
19
20#pragma once
21
22#include "C4Startup.h"
23
24class C4StartupMainDlg : public C4StartupDlg
25{
26private:
27 C4KeyBinding *pKeyDown, *pKeyUp, *pKeyEnter;
28 C4KeyBinding *pKeyEditor;
29 C4GUI::Label *pParticipantsLbl;
30 C4GUI::Button *pStartButton;
31 bool fFirstShown;
32
33protected:
34 virtual void DrawElement(C4FacetEx &cgo) override;
35 virtual void OnClosed(bool fOK) override; // callback when dlg got closed: Abort startup
36 C4GUI::ContextMenu *OnPlayerSelContext(C4GUI::Element *pBtn, int32_t iX, int32_t iY); // preliminary player selection via simple context menu
37 C4GUI::ContextMenu *OnPlayerSelContextAdd(C4GUI::Element *pBtn, int32_t iX, int32_t iY);
38 C4GUI::ContextMenu *OnPlayerSelContextRemove(C4GUI::Element *pBtn, int32_t iX, int32_t iY);
39 void OnPlayerSelContextAddPlr(C4GUI::Element *pTarget, const StdStrBuf &rsFilename);
40 void OnPlayerSelContextRemovePlr(C4GUI::Element *pTarget, const int &iIndex);
41 void UpdateParticipants();
42
43 void OnStartBtn(C4GUI::Control *btn); // callback: run default start button pressed
44 void OnPlayerSelectionBtn(C4GUI::Control *btn); // callback: player selection (preliminary version via context menus...)
45 void OnNetJoinBtn(C4GUI::Control *btn); // callback: join net work game (direct join only for now)
46 void OnOptionsBtn(C4GUI::Control *btn); // callback: Show options screen
47 void OnAboutBtn(C4GUI::Control *btn); // callback: Show about screen
48 void OnExitBtn(C4GUI::Control *btn); // callback: exit button pressed
49
50 bool SwitchToEditor();
51
52 bool KeyEnterDown(); // return pressed -> reroute as space
53 bool KeyEnterUp(); // return released -> reroute as space
54
55 virtual void OnShown() override; // callback when shown: Show log if restart after failure; show player creation dlg on first start
56
57public:
58 C4StartupMainDlg();
59 ~C4StartupMainDlg();
60};
61