Added Empty space

This commit is contained in:
Frank 2022-07-15 00:57:05 +02:00
parent 665a9d2c27
commit 0480ad3872
2 changed files with 27 additions and 3 deletions

View file

@ -0,0 +1,22 @@
package org.betterx.ui.layout.components;
import org.betterx.ui.layout.values.DynamicSize;
public class Empty extends Component {
public Empty(
DynamicSize width,
DynamicSize height
) {
super(width, height, null);
}
@Override
public int getContentWidth() {
return 0;
}
@Override
public int getContentHeight() {
return 0;
}
}

View file

@ -4,12 +4,14 @@ package org.betterx.ui.layout.components;
import org.betterx.ui.layout.components.input.MouseEvent;
import org.betterx.ui.layout.values.Rectangle;
import com.mojang.blaze3d.vertex.PoseStack;
public class Panel implements ComponentWithBounds {
protected Component<?> child;
public final Rectangle bounds;
public Panel(int width, int height) {
bounds = new Rectangle(50, 50, width, height);
bounds = new Rectangle(0, 0, width, height);
}
public void setChild(Component<?> c) {
@ -30,9 +32,9 @@ public class Panel implements ComponentWithBounds {
}
}
public void render() {
public void render(PoseStack poseStack) {
if (child != null) {
child.render(bounds, bounds);
child.render(poseStack, bounds, bounds);
}
}