Added Empty space
This commit is contained in:
parent
665a9d2c27
commit
0480ad3872
2 changed files with 27 additions and 3 deletions
22
src/main/java/org/betterx/ui/layout/components/Empty.java
Normal file
22
src/main/java/org/betterx/ui/layout/components/Empty.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,12 +4,14 @@ package org.betterx.ui.layout.components;
|
||||||
import org.betterx.ui.layout.components.input.MouseEvent;
|
import org.betterx.ui.layout.components.input.MouseEvent;
|
||||||
import org.betterx.ui.layout.values.Rectangle;
|
import org.betterx.ui.layout.values.Rectangle;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
public class Panel implements ComponentWithBounds {
|
public class Panel implements ComponentWithBounds {
|
||||||
protected Component<?> child;
|
protected Component<?> child;
|
||||||
public final Rectangle bounds;
|
public final Rectangle bounds;
|
||||||
|
|
||||||
public Panel(int width, int height) {
|
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) {
|
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) {
|
if (child != null) {
|
||||||
child.render(bounds, bounds);
|
child.render(poseStack, bounds, bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue