About: add contributors list

(cherry picked from commit db439308e6)
This commit is contained in:
Poommetee Ketson 2017-05-31 09:07:27 +07:00 committed by Rémi Verschelde
parent 0aa6b4aac7
commit 44864eb663
3 changed files with 67 additions and 2 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ core/version_generated.h
drivers/gles2/shaders/*.h drivers/gles2/shaders/*.h
drivers/gles3/shaders/*.h drivers/gles3/shaders/*.h
drivers/unix/os_unix_global_settings_path.cpp drivers/unix/os_unix_global_settings_path.cpp
editor/authors.h
editor/builtin_fonts.h editor/builtin_fonts.h
editor/certs_compressed.h editor/certs_compressed.h
editor/doc_data_compressed.h editor/doc_data_compressed.h

View File

@ -129,6 +129,30 @@ def make_translations_header(target, source, env):
g.write("#endif") g.write("#endif")
def make_authors_header(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
f = open(src, "rb")
g = open(dst, "wb")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _EDITOR_AUTHORS_H\n")
g.write("#define _EDITOR_AUTHORS_H\n")
g.write("static const char *dev_names[] = {\n")
name_count = -1
for line in f:
if name_count >= 0:
if line.startswith(" "):
g.write("\t\"" + line.strip() + "\",\n")
name_count += 1
elif line.strip() == "## Developers":
name_count = 0
g.write("\t0\n")
g.write("};\n")
g.write("#define AUTHORS_COUNT " + str(name_count) + "\n")
g.write("#endif\n")
if (env["tools"] == "yes"): if (env["tools"] == "yes"):
@ -169,6 +193,10 @@ if (env["tools"] == "yes"):
env.Depends('#editor/builtin_fonts.h', flist) env.Depends('#editor/builtin_fonts.h', flist)
env.Command('#editor/builtin_fonts.h', flist, make_fonts_header) env.Command('#editor/builtin_fonts.h', flist, make_fonts_header)
# Authors
env.Depends('#editor/authors.h', "../AUTHORS.md")
env.Command('#editor/authors.h', "../AUTHORS.md", make_authors_header)
env.add_source_files(env.editor_sources, "*.cpp") env.add_source_files(env.editor_sources, "*.cpp")

View File

@ -33,6 +33,7 @@
#include "version.h" #include "version.h"
#include "animation_editor.h" #include "animation_editor.h"
#include "authors.h"
#include "bind/core_bind.h" #include "bind/core_bind.h"
#include "core/io/resource_loader.h" #include "core/io/resource_loader.h"
#include "core/io/resource_saver.h" #include "core/io/resource_saver.h"
@ -6052,14 +6053,49 @@ EditorNode::EditorNode() {
about->get_ok()->set_text(TTR("Thanks!")); about->get_ok()->set_text(TTR("Thanks!"));
about->set_hide_on_ok(true); about->set_hide_on_ok(true);
gui_base->add_child(about); gui_base->add_child(about);
VBoxContainer *vbc = memnew(VBoxContainer);
HBoxContainer *hbc = memnew(HBoxContainer); HBoxContainer *hbc = memnew(HBoxContainer);
about->add_child(hbc); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->set_alignment(BoxContainer::ALIGN_CENTER);
about->add_child(vbc);
vbc->add_child(hbc);
Label *about_text = memnew(Label); Label *about_text = memnew(Label);
about_text->set_text(VERSION_FULL_NAME "\n(c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n");
TextureFrame *logo = memnew(TextureFrame); TextureFrame *logo = memnew(TextureFrame);
logo->set_texture(gui_base->get_icon("Logo", "EditorIcons")); logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
hbc->add_child(logo); hbc->add_child(logo);
hbc->add_child(about_text); hbc->add_child(about_text);
TabContainer *tc = memnew(TabContainer);
tc->set_custom_minimum_size(Vector2(740, 300));
vbc->add_child(tc);
ScrollContainer *dev_base = memnew(ScrollContainer);
dev_base->set_name(TTR("Developers"));
tc->add_child(dev_base);
HBoxContainer *dev_hbc = memnew(HBoxContainer);
dev_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
dev_base->add_child(dev_hbc);
for (int i = 0; i < 3; i++) {
Label *dev_label = memnew(Label);
dev_label->set_h_size_flags(Control::SIZE_EXPAND);
dev_label->set_v_size_flags(Control::SIZE_FILL);
dev_hbc->add_child(dev_label);
}
int dev_name_index = 0;
int dev_name_column = 0;
const int dev_index_max = AUTHORS_COUNT / 3 + (AUTHORS_COUNT % 3 == 0 ? 0 : 1);
String dev_name = "";
const char **dev_names_ptr = dev_names;
while (*dev_names_ptr) {
dev_name += String::utf8(*dev_names_ptr++);
if (++dev_name_index == dev_index_max || !*dev_names_ptr) {
dev_hbc->get_child(dev_name_column)->cast_to<Label>()->set_text(dev_name);
dev_name_column++;
dev_name = "";
dev_name_index = 0;
} else {
dev_name += "\n";
}
}
warning = memnew(AcceptDialog); warning = memnew(AcceptDialog);
gui_base->add_child(warning); gui_base->add_child(warning);