ui work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-04-11 17:35:43 -04:00
parent 5c6dbe8f1b
commit 18cf677bd3
10 changed files with 269 additions and 128 deletions

View File

@ -1,5 +1,8 @@
@page survivalprogression Survival Progression @page survivalprogression Survival Progression
[TOC]
- @subpage survivalresearch
Thoughts on how to structure the progression of the survival gamemode Thoughts on how to structure the progression of the survival gamemode
@ -11,13 +14,39 @@ Craft stick + rock into stone pickaxe
## Stone Age ## Stone Age
Mine for metals Mine for resources
- Copper - Copper
- Tin - Tin
- Clay
Clay used to make pottery
- Storage Vessels
- Jugs
- Jars
- Cooking Pots
Chop trees for lumber
- Basic walls
- Crafting station(s)
Stone products
- Stone tools
- Forge
# Copper Age # Copper Age
Copper allows creating nails Copper materials
- Nails
- Rods
- Tool parts
Tools
- Scissors
- Saw
-
Crafting Stations
- Spinning wheel
- Loom

View File

@ -0,0 +1,10 @@
@page survivalresearch Survival Research
Research topics that take time. Can be compiled into books that transmit the topics faster. Ideas for categories:
Tools possible with a given material
Food techniques
Processing techniques for a given material
Building materials for a given raw material

View File

@ -1459,6 +1459,9 @@ Rename editor enum to prevent type conflict
(04/10/2025) (04/10/2025)
UI work UI work
(04/11/2025)
Fixing text input spacing (padding was taking up all of height)

View File

