interaction target ui element
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
2d26a8e73a
commit
589833b32f
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Wed Apr 16 16:24:00 EDT 2025
|
#Sat Apr 26 14:36:52 EDT 2025
|
||||||
buildNumber=619
|
buildNumber=620
|
||||||
|
|||||||
@ -17,5 +17,7 @@
|
|||||||
|
|
||||||
+ bug fixes
|
+ bug fixes
|
||||||
- Terrain edits do not save
|
- Terrain edits do not save
|
||||||
|
- Panel does not draw its decoration if target framebuffer is the framebuffer of the window (maybe window isnt drawings its content framebuffer?)
|
||||||
|
- Window does not play nice with its minWidth/minHeight being set differently
|
||||||
|
|
||||||
+ unreproducible bugs
|
+ unreproducible bugs
|
||||||
|
|||||||
@ -1546,6 +1546,7 @@ Fab selection tool
|
|||||||
Fab selection tool actually loads fab files
|
Fab selection tool actually loads fab files
|
||||||
Fix fab file reading
|
Fix fab file reading
|
||||||
Fab tool can show transparent, loaded version of fab file
|
Fab tool can show transparent, loaded version of fab file
|
||||||
|
Interaction target tooltip at top of window
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import org.joml.Quaterniond;
|
|||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.ode4j.ode.DBody;
|
import org.ode4j.ode.DBody;
|
||||||
|
|
||||||
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
|
import electrosphere.client.ui.menu.ingame.InteractionTargetMenu;
|
||||||
import electrosphere.collision.CollisionBodyCreation;
|
import electrosphere.collision.CollisionBodyCreation;
|
||||||
import electrosphere.collision.CollisionEngine;
|
import electrosphere.collision.CollisionEngine;
|
||||||
import electrosphere.collision.PhysicsUtils;
|
import electrosphere.collision.PhysicsUtils;
|
||||||
@ -17,6 +19,7 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
|
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||||
import electrosphere.game.data.collidable.CollidableTemplate;
|
import electrosphere.game.data.collidable.CollidableTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -210,4 +213,25 @@ public class ClientInteractionEngine {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the interaction target label
|
||||||
|
*/
|
||||||
|
public static void updateInteractionTargetLabel(){
|
||||||
|
if(Globals.playerEntity != null && Globals.playerCamera != null){
|
||||||
|
boolean set = false;
|
||||||
|
Entity camera = Globals.playerCamera;
|
||||||
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)).mul(-1.0);
|
||||||
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
||||||
|
Entity target = ClientInteractionEngine.rayCast(centerPos, eyePos);
|
||||||
|
if(target != null){
|
||||||
|
String text = CommonEntityUtils.getEntitySubtype(target);
|
||||||
|
InteractionTargetMenu.setInteractionTargetString(text);
|
||||||
|
set = true;
|
||||||
|
}
|
||||||
|
if(!set){
|
||||||
|
InteractionTargetMenu.setInteractionTargetString("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import electrosphere.client.entity.camera.CameraEntityUtils;
|
|||||||
import electrosphere.client.entity.crosshair.Crosshair;
|
import electrosphere.client.entity.crosshair.Crosshair;
|
||||||
import electrosphere.client.fluid.manager.ClientFluidManager;
|
import electrosphere.client.fluid.manager.ClientFluidManager;
|
||||||
import electrosphere.client.instancing.InstanceUpdater;
|
import electrosphere.client.instancing.InstanceUpdater;
|
||||||
|
import electrosphere.client.interact.ClientInteractionEngine;
|
||||||
import electrosphere.client.terrain.manager.ClientTerrainManager;
|
import electrosphere.client.terrain.manager.ClientTerrainManager;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
@ -117,6 +118,9 @@ public class ClientSimulation {
|
|||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client functions
|
||||||
|
*/
|
||||||
public void runClientFunctions(){
|
public void runClientFunctions(){
|
||||||
Globals.profiler.beginCpuSample("client functions");
|
Globals.profiler.beginCpuSample("client functions");
|
||||||
ClientTerrainManager.generateTerrainChunkGeometry();
|
ClientTerrainManager.generateTerrainChunkGeometry();
|
||||||
@ -128,6 +132,7 @@ public class ClientSimulation {
|
|||||||
this.updateFirstPersonAttachments();
|
this.updateFirstPersonAttachments();
|
||||||
//bones have potenitally moved, so need to update where attached entities actually are before drawing
|
//bones have potenitally moved, so need to update where attached entities actually are before drawing
|
||||||
AttachUtils.clientUpdateAttachedEntityPositions();
|
AttachUtils.clientUpdateAttachedEntityPositions();
|
||||||
|
ClientInteractionEngine.updateInteractionTargetLabel();
|
||||||
// updateCellManager();
|
// updateCellManager();
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,9 +195,7 @@ public class NaturalInventoryPanel {
|
|||||||
Entity itemEntity = finalEnt;
|
Entity itemEntity = finalEnt;
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(itemEntity);
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(itemEntity);
|
||||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION,()->{
|
Globals.signalSystem.post(SignalType.UI_MODIFICATION,()->{
|
||||||
itemTooltip = Tooltip.create(null,
|
itemTooltip = Tooltip.create(Div.createCol(Label.createLabel(itemData.getId())));
|
||||||
Div.createCol(Label.createLabel(itemData.getId()))
|
|
||||||
);
|
|
||||||
itemTooltip.setPositionX(panel.getAbsoluteX() + panelWidth);
|
itemTooltip.setPositionX(panel.getAbsoluteX() + panelWidth);
|
||||||
itemTooltip.setPositionY(panel.getAbsoluteY());
|
itemTooltip.setPositionY(panel.getAbsoluteY());
|
||||||
});
|
});
|
||||||
|
|||||||
@ -36,11 +36,7 @@ public class PlayerInventoryWindow {
|
|||||||
* @return The panel component
|
* @return The panel component
|
||||||
*/
|
*/
|
||||||
public static Window createPlayerInventoryWindow(Entity entity){
|
public static Window createPlayerInventoryWindow(Entity entity){
|
||||||
int width = 750;
|
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState());
|
||||||
int height = 750;
|
|
||||||
|
|
||||||
|
|
||||||
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState(), width, height);
|
|
||||||
rVal.setParentAlignItem(YogaAlignment.Center);
|
rVal.setParentAlignItem(YogaAlignment.Center);
|
||||||
rVal.setParentJustifyContent(YogaJustification.Center);
|
rVal.setParentJustifyContent(YogaJustification.Center);
|
||||||
|
|
||||||
|
|||||||
@ -196,9 +196,7 @@ public class ToolbarInventoryPanel {
|
|||||||
Entity itemEntity = inventory.getItemSlot("" + itemId) ;
|
Entity itemEntity = inventory.getItemSlot("" + itemId) ;
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(itemEntity);
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(itemEntity);
|
||||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION,()->{
|
Globals.signalSystem.post(SignalType.UI_MODIFICATION,()->{
|
||||||
itemTooltip = Tooltip.create(null,
|
itemTooltip = Tooltip.create(Div.createCol(Label.createLabel(itemData.getId())));
|
||||||
Div.createCol(Label.createLabel(itemData.getId()))
|
|
||||||
);
|
|
||||||
itemTooltip.setPositionX(panel.getAbsoluteX() + panelWidth);
|
itemTooltip.setPositionX(panel.getAbsoluteX() + panelWidth);
|
||||||
itemTooltip.setPositionY(panel.getAbsoluteY());
|
itemTooltip.setPositionY(panel.getAbsoluteY());
|
||||||
});
|
});
|
||||||
|
|||||||
@ -80,4 +80,9 @@ public class WindowStrings {
|
|||||||
*/
|
*/
|
||||||
public static final String CRAFTING = "crafting";
|
public static final String CRAFTING = "crafting";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window for displaying the current target
|
||||||
|
*/
|
||||||
|
public static final String TARGET_TOOLTIP = "targetTooltip";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package electrosphere.client.ui.menu;
|
|||||||
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||||
import electrosphere.client.ui.components.PlayerInventoryWindow;
|
import electrosphere.client.ui.components.PlayerInventoryWindow;
|
||||||
import electrosphere.client.ui.menu.ingame.CraftingWindow;
|
import electrosphere.client.ui.menu.ingame.CraftingWindow;
|
||||||
|
import electrosphere.client.ui.menu.ingame.InteractionTargetMenu;
|
||||||
import electrosphere.client.ui.menu.ingame.MenuGeneratorsInventory;
|
import electrosphere.client.ui.menu.ingame.MenuGeneratorsInventory;
|
||||||
import electrosphere.client.ui.menu.mainmenu.MenuGeneratorsTitleMenu;
|
import electrosphere.client.ui.menu.mainmenu.MenuGeneratorsTitleMenu;
|
||||||
import electrosphere.controls.ControlHandler.ControlsState;
|
import electrosphere.controls.ControlHandler.ControlsState;
|
||||||
@ -204,11 +205,12 @@ public class WindowUtils {
|
|||||||
* Inits all base windows
|
* Inits all base windows
|
||||||
*/
|
*/
|
||||||
public static void initBaseWindows(){
|
public static void initBaseWindows(){
|
||||||
initLoadingWindow();
|
WindowUtils.initLoadingWindow();
|
||||||
initItemDropWindow();
|
WindowUtils.initItemDropWindow();
|
||||||
initItemDragContainerWindow();
|
WindowUtils.initItemDragContainerWindow();
|
||||||
initMainMenuWindow();
|
WindowUtils.initMainMenuWindow();
|
||||||
initTooltipWindow();
|
WindowUtils.initTooltipWindow();
|
||||||
|
Globals.elementService.registerWindow(WindowStrings.TARGET_TOOLTIP, InteractionTargetMenu.createInteractionTargetTooltipWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,6 +225,9 @@ public class WindowUtils {
|
|||||||
WindowUtils.recursiveSetVisible(loadingWindow, true);
|
WindowUtils.recursiveSetVisible(loadingWindow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the main menu
|
||||||
|
*/
|
||||||
public static void initMainMenuWindow(){
|
public static void initMainMenuWindow(){
|
||||||
Window mainMenuWindow = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, false);
|
Window mainMenuWindow = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, false);
|
||||||
Globals.elementService.registerWindow(WindowStrings.WINDOW_MENU_MAIN, mainMenuWindow);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_MENU_MAIN, mainMenuWindow);
|
||||||
|
|||||||
@ -21,16 +21,6 @@ import electrosphere.renderer.ui.events.NavigationEvent;
|
|||||||
*/
|
*/
|
||||||
public class CraftingWindow {
|
public class CraftingWindow {
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimum width of the component
|
|
||||||
*/
|
|
||||||
public static final int MIN_WIDTH = 500;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimum height of the component
|
|
||||||
*/
|
|
||||||
public static final int MIN_HEIGHT = 500;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data for crafting with your hands
|
* The data for crafting with your hands
|
||||||
*/
|
*/
|
||||||
@ -41,11 +31,7 @@ public class CraftingWindow {
|
|||||||
* @return The panel component
|
* @return The panel component
|
||||||
*/
|
*/
|
||||||
public static Window createCraftingWindow(String data){
|
public static Window createCraftingWindow(String data){
|
||||||
int width = MIN_WIDTH;
|
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState());
|
||||||
int height = MIN_HEIGHT;
|
|
||||||
|
|
||||||
|
|
||||||
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState(), width, height);
|
|
||||||
rVal.setParentAlignItem(YogaAlignment.Center);
|
rVal.setParentAlignItem(YogaAlignment.Center);
|
||||||
rVal.setParentJustifyContent(YogaJustification.Center);
|
rVal.setParentJustifyContent(YogaJustification.Center);
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,64 @@
|
|||||||
|
package electrosphere.client.ui.menu.ingame;
|
||||||
|
|
||||||
|
import electrosphere.client.ui.menu.WindowStrings;
|
||||||
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.signal.Signal.SignalType;
|
||||||
|
import electrosphere.renderer.ui.elements.Label;
|
||||||
|
import electrosphere.renderer.ui.elements.Panel;
|
||||||
|
import electrosphere.renderer.ui.elements.Window;
|
||||||
|
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu for displaying a tooltip that shows the current interaction target
|
||||||
|
*/
|
||||||
|
public class InteractionTargetMenu {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Width of window
|
||||||
|
*/
|
||||||
|
static final int WINDOW_WIDTH = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Height of window
|
||||||
|
*/
|
||||||
|
static final int WINDOW_HEIGHT = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the main in game menu that shows up when you (typically) hit the escape key
|
||||||
|
* @return The window for the menu
|
||||||
|
*/
|
||||||
|
public static Window createInteractionTargetTooltipWindow(){
|
||||||
|
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState(), false);
|
||||||
|
rVal.setAlignItems(YogaAlignment.Center);
|
||||||
|
|
||||||
|
Label label = Label.createLabel("");
|
||||||
|
rVal.addChild(Panel.createPanel(label));
|
||||||
|
|
||||||
|
Globals.signalSystem.post(SignalType.YOGA_APPLY,rVal);
|
||||||
|
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the text for the interaction target tooltip
|
||||||
|
* @param text The text, pass an empty string to hide the tooltip
|
||||||
|
*/
|
||||||
|
public static void setInteractionTargetString(String text){
|
||||||
|
Window interactionTooltipWindow = (Window)Globals.elementService.getWindow(WindowStrings.TARGET_TOOLTIP);
|
||||||
|
Panel container = (Panel)interactionTooltipWindow.getChildren().get(0);
|
||||||
|
Label label = (Label)container.getChildren().get(0);
|
||||||
|
if(text.length() == 0){
|
||||||
|
if(label.getText().length() != 0){
|
||||||
|
label.setText("");
|
||||||
|
}
|
||||||
|
interactionTooltipWindow.setVisible(false);
|
||||||
|
} else {
|
||||||
|
interactionTooltipWindow.setVisible(true);
|
||||||
|
if(!label.getText().contains(text)){
|
||||||
|
label.setText(text);
|
||||||
|
Globals.signalSystem.post(SignalType.YOGA_APPLY, interactionTooltipWindow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -60,7 +60,7 @@ public class MenuGeneratorsInGame {
|
|||||||
* @return The window for the menu
|
* @return The window for the menu
|
||||||
*/
|
*/
|
||||||
public static Window createInGameMainMenu(){
|
public static Window createInGameMainMenu(){
|
||||||
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState(), WINDOW_WIDTH, WINDOW_HEIGHT);
|
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState());
|
||||||
|
|
||||||
Div div = Div.createDiv();
|
Div div = Div.createDiv();
|
||||||
rVal.addChild(div);
|
rVal.addChild(div);
|
||||||
@ -154,7 +154,7 @@ public class MenuGeneratorsInGame {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Window createInGameDebugMainMenu(){
|
public static Window createInGameDebugMainMenu(){
|
||||||
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState(), WINDOW_WIDTH, WINDOW_HEIGHT);
|
Window rVal = Window.createExpandableCenterAligned(Globals.renderingEngine.getOpenGLState());
|
||||||
|
|
||||||
VirtualScrollable scrollable = new VirtualScrollable(WINDOW_WIDTH, WINDOW_HEIGHT);
|
VirtualScrollable scrollable = new VirtualScrollable(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||||
rVal.addChild(scrollable);
|
rVal.addChild(scrollable);
|
||||||
|
|||||||
@ -491,7 +491,7 @@ public class RenderingEngine {
|
|||||||
|
|
||||||
//calculate render angle for frustum culling
|
//calculate render angle for frustum culling
|
||||||
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
|
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
|
||||||
updateFrustumBox();
|
this.updateFrustumBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
//generate depth map
|
//generate depth map
|
||||||
@ -506,7 +506,7 @@ public class RenderingEngine {
|
|||||||
|
|
||||||
//Update light buffer
|
//Update light buffer
|
||||||
lightManager.update(renderPipelineState,openGLState,Globals.playerCamera);
|
lightManager.update(renderPipelineState,openGLState,Globals.playerCamera);
|
||||||
checkError();
|
this.checkError();
|
||||||
|
|
||||||
|
|
||||||
//Render content to the game framebuffer
|
//Render content to the game framebuffer
|
||||||
@ -516,19 +516,19 @@ public class RenderingEngine {
|
|||||||
} else {
|
} else {
|
||||||
mainContentNoOITPipeline.render(openGLState, renderPipelineState);
|
mainContentNoOITPipeline.render(openGLState, renderPipelineState);
|
||||||
}
|
}
|
||||||
checkError();
|
this.checkError();
|
||||||
debugContentPipeline.render(openGLState, renderPipelineState);
|
debugContentPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
normalsForOutlinePipeline.render(openGLState, renderPipelineState);
|
normalsForOutlinePipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
firstPersonItemsPipeline.render(openGLState, renderPipelineState);
|
firstPersonItemsPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
outlineNormalsPipeline.render(openGLState, renderPipelineState);
|
outlineNormalsPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
compositePipeline.render(openGLState, renderPipelineState);
|
compositePipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
postProcessingPipeline.render(openGLState, renderPipelineState);
|
postProcessingPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,12 +537,12 @@ public class RenderingEngine {
|
|||||||
//Render the game framebuffer texture to a quad
|
//Render the game framebuffer texture to a quad
|
||||||
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER){
|
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER){
|
||||||
renderScreenPipeline.render(openGLState, renderPipelineState);
|
renderScreenPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
}
|
}
|
||||||
|
|
||||||
//render ui
|
//render ui
|
||||||
uiPipeline.render(openGLState, renderPipelineState);
|
uiPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
|
|
||||||
//Render boundaries of ui elements
|
//Render boundaries of ui elements
|
||||||
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
|
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
|
||||||
@ -553,7 +553,7 @@ public class RenderingEngine {
|
|||||||
* Render imgui
|
* Render imgui
|
||||||
*/
|
*/
|
||||||
imGuiPipeline.render(openGLState, renderPipelineState);
|
imGuiPipeline.render(openGLState, renderPipelineState);
|
||||||
checkError();
|
this.checkError();
|
||||||
|
|
||||||
|
|
||||||
//check for errors
|
//check for errors
|
||||||
@ -565,13 +565,13 @@ public class RenderingEngine {
|
|||||||
LoggerInterface.loggerRenderer.DEBUG_LOOP("GLFW Poll Events");
|
LoggerInterface.loggerRenderer.DEBUG_LOOP("GLFW Poll Events");
|
||||||
GLFW.glfwPollEvents();
|
GLFW.glfwPollEvents();
|
||||||
LoggerInterface.loggerRenderer.DEBUG_LOOP("Check OpenGL Errors");
|
LoggerInterface.loggerRenderer.DEBUG_LOOP("Check OpenGL Errors");
|
||||||
checkError();
|
this.checkError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the frustum box of the render pipeline
|
* Updates the frustum box of the render pipeline
|
||||||
*/
|
*/
|
||||||
void updateFrustumBox(){
|
private void updateFrustumBox(){
|
||||||
renderPipelineState.updateFrustumIntersection(Globals.projectionMatrix, Globals.viewMatrix);
|
renderPipelineState.updateFrustumIntersection(Globals.projectionMatrix, Globals.viewMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class Label extends StandardContainerElement implements DrawableElement {
|
|||||||
this.font = Globals.fontManager.getFont("default");
|
this.font = Globals.fontManager.getFont("default");
|
||||||
this.setHeight((int)(font.getFontHeight() * fontSize));
|
this.setHeight((int)(font.getFontHeight() * fontSize));
|
||||||
this.fontSize = fontSize;
|
this.fontSize = fontSize;
|
||||||
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
|
this.setFlexDirection(YogaFlexDirection.Row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -37,7 +37,6 @@ public class Panel extends StandardContainerElement implements DrawableElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a label element
|
* Creates a label element
|
||||||
* @param text the text for the label
|
|
||||||
* @return the label element
|
* @return the label element
|
||||||
*/
|
*/
|
||||||
public static Panel createPanel(){
|
public static Panel createPanel(){
|
||||||
@ -49,6 +48,23 @@ public class Panel extends StandardContainerElement implements DrawableElement {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a label element
|
||||||
|
* @param children The child elements
|
||||||
|
* @return the label element
|
||||||
|
*/
|
||||||
|
public static Panel createPanel(Element ... children){
|
||||||
|
Panel rVal = new Panel();
|
||||||
|
rVal.setPaddingTop(DEFAULT_PADDING);
|
||||||
|
rVal.setPaddingRight(DEFAULT_PADDING);
|
||||||
|
rVal.setPaddingLeft(DEFAULT_PADDING);
|
||||||
|
rVal.setPaddingBottom(DEFAULT_PADDING);
|
||||||
|
for(Element child : children){
|
||||||
|
rVal.addChild(child);
|
||||||
|
}
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -49,6 +49,13 @@ public class StandardContainerElement extends StandardElement implements Contain
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChild(Element child) {
|
public void addChild(Element child) {
|
||||||
|
if(child.getParent() != null){
|
||||||
|
String message = "Tried adding a child to a that already has a parent!\n" +
|
||||||
|
"this: " + this + "\n" +
|
||||||
|
"child: " + child + "\n" +
|
||||||
|
"child parent: " + child.getParent() + "\n";
|
||||||
|
throw new Error(message);
|
||||||
|
}
|
||||||
childList.add(child);
|
childList.add(child);
|
||||||
child.setParent(this);
|
child.setParent(this);
|
||||||
if(child instanceof DrawableElement){
|
if(child instanceof DrawableElement){
|
||||||
|
|||||||
@ -61,6 +61,28 @@ public class Tooltip extends StandardDrawableContainerElement {
|
|||||||
return tooltip;
|
return tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a tooltip
|
||||||
|
* @param children The children of the tooltip
|
||||||
|
* @return The tooltip
|
||||||
|
*/
|
||||||
|
public static Tooltip create(Element ... children){
|
||||||
|
Tooltip tooltip = new Tooltip();
|
||||||
|
tooltip.setAbsolutePosition(true);
|
||||||
|
tooltip.setPositionX(0);
|
||||||
|
tooltip.setPositionY(0);
|
||||||
|
for(Element child : children){
|
||||||
|
tooltip.addChild(child);
|
||||||
|
}
|
||||||
|
Element windowElement = Globals.elementService.getWindow(WindowStrings.TOOLTIP_WINDOW);
|
||||||
|
if(windowElement instanceof Window){
|
||||||
|
Window windowView = (Window)windowElement;
|
||||||
|
windowView.addChild(tooltip);
|
||||||
|
Globals.signalSystem.post(SignalType.YOGA_APPLY,windowView);
|
||||||
|
}
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(
|
public void draw(
|
||||||
|
|||||||
@ -121,9 +121,9 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
//yoga node for placement
|
//yoga node for placement
|
||||||
this.parentWindowYogaNode = Yoga.YGNodeNew();
|
this.parentWindowYogaNode = Yoga.YGNodeNew();
|
||||||
Yoga.YGNodeInsertChild(this.parentWindowYogaNode, this.yogaNode, 0);
|
Yoga.YGNodeInsertChild(this.parentWindowYogaNode, this.yogaNode, 0);
|
||||||
setParentAlignContent(YogaAlignment.Start);
|
this.setParentAlignContent(YogaAlignment.Start);
|
||||||
setParentAlignItem(YogaAlignment.Start);
|
this.setParentAlignItem(YogaAlignment.Start);
|
||||||
setParentJustifyContent(YogaJustification.Start);
|
this.setParentJustifyContent(YogaJustification.Start);
|
||||||
this.setFlexDirection(YogaFlexDirection.Column);
|
this.setFlexDirection(YogaFlexDirection.Column);
|
||||||
this.setWidth(width);
|
this.setWidth(width);
|
||||||
this.setHeight(height);
|
this.setHeight(height);
|
||||||
@ -146,9 +146,9 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
//yoga node for placement
|
//yoga node for placement
|
||||||
this.parentWindowYogaNode = Yoga.YGNodeNew();
|
this.parentWindowYogaNode = Yoga.YGNodeNew();
|
||||||
Yoga.YGNodeInsertChild(this.parentWindowYogaNode, this.yogaNode, 0);
|
Yoga.YGNodeInsertChild(this.parentWindowYogaNode, this.yogaNode, 0);
|
||||||
setParentAlignContent(YogaAlignment.Start);
|
this.setParentAlignContent(YogaAlignment.Start);
|
||||||
setParentAlignItem(YogaAlignment.Start);
|
this.setParentAlignItem(YogaAlignment.Start);
|
||||||
setParentJustifyContent(YogaJustification.Start);
|
this.setParentJustifyContent(YogaJustification.Start);
|
||||||
this.setFlexDirection(YogaFlexDirection.Column);
|
this.setFlexDirection(YogaFlexDirection.Column);
|
||||||
this.setMinWidth(DEFAULT_POPUP_WIDTH);
|
this.setMinWidth(DEFAULT_POPUP_WIDTH);
|
||||||
this.setMinHeight(DEFAULT_POPUP_HEIGHT);
|
this.setMinHeight(DEFAULT_POPUP_HEIGHT);
|
||||||
@ -172,13 +172,9 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
/**
|
/**
|
||||||
* Creates an expandable window
|
* Creates an expandable window
|
||||||
* @param openGLState The opengl state
|
* @param openGLState The opengl state
|
||||||
* @param posX The x position of the window
|
|
||||||
* @param posY The y position of the window
|
|
||||||
* @param width The width of the window
|
|
||||||
* @param height The height of the window
|
|
||||||
* @return The window element
|
* @return The window element
|
||||||
*/
|
*/
|
||||||
public static Window createExpandable(OpenGLState openGLState, int posX, int posY, int width, int height){
|
public static Window createExpandable(OpenGLState openGLState){
|
||||||
Window rVal = new Window(openGLState);
|
Window rVal = new Window(openGLState);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -186,19 +182,29 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
/**
|
/**
|
||||||
* Creates an expandable window
|
* Creates an expandable window
|
||||||
* @param openGLState The opengl state
|
* @param openGLState The opengl state
|
||||||
* @param posX The x position of the window
|
|
||||||
* @param posY The y position of the window
|
|
||||||
* @param width The width of the window
|
|
||||||
* @param height The height of the window
|
|
||||||
* @return The window element
|
* @return The window element
|
||||||
*/
|
*/
|
||||||
public static Window createExpandableCenterAligned(OpenGLState openGLState, int width, int height){
|
public static Window createExpandableCenterAligned(OpenGLState openGLState){
|
||||||
Window rVal = new Window(openGLState);
|
Window rVal = new Window(openGLState);
|
||||||
rVal.setParentAlignItem(YogaAlignment.Center);
|
rVal.setParentAlignItem(YogaAlignment.Center);
|
||||||
rVal.setParentJustifyContent(YogaJustification.Center);
|
rVal.setParentJustifyContent(YogaJustification.Center);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an expandable window
|
||||||
|
* @param openGLState The opengl state
|
||||||
|
* @param showDecorations true to show decorations for window, false to not draw them
|
||||||
|
* @return The window element
|
||||||
|
*/
|
||||||
|
public static Window createExpandableCenterAligned(OpenGLState openGLState, boolean showDecorations){
|
||||||
|
Window rVal = new Window(openGLState);
|
||||||
|
rVal.setParentAlignItem(YogaAlignment.Center);
|
||||||
|
rVal.setParentJustifyContent(YogaJustification.Center);
|
||||||
|
rVal.showDecorations = showDecorations;
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(
|
public void draw(
|
||||||
RenderPipelineState renderPipelineState,
|
RenderPipelineState renderPipelineState,
|
||||||
@ -241,20 +247,12 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
//render background of window
|
//render background of window
|
||||||
if(planeModel != null && windowFrame != null && showDecorations){
|
if(planeModel != null && windowFrame != null && this.showDecorations){
|
||||||
UIFrameUtils.drawFrame(
|
UIFrameUtils.drawFrame(
|
||||||
AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_3, color, 48, 12,
|
AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_3, color, 48, 12,
|
||||||
this.getAbsoluteX(), this.getAbsoluteY(), this.getWidth(), this.getHeight(),
|
this.getAbsoluteX(), this.getAbsoluteY(), this.getWidth(), this.getHeight(),
|
||||||
framebuffer, framebufferPosX, framebufferPosY
|
framebuffer, framebufferPosX, framebufferPosY
|
||||||
);
|
);
|
||||||
// planeModel.prawUI(ushUniformToMesh("plane", "mPosition", boxPosition);
|
|
||||||
// planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
|
||||||
// planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
|
||||||
// planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
|
||||||
// planeModel.pushUniformToMesh(planeModel.getMeshes().get(0).getMeshName(), "color", color);
|
|
||||||
// customMat.setTexturePointer(windowFrame.getTexturePointer());
|
|
||||||
// planeModel.getMeshes().get(0).setMaterial(customMat);
|
|
||||||
// planeModel.d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//render content of window
|
//render content of window
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user