Skip to content

Commit 7168326

Browse files
committed
textLayout
1 parent 4588e6a commit 7168326

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

sources/gui/texts/textLayout.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include "../gui.h"
2+
3+
#include <cage-engine/guiBuilder.h>
4+
5+
using namespace cage;
6+
7+
class GuiTestImpl : public GuiTestClass
8+
{
9+
public:
10+
void makeTexts(GuiBuilder *g)
11+
{
12+
g->label().text("May the Force be with you. _");
13+
g->label().text("I have a bad feeling about this. _");
14+
g->label().text("No, I am your father. _");
15+
g->label().text("Do. Or do not. There is no try. _");
16+
g->label().text("It’s a trap! _");
17+
g->label().text("I’m one with the Force. The Force is with me. _");
18+
g->label().text("Rebellions are built on hope. _");
19+
g->label().text("I find your lack of faith disturbing. _");
20+
g->label().text("These aren’t the droids you’re looking for. _");
21+
g->label().text("Help me, Obi-Wan Kenobi. You’re my only hope. _");
22+
g->label().text("Wars not make one great. _");
23+
g->label().text("It’s over, Anakin. I have the high ground. _");
24+
g->label().text("Never tell me the odds! _");
25+
g->label().text("Why, you stuck-up, half-witted, scruffy-looking …nerf-herder! _");
26+
g->label().text("I don’t like sand. It’s coarse and rough and irritating, and it gets everywhere. _");
27+
g->label().text("This is how liberty dies … with thunderous applause. _");
28+
g->label().text("That’s no moon. _");
29+
g->label().text("Chewie, we’re home. _");
30+
}
31+
32+
void initialize() override
33+
{
34+
guiBasicLayout();
35+
{
36+
Holder<GuiBuilder> g = newGuiBuilder(engineGuiEntities()->get(2));
37+
auto _ = g->leftRow();
38+
makeTexts(+g);
39+
}
40+
{
41+
Holder<GuiBuilder> g = newGuiBuilder(engineGuiEntities()->get(3));
42+
auto _ = g->leftRow();
43+
for (Real w = 100; w < 250; w += 30)
44+
{
45+
auto _ = g->topColumn().size(Vec2(w, Real::Nan()));
46+
g->label().text(Stringizer() + w);
47+
makeTexts(+g);
48+
}
49+
for (Real w = 100; w < 250; w += 30)
50+
{
51+
auto _1 = g->panel().size(Vec2(w, Real::Nan())).text(Stringizer() + w);
52+
auto _2 = g->topColumn();
53+
makeTexts(+g);
54+
}
55+
}
56+
}
57+
};
58+
59+
MAIN(GuiTestImpl, "text layout")

0 commit comments

Comments
 (0)