Skip to content

Commit

Permalink
Add menu to display the license texts from inside the game
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaesar committed May 1, 2020
1 parent 8b9f693 commit 965ee78
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ set(OC_CLONK_SOURCES
src/gui/C4ScriptGuiWindow.h
src/gui/C4StartupAboutDlg.cpp
src/gui/C4StartupAboutDlg.h
src/gui/C4StartupLegalDlg.cpp
src/gui/C4StartupLegalDlg.h
src/gui/C4Startup.cpp
src/gui/C4Startup.h
src/gui/C4StartupMainDlg.cpp
Expand Down
2 changes: 2 additions & 0 deletions planet/System.ocg/LanguageDE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ IDS_DLGTIP_CHATWIN=Nachrichten
IDS_DLGTIP_CLEAR=Löscht die Auswahl
IDS_DLGTIP_COPY=Kopiert die Auswahl in die Zwischenablage
IDS_DLGTIP_CUT=Schneidet die Auswahl aus und kopiert sie in die Zwischenablage
IDS_DLGTIP_DISPLAYLEGALNOTICE=Informationen zu Lizenzen und der Marke "Clonk" anzeigen
IDS_DLGTIP_EDITOR=Erstelle eigene Szenarien!
IDS_DLGTIP_EXIT=Beendet das Programm.
IDS_DLGTIP_GAMEGO=Startet das Spiel.
Expand Down Expand Up @@ -334,6 +335,7 @@ IDS_DLG_COPY=Kopieren
IDS_DLG_CUT=Ausschneiden
IDS_DLG_DEFINITION=Objektdefinition
IDS_DLG_DEFINITIONS=Objektdefinitionen
IDS_DLG_DISPLAYLEGALNOTICE=Lizenz, Marke
IDS_DLG_EDITOR=Editor
IDS_DLG_ERROR=Fehler
IDS_DLG_EXIT=&Beenden
Expand Down
2 changes: 2 additions & 0 deletions planet/System.ocg/LanguageUS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ IDS_DLGTIP_CHATWIN=Messages
IDS_DLGTIP_CLEAR=Clears the selection.
IDS_DLGTIP_COPY=Copies the selection to the clipboard.
IDS_DLGTIP_CUT=Moves the selection to the clipboard.
IDS_DLGTIP_DISPLAYLEGALNOTICE=Display legal info
IDS_DLGTIP_EDITOR=Create your own scenarios.
IDS_DLGTIP_EXIT=End the program.
IDS_DLGTIP_GAMEGO=Starts the game.
Expand Down Expand Up @@ -334,6 +335,7 @@ IDS_DLG_COPY=Copy
IDS_DLG_CUT=Cut
IDS_DLG_DEFINITION=Object Definition
IDS_DLG_DEFINITIONS=Object Definitions
IDS_DLG_DISPLAYLEGALNOTICE=Legal Info
IDS_DLG_EDITOR=Editor
IDS_DLG_ERROR=Error
IDS_DLG_EXIT=E&xit
Expand Down
59 changes: 59 additions & 0 deletions planet/System.ocg/Legal.ocg/COPYING-CONTENT.txt

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions planet/System.ocg/Legal.ocg/COPYING-ENGINE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
Copyright (c) 2009-2016, The OpenClonk Team and contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

(This is the ISC license. <http://opensource.org/licenses/ISC>)

Portions of the code have been contributed by other authors:
Copyright (c) 2006-2007 Alexander Post
Copyright (c) 2004-2013 Armin Burgmeier
Copyright (c) 2005-2006, 2008-2010 Asmageddon
Copyright (c) 2010, 2012 Benjamin Herr
Copyright (c) 2006, 2012 Bernhard Bonigl
Copyright (c) 2009-2010 Carl-Philip Hänsch
Copyright (c) 2001 Carlo Teubner
Copyright (c) 2009, 2011-2013 David Dormagen
Copyright (c) 2011-2012 Felix Wagner
Copyright (c) 2006 Florian Groß
Copyright (c) 2004-2012 Günther Brammer
Copyright (c) 2006-2008 Julian Raschke
Copyright (c) 2010-2012 Julius Michaelis
Copyright (c) 2010-2011 Maikel de Vries
Copyright (c) 2010 Manuel Riecke
Copyright (c) 2009 Mark Haßelbusch
Copyright (c) 2009-2012 Martin Plicht
Copyright (c) 1998-2009 Matthes Bender
Copyright (c) 2001 Michael Käser
Copyright (c) 2009 mizipzor
Copyright (c) 2009-2013 Nicolas Hake
Copyright (c) 2013 Oliver Schneider
Copyright (c) 2010 Peewee
Copyright (c) 2001-2011 Peter Wortmann
Copyright (c) 2012 Philipp Kern
Copyright (c) 2009-2010 Richard Gerum
Copyright (c) 2001-2013 Sven Eberhardt
Copyright (c) 2004-2005, 2009-2013 Tobias Zwick

Code inside the "thirdparty" directory has been included for convenience
and may be licensed under different terms. See the respective directories
for details.
16 changes: 16 additions & 0 deletions planet/System.ocg/Legal.ocg/TRADEMARK.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'Clonk' is a registered trademark of Matthes Bender. It may be used within
software products which are using source code or game content as made public
on the Clonk website (or derived from such) with the following limitations:

If the word 'Clonk' is used as the name of anything in your software product
then you must include the following notice in a suitable place (e.g. credits
screen): 'Clonk' is a registered trademark of Matthes Bender.

If the title of your software product contains the word 'Clonk' then you must
PREFIX the word with an added name of your choosing, e.g. 'MyClonk' or
'PortableClonk' and you must include the trademark notice above in a suitable
place (e.g. credits screen or splash screen).

If you are making your source code or game content available to other parties
in a way which allows adaptation you must include a copy of this license along
with any other applicable licenses.
4 changes: 4 additions & 0 deletions src/gui/C4Startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "graphics/C4FontLoader.h"
#include "graphics/C4GraphicsResource.h"
#include "gui/C4StartupAboutDlg.h"
#include "gui/C4StartupLegalDlg.h"
#include "gui/C4StartupMainDlg.h"
#include "gui/C4StartupNetDlg.h"
#include "gui/C4StartupOptionsDlg.h"
Expand Down Expand Up @@ -161,6 +162,9 @@ C4StartupDlg *C4Startup::SwitchDialog(DialogID eToDlg, bool fFade, const char *s
case SDID_About:
pToDlg = new C4StartupAboutDlg();
break;
case SDID_Legal:
pToDlg = new C4StartupLegalDlg();
break;
case SDID_PlrSel:
pToDlg = new C4StartupPlrSelDlg();
break;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/C4Startup.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class C4Startup
public:
C4StartupGraphics Graphics;

enum DialogID { SDID_Main=0, SDID_ScenSel, SDID_ScenSelNetwork, SDID_NetJoin, SDID_Options, SDID_About, SDID_PlrSel, SDID_Back };
enum DialogID { SDID_Main=0, SDID_ScenSel, SDID_ScenSelNetwork, SDID_NetJoin, SDID_Options, SDID_About, SDID_Legal, SDID_PlrSel, SDID_Back };

private:
bool fInStartup{false}, fLastDlgWasBack;
Expand All @@ -131,6 +131,7 @@ class C4Startup
friend class C4StartupScenSelDlg;
friend class C4StartupOptionsDlg;
friend class C4StartupAboutDlg;
friend class C4StartupLegalDlg;
friend class C4StartupPlrSelDlg;

public:
Expand Down
8 changes: 8 additions & 0 deletions src/gui/C4StartupAboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ C4StartupAboutDlg::C4StartupAboutDlg() : C4StartupDlg(LoadResStr("IDS_DLG_ABOUT"
int32_t iButtonWidth = caButtons.GetInnerWidth() / 4;
AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetGridCell(0,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnBackBtn));
btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN"));
AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_DLG_DISPLAYLEGALNOTICE"), caButtons.GetGridCell(1,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnLegalBtn));
btn->SetToolTip(LoadResStr("IDS_DLGTIP_DISPLAYLEGALNOTICE"));
#ifdef WITH_AUTOMATIC_UPDATE
AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_CHECKFORUPDATES"), caButtons.GetGridCell(2,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnUpdateBtn));
btn->SetToolTip(LoadResStr("IDS_DESC_CHECKONLINEFORNEWVERSIONS"));
Expand Down Expand Up @@ -336,3 +338,9 @@ void C4StartupAboutDlg::OnUpdateBtn(C4GUI::Control *btn)
C4UpdateDlg::CheckForUpdates(GetScreen());
}
#endif

void C4StartupAboutDlg::OnLegalBtn(C4GUI::Control *btn)
{
// advance to screen with license notices and whatnot
C4Startup::Get()->SwitchDialog(C4Startup::SDID_Legal);
}
1 change: 1 addition & 0 deletions src/gui/C4StartupAboutDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class C4StartupAboutDlg : public C4StartupDlg
void DrawElement(C4TargetFacet &cgo) override;
bool KeyBack() { DoBack(); return true; }
void OnBackBtn(C4GUI::Control *btn) { DoBack(); }
void OnLegalBtn(C4GUI::Control *btn);
#ifdef WITH_AUTOMATIC_UPDATE
void OnUpdateBtn(C4GUI::Control *btn);
#endif
Expand Down
74 changes: 74 additions & 0 deletions src/gui/C4StartupLegalDlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
* Copyright (c) 2010-2020, The OpenClonk Team and contributors
*
* Distributed under the terms of the ISC license; see accompanying file
* "COPYING" for details.
*
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
* See accompanying file "TRADEMARK" for details.
*
* To redistribute this file separately, substitute the full license texts
* for the above references.
*/
// About/credits screen

#include "C4Include.h"
#include "gui/C4StartupLegalDlg.h"

#include "C4Version.h"
#include "graphics/C4GraphicsResource.h"
#include "game/C4Application.h"

#include <fstream>


// Sorted by commit count this release, e.g.: git shortlog -s v7.0.. | sort -rn
// Stuff from the milestone project sorted in-between as those commits usually end up squashed.

// ------------------------------------------------
// --- C4StartupLegalDlg

C4StartupLegalDlg::C4StartupLegalDlg() : C4StartupDlg(LoadResStr("IDS_DLG_DISPLAYLEGALNOTICE"))
{
// ctor
UpdateSize();

C4Rect rcClient = GetContainedClientRect();

// bottom line buttons and copyright messages
C4GUI::ComponentAligner caMain(rcClient, 0,0, true);
C4GUI::ComponentAligner caButtons(caMain.GetFromBottom(caMain.GetHeight()*1/8), 0,0, false);
C4GUI::CallbackButton<C4StartupLegalDlg> *btn;
int32_t iButtonWidth = caButtons.GetInnerWidth() / 4;
AddElement(btn = new C4GUI::CallbackButton<C4StartupLegalDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetGridCell(0,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupLegalDlg::OnBackBtn));
btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN"));

C4Rect rect = caMain.GetFromTop(caMain.GetHeight());
auto textbox = new C4GUI::TextWindow(rect, 0, 0, 0, 100, 4096, "", true, nullptr, 0, true);
AddElement(textbox);
textbox->SetDecoration(false, false, nullptr, true);

C4Group licenses;
licenses.OpenAsChild(&::Application.SystemGroup, "Legal.ocg");
StdStrBuf licenseName;
while (licenses.FindNextEntry("*.txt", &licenseName)) {
std::string licenseNameCut(licenseName.getData(), std::max<size_t>(licenseName.getLength() - 4, 0));
textbox->AddTextLine(licenseNameCut.c_str(), &::GraphicsResource.TitleFont, C4GUI_NotifyFontClr, false, true);
char * licenseContent = nullptr; size_t licenseSize;
licenses.LoadEntry(licenseName.getData(), &licenseContent, &licenseSize, 1);
textbox->AddTextLine(licenseContent, &::GraphicsResource.TextFont, C4GUI_MessageFontClr, false, true);
free(licenseContent);
textbox->AddTextLine(" ", &::GraphicsResource.TitleFont, C4GUI_MessageFontClr, false, true);
}
textbox->UpdateHeight();
}

C4StartupLegalDlg::~C4StartupLegalDlg() = default;

void C4StartupLegalDlg::DoBack()
{
C4Startup::Get()->SwitchDialog(C4Startup::SDID_About);
}
43 changes: 43 additions & 0 deletions src/gui/C4StartupLegalDlg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
* Copyright (c) 2013-2020, The OpenClonk Team and contributors
*
* Distributed under the terms of the ISC license; see accompanying file
* "COPYING" for details.
*
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
* See accompanying file "TRADEMARK" for details.
*
* To redistribute this file separately, substitute the full license texts
* for the above references.
*/
// Credits screen

#ifndef INC_C4StartupLegalDlg
#define INC_C4StartupLegalDlg

#include "gui/C4Startup.h"

// startup dialog: credits
class C4StartupLegalDlg : public C4StartupDlg
{
public:
C4StartupLegalDlg();
~C4StartupLegalDlg() override;

protected:
bool OnEnter() override { DoBack(); return true; }
bool OnEscape() override { DoBack(); return true; }
void DrawElement(C4TargetFacet &) override {}
bool KeyBack() { DoBack(); return true; }
void OnBackBtn(C4GUI::Control *) { DoBack(); }

public:

void DoBack(); // back to main menu
};


#endif // INC_C4StartupLegalDlg

0 comments on commit 965ee78

Please sign in to comment.