diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java
index cb2d52a..5f9d0df 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java
@@ -85,13 +85,13 @@ public class Checkbox extends BasicButton {
assert getChildren().size() == 1 : "Checkbox expects that BasicButton contains exactly one child";
Component basicChild = getChild(0);
- Panel panel = new Panel(getName() + ".LabelAndTick", new LayoutHorizontal(0, 10));
+ Group group = new Group(getName() + ".LabelAndTick", new LayoutHorizontal(0, 10));
removeChild(basicChild);
setLayout(new LayoutAlign(0, 0.5f, 10));
- panel.setLayoutHint(basicChild.getLayoutHint());
- panel.addChild(new Tick());
- panel.addChild(basicChild);
- addChild(panel);
+ group.setLayoutHint(basicChild.getLayoutHint());
+ group.addChild(new Tick());
+ group.addChild(basicChild);
+ addChild(group);
addAction(b -> switchState());
}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Group.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Group.java
new file mode 100755
index 0000000..d8a8b23
--- /dev/null
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Group.java
@@ -0,0 +1,28 @@
+/*
+ * Progressia
+ * Copyright (C) 2020-2021 Wind Corporation and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package ru.windcorp.progressia.client.graphics.gui;
+
+public class Group extends Component {
+
+ public Group(String name, Layout layout) {
+ super(name);
+ setLayout(layout);
+ }
+
+}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java
old mode 100755
new mode 100644
index 88e10f1..3d47ed1
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java
@@ -15,14 +15,21 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
package ru.windcorp.progressia.client.graphics.gui;
-public class Panel extends Component {
+import ru.windcorp.progressia.client.graphics.Colors;
+import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
+
+public class Panel extends Group {
public Panel(String name, Layout layout) {
- super(name);
- setLayout(layout);
+ super(name, layout);
+ }
+
+ @Override
+ protected void assembleSelf(RenderTarget target) {
+ target.fill(getX(), getY(), getWidth(), getHeight(), Colors.LIGHT_GRAY);
+ target.fill(getX() + 2, getY() + 2, getWidth() - 4, getHeight() - 4, Colors.WHITE);
}
}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java
index bb9cee6..471efb6 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java
@@ -96,28 +96,28 @@ public class RadioButton extends BasicButton {
assert getChildren().size() == 1 : "RadioButton expects that BasicButton contains exactly one child";
Component basicChild = getChild(0);
- Panel panel = new Panel(getName() + ".LabelAndTick", new LayoutHorizontal(0, 10));
+ Group group = new Group(getName() + ".LabelAndTick", new LayoutHorizontal(0, 10));
removeChild(basicChild);
setLayout(new LayoutAlign(0, 0.5f, 10));
- panel.setLayoutHint(basicChild.getLayoutHint());
- panel.addChild(new Tick());
- panel.addChild(basicChild);
- addChild(panel);
+ group.setLayoutHint(basicChild.getLayoutHint());
+ group.addChild(new Tick());
+ group.addChild(basicChild);
+ addChild(group);
addListener(KeyEvent.class, e -> {
if (e.isRelease()) return false;
if (e.getKey() == GLFW.GLFW_KEY_LEFT || e.getKey() == GLFW.GLFW_KEY_UP) {
- if (group != null) {
- group.selectPrevious();
- group.getSelected().takeFocus();
+ if (this.group != null) {
+ this.group.selectPrevious();
+ this.group.getSelected().takeFocus();
}
return true;
} else if (e.getKey() == GLFW.GLFW_KEY_RIGHT || e.getKey() == GLFW.GLFW_KEY_DOWN) {
- if (group != null) {
- group.selectNext();
- group.getSelected().takeFocus();
+ if (this.group != null) {
+ this.group.selectNext();
+ this.group.getSelected().takeFocus();
}
return true;
}
diff --git a/src/main/java/ru/windcorp/progressia/test/LayerAbout.java b/src/main/java/ru/windcorp/progressia/test/LayerAbout.java
index 3eaff87..7b45fd4 100644
--- a/src/main/java/ru/windcorp/progressia/test/LayerAbout.java
+++ b/src/main/java/ru/windcorp/progressia/test/LayerAbout.java
@@ -23,7 +23,7 @@ import ru.windcorp.progressia.client.graphics.font.Font;
import ru.windcorp.progressia.client.graphics.font.Typeface;
import ru.windcorp.progressia.client.graphics.gui.GUILayer;
import ru.windcorp.progressia.client.graphics.gui.Label;
-import ru.windcorp.progressia.client.graphics.gui.Panel;
+import ru.windcorp.progressia.client.graphics.gui.Group;
import ru.windcorp.progressia.client.graphics.gui.layout.LayoutAlign;
import ru.windcorp.progressia.client.graphics.gui.layout.LayoutVertical;
import ru.windcorp.progressia.client.localization.MutableStringLocalized;
@@ -33,12 +33,12 @@ public class LayerAbout extends GUILayer {
public LayerAbout() {
super("LayerAbout", new LayoutAlign(1, 1, 5));
- Panel panel = new Panel("ControlDisplays", new LayoutVertical(5));
+ Group group = new Group("ControlDisplays", new LayoutVertical(5));
Font font = new Font().withColor(Colors.WHITE).deriveOutlined().withAlign(Typeface.ALIGN_RIGHT);
Font aboutFont = font.withColor(0xFF37A3E6).deriveBold();
- panel.addChild(
+ group.addChild(
new Label(
"About",
aboutFont,
@@ -46,7 +46,7 @@ public class LayerAbout extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"Version",
font,
@@ -54,7 +54,7 @@ public class LayerAbout extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"DebugHint",
font,
@@ -62,7 +62,7 @@ public class LayerAbout extends GUILayer {
)
);
- getRoot().addChild(panel);
+ getRoot().addChild(group);
}
diff --git a/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java b/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java
index 5e413e2..96274b7 100644
--- a/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java
+++ b/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java
@@ -26,6 +26,7 @@ import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
import ru.windcorp.progressia.client.graphics.gui.Button;
import ru.windcorp.progressia.client.graphics.gui.Checkbox;
import ru.windcorp.progressia.client.graphics.gui.GUILayer;
+import ru.windcorp.progressia.client.graphics.gui.Group;
import ru.windcorp.progressia.client.graphics.gui.Panel;
import ru.windcorp.progressia.client.graphics.gui.RadioButton;
import ru.windcorp.progressia.client.graphics.gui.RadioButtonGroup;
@@ -41,20 +42,14 @@ public class LayerButtonTest extends GUILayer {
public LayerButtonTest() {
super("LayerButtonTest", new LayoutBorderHorizontal(0));
- Panel background = new Panel("Background", new LayoutAlign(10)) {
+ Group background = new Group("Background", new LayoutAlign(10)) {
@Override
protected void assembleSelf(RenderTarget target) {
target.fill(Colors.toVector(0x88FFFFFF));
}
};
- Panel panel = new Panel("Panel", new LayoutVertical(10)) {
- @Override
- protected void assembleSelf(RenderTarget target) {
- target.fill(getX(), getY(), getWidth(), getHeight(), Colors.LIGHT_GRAY);
- target.fill(getX() + 2, getY() + 2, getWidth() - 4, getHeight() - 4, Colors.WHITE);
- }
- };
+ Panel panel = new Panel("Panel", new LayoutVertical(10));
Button blockableButton;
panel.addChild((blockableButton = new Button("BlockableButton", "Blockable")).addAction(b -> {
diff --git a/src/main/java/ru/windcorp/progressia/test/LayerTestGUI.java b/src/main/java/ru/windcorp/progressia/test/LayerTestGUI.java
index ca02ed8..2115e78 100755
--- a/src/main/java/ru/windcorp/progressia/test/LayerTestGUI.java
+++ b/src/main/java/ru/windcorp/progressia/test/LayerTestGUI.java
@@ -29,7 +29,7 @@ import ru.windcorp.progressia.client.graphics.font.Font;
import ru.windcorp.progressia.client.graphics.gui.DynamicLabel;
import ru.windcorp.progressia.client.graphics.gui.GUILayer;
import ru.windcorp.progressia.client.graphics.gui.Label;
-import ru.windcorp.progressia.client.graphics.gui.Panel;
+import ru.windcorp.progressia.client.graphics.gui.Group;
import ru.windcorp.progressia.client.graphics.gui.layout.LayoutAlign;
import ru.windcorp.progressia.client.graphics.gui.layout.LayoutVertical;
import ru.windcorp.progressia.client.localization.Localizer;
@@ -50,14 +50,14 @@ public class LayerTestGUI extends GUILayer {
public LayerTestGUI() {
super("LayerTestGui", new LayoutAlign(0, 1, 5));
- Panel panel = new Panel("ControlDisplays", new LayoutVertical(5));
+ Group group = new Group("ControlDisplays", new LayoutVertical(5));
Vec4 color = Colors.WHITE;
Font font = new Font().withColor(color).deriveOutlined();
TestPlayerControls tpc = TestPlayerControls.getInstance();
- panel.addChild(
+ group.addChild(
new Label(
"IsFlyingDisplay",
font,
@@ -65,7 +65,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"IsSprintingDisplay",
font,
@@ -73,7 +73,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"IsMouseCapturedDisplay",
font,
@@ -81,7 +81,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"CameraModeDisplay",
font,
@@ -92,7 +92,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"GravityModeDisplay",
font,
@@ -103,7 +103,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"LanguageDisplay",
font,
@@ -111,7 +111,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"FullscreenDisplay",
font,
@@ -119,7 +119,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"VSyncDisplay",
font,
@@ -127,7 +127,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new DynamicLabel(
"FPSDisplay",
font,
@@ -139,7 +139,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new DynamicLabel(
"TPSDisplay",
font,
@@ -148,7 +148,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new DynamicLabel(
"ChunkUpdatesDisplay",
font,
@@ -160,7 +160,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new DynamicLabel(
"PosDisplay",
font,
@@ -169,7 +169,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- panel.addChild(
+ group.addChild(
new Label(
"SelectedBlockDisplay",
font,
@@ -180,7 +180,7 @@ public class LayerTestGUI extends GUILayer {
)
)
);
- panel.addChild(
+ group.addChild(
new Label(
"SelectedTileDisplay",
font,
@@ -191,7 +191,7 @@ public class LayerTestGUI extends GUILayer {
)
)
);
- panel.addChild(
+ group.addChild(
new Label(
"PlacementModeHint",
font,
@@ -199,7 +199,7 @@ public class LayerTestGUI extends GUILayer {
)
);
- getRoot().addChild(panel);
+ getRoot().addChild(group);
}
public Runnable getUpdateCallback() {