1 /* 2 Copyright © 2020, Inochi2D Project 3 Distributed under the 2-Clause BSD License, see LICENSE file. 4 5 Authors: Luna Nielsen 6 */ 7 module creator.windows.about; 8 import creator.widgets.dummy; 9 import creator.windows; 10 import creator.core; 11 import creator; 12 import std.string; 13 import creator.utils.link; 14 import inochi2d; 15 import i18n; 16 17 class AboutWindow : Window { 18 protected: 19 override 20 void onBeginUpdate(int id) { 21 igSetNextWindowSize(ImVec2(640, 512), ImGuiCond.Appearing); 22 igSetNextWindowSizeConstraints(ImVec2(640, 512), ImVec2(float.max, float.max)); 23 super.onBeginUpdate(0); 24 } 25 26 override 27 void onUpdate() { 28 29 igBeginChild("##LogoArea", ImVec2(0, 92*incGetUIScale())); 30 igImage( 31 cast(void*)incGetLogo(), 32 ImVec2(64*incGetUIScale(), 64*incGetUIScale()), 33 ImVec2(0, 0), 34 ImVec2(1, 1), 35 ImVec4(1, 1, 1, 1), 36 ImVec4(0, 0, 0, 0) 37 ); 38 39 igSameLine(0, 8); 40 igSeparatorEx(ImGuiSeparatorFlags.Vertical); 41 igSameLine(0, 8); 42 igBeginChild("##LogoTextArea", ImVec2(0, -24)); 43 44 igText("Inochi Creator"); 45 igText("%s", (INC_VERSION~"\0").ptr); 46 igSeparator(); 47 igTextColored(ImVec4(0.5, 0.5, 0.5, 1), "I2D v. %s", (IN_VERSION~"\0").ptr); 48 igTextColored(ImVec4(0.5, 0.5, 0.5, 1), "imgui v. %s", igGetVersion()); 49 igEndChild(); 50 51 igSpacing(); 52 igText("Credits"); 53 igSeparator(); 54 igEndChild(); 55 igBeginChild("##CreditsArea", ImVec2(0, -28*incGetUIScale())); 56 57 igText(import("CONTRIBUTORS.md")); 58 59 igEndChild(); 60 61 igBeginChild("##ButtonArea", ImVec2(0, 0)); 62 ImVec2 space = incAvailableSpace(); 63 incDummy(ImVec2(space.x/2, space.y)); 64 igSameLine(0, 0); 65 66 space = incAvailableSpace(); 67 float spacing = (space.x/3)-8; 68 69 if (igButton("GitHub", ImVec2(8+spacing, 0))) { 70 incOpenLink("https://github.com/Inochi2D/inochi-creator"); 71 } 72 73 igSameLine(0, 8); 74 75 if (igButton("Twitter", ImVec2(spacing, 0))) { 76 incOpenLink("https://twitter.com/Inochi2D"); 77 } 78 79 igSameLine(0, 8); 80 81 if (igButton("Donate", ImVec2(spacing, 0))) { 82 incOpenLink("https://www.patreon.com/clipsey"); 83 } 84 igEndChild(); 85 86 87 } 88 89 public: 90 this() { 91 super(_("About")); 92 this.onlyOne = true; 93 } 94 }