| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/ |
| 5 | * Copyright (c) 2013-2016, The OpenClonk Team and contributors |
| 6 | * Copyright (c) 2018-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 | // Credits screen |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include "C4Startup.h" |
| 23 | #include <string> |
| 24 | #include <vector> |
| 25 | |
| 26 | // startup dialog: credits |
| 27 | class C4StartupAboutDlg : public C4StartupDlg |
| 28 | { |
| 29 | public: |
| 30 | C4StartupAboutDlg(); |
| 31 | |
| 32 | static void AddLicense(std::string title, std::string licenseTitle, std::string licenseText); |
| 33 | |
| 34 | protected: |
| 35 | bool OnEnter() override { DoBack(); return true; } |
| 36 | bool OnEscape() override { DoBack(); return true; } |
| 37 | void DrawElement(C4FacetEx &cgo) override; |
| 38 | bool KeyBack() { DoBack(); return true; } |
| 39 | void OnBackBtn(C4GUI::Control *btn) { currentPage ? SwitchPage(number: currentPage - 1) : DoBack();} |
| 40 | void OnAdvanceButton(C4GUI::Control *btn) { SwitchPage(number: currentPage + 1); } |
| 41 | void OnUpdateBtn(C4GUI::Control *btn); |
| 42 | |
| 43 | private: |
| 44 | uint32_t currentPage = 0; |
| 45 | C4GUI::CallbackButton<C4StartupAboutDlg> *btnAdvance; |
| 46 | std::vector<std::vector<C4GUI::Element *>> aboutPages; |
| 47 | |
| 48 | void CreateTextWindowWithText(std::vector<C4GUI::Element *> &page, C4Rect &rect, const std::string &text, const std::string &title = "" ); |
| 49 | void DrawPersonList(std::vector<C4GUI::Element *> &page, struct PersonList &, const char *title, C4Rect &rect, uint8_t flags = 0); |
| 50 | C4GUI::Label *DrawCaption(C4Rect &, const char *); |
| 51 | void SwitchPage(uint32_t number); |
| 52 | void SetPageVisibility(uint32_t number, bool visible); |
| 53 | public: |
| 54 | |
| 55 | void DoBack(); // back to main menu |
| 56 | virtual bool HasBackground() override { return true; } |
| 57 | }; |
| 58 | |