@ -36,31 +36,6 @@ public class InputMacros {
return rVal; return rVal;
} }
/**
* Creates a text input that has a label and optional placeholder
* @param label The label for the text input
* @param placeholder The placeholder (can be null if no placeholder desired)
* @return The div encapsulating all the individual elements
*/
public static Div createTextInput(String label, String placeholder){
Div rVal = Div.createDiv();
rVal.setFlexDirection(YogaFlexDirection.Row);
//the label
Label labelEl = Label.createLabel(label);
labelEl.setMarginRight(LABEL_MARGIN);
rVal.addChild(labelEl);
//the actual input
TextInput inputControl = TextInput.createTextInput();
if(placeholder != null){
inputControl.setText(placeholder);
}
rVal.addChild(inputControl);
return rVal;
}
/** /**
* Creates a text input that has a label and optional placeholder * Creates a text input that has a label and optional placeholder
* @param label The label for the text input * @param label The label for the text input

View File

@ -17,6 +17,7 @@ import electrosphere.renderer.ui.elements.Button;
import electrosphere.renderer.ui.elements.Div; import electrosphere.renderer.ui.elements.Div;
import electrosphere.renderer.ui.elements.FormElement; import electrosphere.renderer.ui.elements.FormElement;
import electrosphere.renderer.ui.elements.Label; import electrosphere.renderer.ui.elements.Label;
import electrosphere.renderer.ui.elements.Panel;
import electrosphere.renderer.ui.elementtypes.Element; import electrosphere.renderer.ui.elementtypes.Element;
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment; import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaJustification; import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaJustification;
@ -40,6 +41,26 @@ public class MenuGeneratorsLevelEditor {
*/ */
static final int MAX_SELECTABLE_SIZE = 128; static final int MAX_SELECTABLE_SIZE = 128;
/**
* Margin between each panel
*/
static final int PANEL_MARGIN = 15;
/**
* Padding of each panel
*/
static final int PANEL_PADDING = 50;
/**
* Width of a panel
*/
static final int PANEL_WIDTH = 500;
/**
* Height of a panel
*/
static final int PANEL_HEIGHT = 150;
/** /**
* Creates the top level menu for the level editor * Creates the top level menu for the level editor
* @return The actual element containing the menu * @return The actual element containing the menu
@ -128,8 +149,25 @@ public class MenuGeneratorsLevelEditor {
launchButton, launchButton,
editButton editButton
); );
row.setJustifyContent(YogaJustification.Between);
row.setFlexGrow(1.0f);
row.setMaxHeight(30); row.setMaxHeight(30);
existingLevelColumn.addChild(row);
//create panel to hold the row
Panel panel = Panel.createPanel();
panel.setWidth(PANEL_WIDTH);
panel.setHeight(PANEL_HEIGHT);
panel.setMarginBottom(PANEL_MARGIN);
panel.setMarginLeft(PANEL_MARGIN);
panel.setMarginRight(PANEL_MARGIN);
panel.setMarginTop(PANEL_MARGIN);
panel.setPaddingBottom(PANEL_PADDING);
panel.setPaddingLeft(PANEL_PADDING);
panel.setPaddingRight(PANEL_PADDING);
panel.setPaddingTop(PANEL_PADDING);
panel.addChild(row);
existingLevelColumn.addChild(panel);
} }
return rVal; return rVal;

View File

@ -21,6 +21,11 @@ import electrosphere.renderer.ui.events.NavigationEvent;
*/ */
public class MenuGeneratorsTitleMenu { public class MenuGeneratorsTitleMenu {
/**
* spacing between each button
*/
static final int BUTTON_SPACING = 25;
/** /**
* Creates the main title menu * Creates the main title menu
* @return The menu element * @return The menu element
@ -54,50 +59,82 @@ public class MenuGeneratorsTitleMenu {
optionPanel.addChild(titleLabel); optionPanel.addChild(titleLabel);
//button (multiplayer) //button (multiplayer)
optionPanel.addChild(Button.createButtonCentered("Singleplayer", 1.0f, () -> { {
Button button = Button.createButtonCentered("Singleplayer", 1.0f, () -> {
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldSelectMenu()); WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldSelectMenu());
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (multiplayer) //button (multiplayer)
optionPanel.addChild(Button.createButtonCentered("Multiplayer", 1.0f, () -> { {
Button button = Button.createButtonCentered("Multiplayer", 1.0f, () -> {
WindowUtils.replaceMainMenuContents(MenuGeneratorsMultiplayer.createMultiplayerMenu()); WindowUtils.replaceMainMenuContents(MenuGeneratorsMultiplayer.createMultiplayerMenu());
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (static level) //button (static level)
optionPanel.addChild(Button.createButtonCentered("Level Editor", 1.0f, () -> { {
Button button = Button.createButtonCentered("Level Editor", 1.0f, () -> {
WindowUtils.replaceMainMenuContents(MenuGeneratorsLevelEditor.createLevelEditorTopMenu()); WindowUtils.replaceMainMenuContents(MenuGeneratorsLevelEditor.createLevelEditorTopMenu());
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (options) //button (options)
optionPanel.addChild(Button.createButtonCentered("Options", 1.0f, () -> { {
Button button = Button.createButtonCentered("Options", 1.0f, () -> {
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleOptions.createOptionsMainMenu()); WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleOptions.createOptionsMainMenu());
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (sp debug) //button (sp debug)
optionPanel.addChild(Button.createButtonCentered("Debug SP Quickstart", 1.0f, () -> { {
Button button = Button.createButtonCentered("Debug SP Quickstart", 1.0f, () -> {
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.DEBUG_RANDOM_SP_WORLD); LoadingThread loadingThread = new LoadingThread(LoadingThreadType.DEBUG_RANDOM_SP_WORLD);
Globals.RUN_CLIENT = true; Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true; Globals.RUN_SERVER = true;
Globals.threadManager.start(loadingThread); Globals.threadManager.start(loadingThread);
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (sp debug) //button (sp debug)
optionPanel.addChild(Button.createButtonCentered("Load Test Generation Realm", 1.0f, () -> { {
Button button = Button.createButtonCentered("Load Test Generation Realm", 1.0f, () -> {
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.CHUNK_GENERATION_REALM); LoadingThread loadingThread = new LoadingThread(LoadingThreadType.CHUNK_GENERATION_REALM);
Globals.RUN_CLIENT = true; Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true; Globals.RUN_SERVER = true;
Globals.threadManager.start(loadingThread); Globals.threadManager.start(loadingThread);
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (ui testing) //button (ui testing)
optionPanel.addChild(Button.createButtonCentered("UI Testing", 1.0f, () -> { {
Button button = Button.createButtonCentered("UI Testing", 1.0f, () -> {
WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu()); WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu());
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
//button (Viewport Test) //button (Viewport Test)
optionPanel.addChild(Button.createButtonCentered("Viewport Test", 1.0f, () -> { {
Button button = Button.createButtonCentered("Viewport Test", 1.0f, () -> {
Globals.threadManager.start(new LoadingThread(LoadingThreadType.LOAD_VIEWPORT)); Globals.threadManager.start(new LoadingThread(LoadingThreadType.LOAD_VIEWPORT));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
button.setMarginTop(BUTTON_SPACING);
optionPanel.addChild(button);
}
rVal.addChild(optionPanel); rVal.addChild(optionPanel);

View File

@ -7,7 +7,6 @@ import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
import electrosphere.renderer.framebuffer.Framebuffer; import electrosphere.renderer.framebuffer.Framebuffer;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.ui.elementtypes.ClickableElement; import electrosphere.renderer.ui.elementtypes.ClickableElement;
import electrosphere.renderer.ui.elementtypes.DrawableElement; import electrosphere.renderer.ui.elementtypes.DrawableElement;
import electrosphere.renderer.ui.elementtypes.Element; import electrosphere.renderer.ui.elementtypes.Element;
@ -70,11 +69,6 @@ public class Button extends StandardContainerElement implements DrawableElement,
*/ */
Vector3f frameBackgroundColor = new Vector3f(COLOR_FRAME_UNFOCUSED_DEFAULT); Vector3f frameBackgroundColor = new Vector3f(COLOR_FRAME_UNFOCUSED_DEFAULT);
Vector3f boxPosition = new Vector3f();
Vector3f boxDimensions = new Vector3f();
Vector3f texPosition = new Vector3f(0,0,0);
Vector3f texScale = new Vector3f(1,1,0);
Material customMat = new Material();
boolean visible = false; boolean visible = false;
boolean focused = false; boolean focused = false;
@ -273,16 +267,6 @@ public class Button extends StandardContainerElement implements DrawableElement,
int framebufferPosY int framebufferPosY
) { ) {
//
//Draw decorations
float ndcWidth = (float)getWidth()/framebuffer.getWidth();
float ndcHeight = (float)getHeight()/framebuffer.getHeight();
float ndcX = (float)this.absoluteToFramebuffer(getAbsoluteX(),framebufferPosX)/framebuffer.getWidth();
float ndcY = (float)this.absoluteToFramebuffer(getAbsoluteY(),framebufferPosY)/framebuffer.getHeight();
boxPosition = new Vector3f(ndcX,ndcY,0);
boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
//this call binds the screen as the "texture" we're rendering to //this call binds the screen as the "texture" we're rendering to
//have to call before actually rendering //have to call before actually rendering
framebuffer.bind(openGLState); framebuffer.bind(openGLState);

View File

@ -23,14 +23,20 @@ public class Label extends StandardContainerElement implements DrawableElement {
*/ */
public static final float DEFAULT_FONT_SIZE = 1.0f; public static final float DEFAULT_FONT_SIZE = 1.0f;
String text = ""; /**
int textPixelWidth = 0; * The text of the label
*/
private String text = "";
float fontSize = DEFAULT_FONT_SIZE; /**
* The font size of the label
*/
private float fontSize = DEFAULT_FONT_SIZE;
static final Vector3f windowDrawDebugColor = new Vector3f(1.0f,1.0f,1.0f); /**
* The font to use with the label
Font font; */
private Font font;
/** /**
* Creates a label element * Creates a label element
@ -62,12 +68,15 @@ public class Label extends StandardContainerElement implements DrawableElement {
private Label(float fontSize){ private Label(float fontSize){
super(); super();
this.font = Globals.fontManager.getFont("default"); this.font = Globals.fontManager.getFont("default");
setHeight((int)(font.getFontHeight() * fontSize)); this.setHeight((int)(font.getFontHeight() * fontSize));
this.fontSize = fontSize; this.fontSize = fontSize;
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow); Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
} }
void generateLetters(){ /**
* Generates the letter elements of the label
*/
private void generateLetters(){
//free children //free children
for(Element child : childList){ for(Element child : childList){
Globals.signalSystem.post(SignalType.YOGA_DESTROY, child); Globals.signalSystem.post(SignalType.YOGA_DESTROY, child);
@ -95,22 +104,29 @@ public class Label extends StandardContainerElement implements DrawableElement {
this.generateLetters(); this.generateLetters();
} }
/**
* Sets the text of the label
* @param text The text
*/
public void setText(String text){ public void setText(String text){
this.text = text; this.text = text;
textPixelWidth = 0; this.generateLetters();
for(int i = 0; i < text.length(); i++){
Vector3f bitMapDimension = this.font.getDimensionOfCharacterDiscrete(text.charAt(i));
textPixelWidth = textPixelWidth + (int)bitMapDimension.x;
}
generateLetters();
} }
/**
* Sets the color of the label
* @param color The color
*/
public void setColor(Vector3f color){ public void setColor(Vector3f color){
for(Element character : childList){ for(Element character : childList){
((BitmapCharacter)character).setColor(color); ((BitmapCharacter)character).setColor(color);
} }
} }
/**
* Gets the text of the label
* @return The text
*/
public String getText(){ public String getText(){
return text; return text;
} }
@ -134,6 +150,7 @@ public class Label extends StandardContainerElement implements DrawableElement {
} }
} }
@Override
public boolean handleEvent(Event event){ public boolean handleEvent(Event event){
return true; return true;
} }

View File

@ -57,6 +57,10 @@ public class Panel extends StandardContainerElement implements DrawableElement {
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow); Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
} }
/**
* Sets the color of the panel
* @param color The color
*/
public void setColor(Vector3f color){ public void setColor(Vector3f color){
for(Element character : childList){ for(Element character : childList){
((BitmapCharacter)character).setColor(color); ((BitmapCharacter)character).setColor(color);
@ -89,6 +93,7 @@ public class Panel extends StandardContainerElement implements DrawableElement {
} }
} }
@Override
public boolean handleEvent(Event event){ public boolean handleEvent(Event event){
return true; return true;
} }

View File

@ -6,7 +6,6 @@ import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
import electrosphere.renderer.framebuffer.Framebuffer; import electrosphere.renderer.framebuffer.Framebuffer;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.ui.elementtypes.ClickableElement; import electrosphere.renderer.ui.elementtypes.ClickableElement;
import electrosphere.renderer.ui.elementtypes.DrawableElement; import electrosphere.renderer.ui.elementtypes.DrawableElement;
import electrosphere.renderer.ui.elementtypes.Element; import electrosphere.renderer.ui.elementtypes.Element;
@ -22,7 +21,6 @@ import electrosphere.renderer.ui.font.Font;
import electrosphere.renderer.ui.frame.UIFrameUtils; import electrosphere.renderer.ui.frame.UIFrameUtils;
import org.joml.Vector3f; import org.joml.Vector3f;
import org.lwjgl.util.yoga.Yoga;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -36,41 +34,75 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
*/ */
static final int DEFAULT_PADDING = Button.DEFAULT_PADDING; static final int DEFAULT_PADDING = Button.DEFAULT_PADDING;
/**
* The color of the background element of the input
*/
Vector3f backgroundColor = new Vector3f(0.2f,0.2f,0.2f); Vector3f backgroundColor = new Vector3f(0.2f,0.2f,0.2f);
Vector3f boxPosition = new Vector3f(); /**
Vector3f boxDimensions = new Vector3f(); * Stores visibility status
Vector3f texPosition = new Vector3f(0,0,0); */
Vector3f texScale = new Vector3f(1,1,0); private boolean visible = false;
Material customMat = new Material();
public boolean visible = false; /**
* Stores focused status
*/
private boolean focused = false;
boolean focused = false; /**
FocusEventCallback onFocusCallback; * Optional callback for gaining focus
FocusEventCallback onLoseFocusCallback; */
KeyboardEventCallback onKeyPressCallback; private FocusEventCallback onFocusCallback;
ClickEventCallback onClickCallback;
ValueChangeEventCallback onValueChangeCallback;
Vector3f color;
String text = ""; /**
int textPixelWidth = 0; * Optional callback for losing focus
*/
private FocusEventCallback onLoseFocusCallback;
float fontSize = Label.DEFAULT_FONT_SIZE; /**
* Optional callback for key presses
*/
private KeyboardEventCallback onKeyPressCallback;
/**
* Optional callback for mouse clicks
*/
private ClickEventCallback onClickCallback;
Font font; /**
* Optional callback for value changes
*/
private ValueChangeEventCallback onValueChangeCallback;
/**
* The color of the text input
*/
private Vector3f color;
/**
* The content of the text input
*/
private String text = "";
/**
* The size of the font for the text input
*/
private float fontSize = Label.DEFAULT_FONT_SIZE;
/**
* The font to use with the text input
*/
private Font font;
/** /**
* Audio path played when typing into the input * Audio path played when typing into the input
*/ */
String audioPathOnType = AssetDataStrings.UI_TONE_CURSOR_SECONDARY; private String audioPathOnType = AssetDataStrings.UI_TONE_CURSOR_SECONDARY;
/** /**
* Audio path played when typing into the input * Audio path played when typing into the input
*/ */
String audioPathOnTypeError = AssetDataStrings.UI_TONE_ERROR_SECONDARY; private String audioPathOnTypeError = AssetDataStrings.UI_TONE_ERROR_SECONDARY;
/** /**
* Creates a text input element using the default font size * Creates a text input element using the default font size
@ -90,9 +122,13 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
this.font = Globals.fontManager.getFont("default"); this.font = Globals.fontManager.getFont("default");
this.fontSize = fontSize; this.fontSize = fontSize;
this.color = new Vector3f(1,1,1); this.color = new Vector3f(1,1,1);
this.setHeight((int)(font.getFontHeight() * fontSize)); this.setHeight((int)(font.getFontHeight() * fontSize) + DEFAULT_PADDING * 2);
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow); this.setFlexDirection(YogaFlexDirection.Row);
Yoga.YGNodeStyleSetMinWidth(this.yogaNode, 1); this.setMinWidth(1);
this.setPaddingBottom(DEFAULT_PADDING);
this.setPaddingLeft(DEFAULT_PADDING);
this.setPaddingRight(DEFAULT_PADDING);
this.setPaddingTop(DEFAULT_PADDING);
} }
/** /**
@ -103,28 +139,28 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
Globals.signalSystem.post(SignalType.YOGA_DESTROY, el); Globals.signalSystem.post(SignalType.YOGA_DESTROY, el);
} }
this.clearChildren(); this.clearChildren();
int accumulatingWidth = 0;
for(int i = 0; i < text.length(); i++){ for(int i = 0; i < text.length(); i++){
char toDraw = text.charAt(i); char toDraw = text.charAt(i);
Vector3f bitMapDimension = this.font.getDimensionOfCharacterDiscrete(toDraw); Vector3f bitMapDimension = this.font.getDimensionOfCharacterDiscrete(toDraw);
BitmapCharacter newLetter = new BitmapCharacter(this.font,(int)(bitMapDimension.x * fontSize), this.getHeight(), fontSize, toDraw); BitmapCharacter newLetter = new BitmapCharacter(this.font,(int)(bitMapDimension.x * fontSize), this.getHeight() - DEFAULT_PADDING * 2, fontSize, toDraw);
accumulatingWidth += bitMapDimension.x * fontSize;
newLetter.setColor(color); newLetter.setColor(color);
this.addChild(newLetter); this.addChild(newLetter);
} }
Yoga.YGNodeStyleSetWidth(yogaNode, accumulatingWidth);
} }
/**
* Sets the content of the text input
* @param text The content
*/
public void setText(String text){ public void setText(String text){
this.text = text; this.text = text;
this.textPixelWidth = 0;
for(int i = 0; i < text.length(); i++){
Vector3f bitMapDimension = this.font.getDimensionOfCharacterDiscrete(text.charAt(i));
this.textPixelWidth = this.textPixelWidth + (int)bitMapDimension.x;
}
this.generateLetters(); this.generateLetters();
} }
/**
* Sets the color of the text input
* @param color The color
*/
public void setColor(Vector3f color){ public void setColor(Vector3f color){
this.color.set(color); this.color.set(color);
for(Element character : childList){ for(Element character : childList){
@ -132,6 +168,10 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
} }
} }
/**
* Gets the current contents of the text input
* @return The contents
*/
public String getText(){ public String getText(){
return text; return text;
} }
@ -152,13 +192,13 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
//render background of window //render background of window
if(this.isFocused()){ if(this.isFocused()){
UIFrameUtils.drawFrame( UIFrameUtils.drawFrame(
AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_1, backgroundColor, 48, 12, AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_3, backgroundColor, 48, 12,
this.getAbsoluteX(), this.getAbsoluteY(), this.getWidth(), this.getHeight(), this.getAbsoluteX(), this.getAbsoluteY(), this.getWidth(), this.getHeight(),
framebuffer, framebufferPosX, framebufferPosY framebuffer, framebufferPosX, framebufferPosY
); );
} else { } else {
UIFrameUtils.drawFrame( UIFrameUtils.drawFrame(
AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_2, backgroundColor, 48, 12, AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_3, backgroundColor, 48, 12,
this.getAbsoluteX(), this.getAbsoluteY(), this.getWidth(), this.getHeight(), this.getAbsoluteX(), this.getAbsoluteY(), this.getWidth(), this.getHeight(),
framebuffer, framebufferPosX, framebufferPosY framebuffer, framebufferPosX, framebufferPosY
); );
@ -172,14 +212,17 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
} }
} }
@Override
public boolean getVisible() { public boolean getVisible() {
return visible; return visible;
} }
@Override
public void setVisible(boolean draw) { public void setVisible(boolean draw) {
this.visible = draw; this.visible = draw;
} }
@Override
public boolean handleEvent(Event event){ public boolean handleEvent(Event event){
boolean propagate = true; boolean propagate = true;
if(event instanceof FocusEvent){ if(event instanceof FocusEvent){