About: add contributors list

This commit is contained in:
Poommetee Ketson 2017-05-31 09:07:27 +07:00
parent bd26fa7bf2
commit db439308e6
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/gles3/shaders/*.h
drivers/unix/os_unix_global_settings_path.cpp
editor/authors.h
editor/builtin_fonts.h
editor/certs_compressed.h
editor/doc_data_compressed.h

View file

@ -141,6 +141,30 @@ def make_translations_header(target, source, env):
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"):
@ -188,6 +212,10 @@ if (env["tools"] == "yes"):
env.Depends('#editor/builtin_fonts.h', flist)
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")

View file

@ -30,6 +30,7 @@
#include "editor_node.h"
#include "animation_editor.h"
#include "authors.h"
#include "bind/core_bind.h"
#include "class_db.h"
#include "core/io/resource_loader.h"
@ -5874,14 +5875,49 @@ EditorNode::EditorNode() {
about->get_ok()->set_text(TTR("Thanks!"));
about->set_hide_on_ok(true);
gui_base->add_child(about);
VBoxContainer *vbc = memnew(VBoxContainer);
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);
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");
TextureRect *logo = memnew(TextureRect);
logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
hbc->add_child(logo);
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);
gui_base->add_child(warning);