ui work
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
e6a30cb09b
commit
47d60f46ee
@ -783,6 +783,8 @@ Remove legacy UI handling of positioning -- entirely reliant on yoga now
|
|||||||
|
|
||||||
(09/17/2024)
|
(09/17/2024)
|
||||||
Framebuffer position drilling
|
Framebuffer position drilling
|
||||||
|
Redesign inventory menu
|
||||||
|
Remove deprecated ui constructors
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -10,14 +10,13 @@ import electrosphere.entity.scene.SceneGenerator;
|
|||||||
import electrosphere.menu.mainmenu.MenuGeneratorsKeybind;
|
import electrosphere.menu.mainmenu.MenuGeneratorsKeybind;
|
||||||
import electrosphere.menu.mainmenu.MenuGeneratorsTitleMenu;
|
import electrosphere.menu.mainmenu.MenuGeneratorsTitleMenu;
|
||||||
import electrosphere.net.NetUtils;
|
import electrosphere.net.NetUtils;
|
||||||
|
import electrosphere.renderer.ui.components.InputMacros;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
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.TextInput;
|
import electrosphere.renderer.ui.elements.TextInput;
|
||||||
import electrosphere.renderer.ui.elementtypes.ClickableElement;
|
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
import electrosphere.renderer.ui.elementtypes.Element;
|
||||||
import electrosphere.renderer.ui.events.ClickEvent;
|
|
||||||
import electrosphere.server.saves.SaveUtils;
|
import electrosphere.server.saves.SaveUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,19 +32,12 @@ public class MenuGenerators {
|
|||||||
|
|
||||||
public static Element createWorldSelectMenu(){
|
public static Element createWorldSelectMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
|
||||||
List<String> saveNames = SaveUtils.getSaves();
|
List<String> saveNames = SaveUtils.getSaves();
|
||||||
int verticalPosition = 125;
|
|
||||||
for(String saveName : saveNames){
|
for(String saveName : saveNames){
|
||||||
if(!saveName.startsWith(".")){
|
if(!saveName.startsWith(".")){
|
||||||
|
|
||||||
//button (select save)
|
//button (select save)
|
||||||
Button selectButton = new Button();
|
rVal.addChild(Button.createButton(saveName.toUpperCase(), () -> {
|
||||||
Label selectLabel = new Label(1.0f);
|
|
||||||
selectLabel.setText(saveName.toUpperCase());
|
|
||||||
selectButton.addChild(selectLabel);
|
|
||||||
rVal.addChild(selectButton);
|
|
||||||
selectButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
if(SaveUtils.saveHasWorldFile(saveName.toLowerCase())){
|
if(SaveUtils.saveHasWorldFile(saveName.toLowerCase())){
|
||||||
//need to log client in
|
//need to log client in
|
||||||
Globals.clientUsername = "username";
|
Globals.clientUsername = "username";
|
||||||
@ -60,50 +52,35 @@ public class MenuGenerators {
|
|||||||
SaveUtils.loadSave(saveName.toLowerCase(), false);
|
SaveUtils.loadSave(saveName.toLowerCase(), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
||||||
}
|
}
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
verticalPosition = verticalPosition + 75;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Button createButton = new Button();
|
rVal.addChild(Button.createButton("Create World", () -> {
|
||||||
Label createLabel = new Label(1.0f);
|
|
||||||
createLabel.setText("Create World");
|
|
||||||
createButton.addChild(createLabel);
|
|
||||||
rVal.addChild(createButton);
|
|
||||||
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldCreationMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldCreationMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Element createWorldCreationMenu(){
|
public static Element createWorldCreationMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
int screenTop = 150;
|
|
||||||
|
|
||||||
//TODO: add text input to name world
|
|
||||||
//text entry (address)
|
//text entry (address)
|
||||||
TextInput worldNameInput = new TextInput(100,screenTop + 125,1.0f);
|
TextInput worldNameInput = TextInput.createTextInput();
|
||||||
|
worldNameInput.setMinWidth(100);
|
||||||
worldNameInput.setText("World name");
|
worldNameInput.setText("World name");
|
||||||
rVal.addChild(worldNameInput);
|
rVal.addChild(worldNameInput);
|
||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Button createButton = new Button();
|
rVal.addChild(Button.createButton("Create", () -> {
|
||||||
Label createLabel = new Label(1.0f);
|
|
||||||
createLabel.setText("Create");
|
|
||||||
createButton.addChild(createLabel);
|
|
||||||
rVal.addChild(createButton);
|
|
||||||
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
String saveName = worldNameInput.getText();
|
String saveName = worldNameInput.getText();
|
||||||
//create save dir
|
//create save dir
|
||||||
SaveUtils.createOrOverwriteSave(saveName, SceneGenerator.createProceduralSceneFile(saveName));
|
SaveUtils.createOrOverwriteSave(saveName, SceneGenerator.createProceduralSceneFile(saveName));
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -112,28 +89,15 @@ public class MenuGenerators {
|
|||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
//button (save)
|
//button (save)
|
||||||
Button saveButton = new Button();
|
rVal.addChild(Button.createButton("Save", () -> {
|
||||||
Label saveLabel = new Label(1.0f);
|
|
||||||
saveLabel.setText("Save");
|
|
||||||
saveButton.addChild(saveLabel);
|
|
||||||
rVal.addChild(saveButton);
|
|
||||||
saveButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
// SaveUtils.saveWorldData(Globals.currentSave.getName());
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
||||||
throw new UnsupportedOperationException("Need to update to use new save flow");
|
throw new UnsupportedOperationException("Need to update to use new save flow");
|
||||||
// return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
//button (cancel)
|
//button (cancel)
|
||||||
Button cancelButton = new Button();
|
rVal.addChild(Button.createButton("Cancel", () -> {
|
||||||
Label cancelLabel = new Label(1.0f);
|
|
||||||
cancelLabel.setText("Cancel");
|
|
||||||
cancelButton.addChild(cancelLabel);
|
|
||||||
rVal.addChild(cancelButton);
|
|
||||||
saveButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -144,11 +108,9 @@ public class MenuGenerators {
|
|||||||
//TODO: add text input to name world
|
//TODO: add text input to name world
|
||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Button createButton = new Button();
|
rVal.addChild(Button.createButton("Create World", () -> {
|
||||||
Label createLabel = new Label(1.0f);
|
throw new UnsupportedOperationException("Unimplemented");
|
||||||
createLabel.setText("Create World");
|
}));
|
||||||
createButton.addChild(createLabel);
|
|
||||||
rVal.addChild(createButton);
|
|
||||||
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
@ -160,11 +122,9 @@ public class MenuGenerators {
|
|||||||
//TODO: add text input to name world
|
//TODO: add text input to name world
|
||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Button createButton = new Button();
|
rVal.addChild(Button.createButton("Create World", () -> {
|
||||||
Label createLabel = new Label(1.0f);
|
throw new UnsupportedOperationException("Unimplemented");
|
||||||
createLabel.setText("Create World");
|
}));
|
||||||
createButton.addChild(createLabel);
|
|
||||||
rVal.addChild(createButton);
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -173,114 +133,87 @@ public class MenuGenerators {
|
|||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
//button (host)
|
//button (host)
|
||||||
Button hostButton = new Button();
|
rVal.addChild(Button.createButton("Host", () -> {
|
||||||
Label hostLabel = new Label(1.0f);
|
|
||||||
hostLabel.setText("Host");
|
|
||||||
hostButton.addChild(hostLabel);
|
|
||||||
rVal.addChild(hostButton);
|
|
||||||
hostButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
LoadingThread clientThread = new LoadingThread(LoadingThreadType.CHARACTER_SERVER);
|
LoadingThread clientThread = new LoadingThread(LoadingThreadType.CHARACTER_SERVER);
|
||||||
LoadingThread serverThread = new LoadingThread(LoadingThreadType.MAIN_GAME);
|
LoadingThread serverThread = new LoadingThread(LoadingThreadType.MAIN_GAME);
|
||||||
Globals.RUN_CLIENT = true;
|
Globals.RUN_CLIENT = true;
|
||||||
Globals.RUN_SERVER = true;
|
Globals.RUN_SERVER = true;
|
||||||
Globals.threadManager.start(serverThread);
|
Globals.threadManager.start(serverThread);
|
||||||
Globals.threadManager.start(clientThread);
|
Globals.threadManager.start(clientThread);
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
//button (join)
|
//button (join)
|
||||||
Button joinButton = new Button();
|
rVal.addChild(Button.createButton("Join", () -> {
|
||||||
Label joinLabel = new Label(1.0f);
|
|
||||||
joinLabel.setText("Join");
|
|
||||||
joinButton.addChild(joinLabel);
|
|
||||||
rVal.addChild(joinButton);
|
|
||||||
joinButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createIPMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createIPMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
|
|
||||||
//button (back)
|
//button (back)
|
||||||
Button connectButton = new Button();
|
rVal.addChild(Button.createButton("Back", () -> {
|
||||||
Label connectLabel = new Label(1.0f);
|
|
||||||
connectLabel.setText("Back");
|
|
||||||
connectButton.addChild(connectLabel);
|
|
||||||
rVal.addChild(connectButton);
|
|
||||||
connectButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Element createIPMenu(){
|
public static Element createIPMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
int screenTop = 150;
|
|
||||||
|
|
||||||
//label (address)
|
//
|
||||||
Label addressLabel = new Label(1.0f);
|
//Address input
|
||||||
addressLabel.setText("IP Address");
|
//
|
||||||
rVal.addChild(addressLabel);
|
String ipAddress = "";
|
||||||
|
|
||||||
//text entry (address)
|
|
||||||
TextInput addressInput = new TextInput(100,screenTop + 125,1.0f);
|
|
||||||
if(Globals.netConfig != null && Globals.netConfig.getAddress() != null){
|
if(Globals.netConfig != null && Globals.netConfig.getAddress() != null){
|
||||||
addressInput.setText(Globals.netConfig.getAddress());
|
ipAddress = Globals.netConfig.getAddress();
|
||||||
} else {
|
} else {
|
||||||
addressInput.setText(NetUtils.getAddress());
|
ipAddress = NetUtils.getAddress();
|
||||||
}
|
}
|
||||||
rVal.addChild(addressInput);
|
Div addressControl = InputMacros.createTextInputVertical("IP Address", ipAddress);
|
||||||
|
TextInput addressInput = (TextInput)addressControl.getChildren().get(1);
|
||||||
|
rVal.addChild(addressControl);
|
||||||
|
|
||||||
//label (port)
|
//
|
||||||
Label portLabel = new Label(1.0f);
|
//Port input
|
||||||
portLabel.setText("Port");
|
//
|
||||||
rVal.addChild(portLabel);
|
String port = "";
|
||||||
|
|
||||||
//text entry (port)
|
|
||||||
TextInput portInput = new TextInput(100,screenTop + 275,1.0f);
|
|
||||||
if(Globals.netConfig != null && Globals.netConfig.getPort() != null){
|
if(Globals.netConfig != null && Globals.netConfig.getPort() != null){
|
||||||
portInput.setText(Globals.netConfig.getPort());
|
port = Globals.netConfig.getPort();
|
||||||
} else {
|
} else {
|
||||||
portInput.setText(NetUtils.getPort() + "");
|
port = NetUtils.getPort() + "";
|
||||||
}
|
}
|
||||||
rVal.addChild(portInput);
|
Div portControl = InputMacros.createTextInputVertical("Port", port);
|
||||||
|
TextInput portInput = (TextInput)portControl.getChildren().get(1);
|
||||||
|
rVal.addChild(portControl);
|
||||||
|
|
||||||
//label (address)
|
//
|
||||||
Label usernameLabel = new Label(1.0f);
|
//Username input
|
||||||
usernameLabel.setText("Username");
|
//
|
||||||
rVal.addChild(usernameLabel);
|
String username = "";
|
||||||
|
if(Globals.netConfig != null && Globals.netConfig.getPort() != null){
|
||||||
//text entry (address)
|
username = Globals.netConfig.getUsername();
|
||||||
TextInput usernameInput = new TextInput(100,screenTop + 425,1.0f);
|
|
||||||
if(Globals.netConfig != null && Globals.netConfig.getUsername() != null){
|
|
||||||
usernameInput.setText(Globals.netConfig.getUsername());
|
|
||||||
} else {
|
} else {
|
||||||
usernameInput.setText("");
|
username = "";
|
||||||
}
|
}
|
||||||
rVal.addChild(usernameInput);
|
Div usernameControl = InputMacros.createTextInputVertical("Username", username);
|
||||||
|
TextInput usernameInput = (TextInput)usernameControl.getChildren().get(1);
|
||||||
|
rVal.addChild(usernameControl);
|
||||||
|
|
||||||
//label (port)
|
|
||||||
Label passwordLabel = new Label(1.0f);
|
|
||||||
passwordLabel.setText("Password");
|
|
||||||
rVal.addChild(passwordLabel);
|
|
||||||
|
|
||||||
//text entry (port)
|
//
|
||||||
TextInput passwordInput = new TextInput(100,screenTop + 575,1.0f);
|
//Password input
|
||||||
if(Globals.netConfig != null && Globals.netConfig.getUsername() != null){
|
//
|
||||||
passwordInput.setText(Globals.netConfig.getPassword());
|
String password = "";
|
||||||
|
if(Globals.netConfig != null && Globals.netConfig.getPort() != null){
|
||||||
|
password = Globals.netConfig.getPassword();
|
||||||
} else {
|
} else {
|
||||||
passwordInput.setText("");
|
password = "";
|
||||||
}
|
}
|
||||||
rVal.addChild(passwordInput);
|
Div passwordControl = InputMacros.createTextInputVertical("Password", password);
|
||||||
|
TextInput passwordInput = (TextInput)passwordControl.getChildren().get(1);
|
||||||
|
rVal.addChild(passwordControl);
|
||||||
|
|
||||||
//button (connect)
|
//button (connect)
|
||||||
Button connectButton = new Button();
|
rVal.addChild(Button.createButton("Connect", () -> {
|
||||||
Label connectLabel = new Label(1.0f);
|
|
||||||
connectLabel.setText("Connect");
|
|
||||||
connectButton.addChild(connectLabel);
|
|
||||||
rVal.addChild(connectButton);
|
|
||||||
connectButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
NetUtils.setAddress(addressInput.getText());
|
NetUtils.setAddress(addressInput.getText());
|
||||||
NetUtils.setPort(Integer.parseInt(portInput.getText()));
|
NetUtils.setPort(Integer.parseInt(portInput.getText()));
|
||||||
Globals.clientUsername = usernameInput.getText();
|
Globals.clientUsername = usernameInput.getText();
|
||||||
@ -289,19 +222,12 @@ public class MenuGenerators {
|
|||||||
Globals.RUN_CLIENT = true;
|
Globals.RUN_CLIENT = true;
|
||||||
Globals.RUN_SERVER = false;
|
Globals.RUN_SERVER = false;
|
||||||
Globals.threadManager.start(clientThread);
|
Globals.threadManager.start(clientThread);
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
//button (back)
|
//button (back)
|
||||||
Button backButton = new Button();
|
rVal.addChild(Button.createButton("Back", () -> {
|
||||||
Label backLabel = new Label(1.0f);
|
|
||||||
backLabel.setText("Back");
|
|
||||||
backButton.addChild(backLabel);
|
|
||||||
rVal.addChild(backButton);
|
|
||||||
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createMultiplayerMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createMultiplayerMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -310,20 +236,13 @@ public class MenuGenerators {
|
|||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
//label (options)
|
//label (options)
|
||||||
Label optionsLabel = new Label(1.0f);
|
Label optionsLabel = Label.createLabel("Options");
|
||||||
optionsLabel.setText("Options");
|
|
||||||
rVal.addChild(optionsLabel);
|
rVal.addChild(optionsLabel);
|
||||||
|
|
||||||
//button (back)
|
//button (back)
|
||||||
Button backButton = new Button();
|
rVal.addChild(Button.createButton("Back", () -> {
|
||||||
Label backLabel = new Label(1.0f);
|
|
||||||
backLabel.setText("Back");
|
|
||||||
backButton.addChild(backLabel);
|
|
||||||
rVal.addChild(backButton);
|
|
||||||
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
//button to open rebind controls window
|
//button to open rebind controls window
|
||||||
Button rebindControlsButton = Button.createButton("Controls", () -> {
|
Button rebindControlsButton = Button.createButton("Controls", () -> {
|
||||||
|
|||||||
@ -182,9 +182,8 @@ public class WindowUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void initLoadingWindow(){
|
static void initLoadingWindow(){
|
||||||
Window loadingWindow = new Window(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT,false);
|
Window loadingWindow = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, false);
|
||||||
Label loadingLabel = new Label(1.0f);
|
Label loadingLabel = Label.createLabel("LOADING");
|
||||||
loadingLabel.setText("LOADING");
|
|
||||||
loadingWindow.addChild(loadingLabel);
|
loadingWindow.addChild(loadingLabel);
|
||||||
Globals.signalSystem.post(SignalType.YOGA_APPLY,loadingWindow);
|
Globals.signalSystem.post(SignalType.YOGA_APPLY,loadingWindow);
|
||||||
Globals.elementService.registerWindow(WindowStrings.WINDOW_LOADING, loadingWindow);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_LOADING, loadingWindow);
|
||||||
@ -192,7 +191,7 @@ public class WindowUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void initMainMenuWindow(){
|
public static void initMainMenuWindow(){
|
||||||
Window mainMenuWindow = new Window(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);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
||||||
}
|
}
|
||||||
@ -202,7 +201,7 @@ public class WindowUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void initItemDragContainerWindow(){
|
static void initItemDragContainerWindow(){
|
||||||
Window itemDragContainerWindow = new Window(Globals.renderingEngine.getOpenGLState(), 0,0,Globals.WINDOW_WIDTH,Globals.WINDOW_HEIGHT,false);
|
Window itemDragContainerWindow = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, false);
|
||||||
Globals.elementService.registerWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER, itemDragContainerWindow);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER, itemDragContainerWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class MenuGeneratorsInGame {
|
|||||||
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
||||||
int width = 500;
|
int width = 500;
|
||||||
int height = 500;
|
int height = 500;
|
||||||
Window rVal = new Window(Globals.renderingEngine.getOpenGLState(),0,0,width,height,true);
|
Window rVal = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, width, height, true);
|
||||||
// int screenLeft = (Globals.WINDOW_WIDTH - width)/2;
|
// int screenLeft = (Globals.WINDOW_WIDTH - width)/2;
|
||||||
Div div = Div.createDiv();
|
Div div = Div.createDiv();
|
||||||
rVal.addChild(div);
|
rVal.addChild(div);
|
||||||
@ -59,6 +59,7 @@ public class MenuGeneratorsInGame {
|
|||||||
} else {
|
} else {
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
|
||||||
}
|
}
|
||||||
|
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
|
||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ public class MenuGeneratorsInGame {
|
|||||||
} else {
|
} else {
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
|
||||||
}
|
}
|
||||||
|
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//Return to main menu
|
//Return to main menu
|
||||||
@ -109,14 +111,8 @@ public class MenuGeneratorsInGame {
|
|||||||
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
||||||
int width = 500;
|
int width = 500;
|
||||||
int height = 500;
|
int height = 500;
|
||||||
float fontSize = 1.0f;
|
Window rVal = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, width, height, true);
|
||||||
Window rVal = new Window(Globals.renderingEngine.getOpenGLState(),0,0,width,height,true);
|
|
||||||
// int screenLeft = (Globals.WINDOW_WIDTH - width)/2;
|
|
||||||
// Div div = new Div();
|
|
||||||
// div.setPositionX(0);
|
|
||||||
// div.setPositionY(0);
|
|
||||||
// div.setWidth(500);
|
|
||||||
// div.setHeight(500);
|
|
||||||
VirtualScrollable scrollable = new VirtualScrollable(width, height);
|
VirtualScrollable scrollable = new VirtualScrollable(width, height);
|
||||||
rVal.addChild(scrollable);
|
rVal.addChild(scrollable);
|
||||||
// scrollable.addChild(div);
|
// scrollable.addChild(div);
|
||||||
@ -125,17 +121,9 @@ public class MenuGeneratorsInGame {
|
|||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
//black texture background
|
|
||||||
// ImagePanel imagePanel = new ImagePanel(0,0,width,height + 1000,Globals.blackTexture);
|
|
||||||
// imagePanel.setWidth(width);
|
|
||||||
// imagePanel.setHeight(height);
|
|
||||||
// imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.blackTexture));
|
|
||||||
// scrollable.addChild(imagePanel);
|
|
||||||
|
|
||||||
//label 1 (back)
|
//label 1 (back)
|
||||||
Button backButton = new Button();
|
Button backButton = new Button();
|
||||||
Label backLabel = new Label(fontSize);
|
Label backLabel = Label.createLabel("Back");
|
||||||
backLabel.setText("Back");
|
|
||||||
backButton.addChild(backLabel);
|
backButton.addChild(backLabel);
|
||||||
scrollable.addChild(backButton);
|
scrollable.addChild(backButton);
|
||||||
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -145,14 +133,13 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
|
|
||||||
//text entry (port)
|
//text entry (port)
|
||||||
TextInput modelDebugInput = new TextInput(100,150,fontSize);
|
TextInput modelDebugInput = TextInput.createTextInput();
|
||||||
scrollable.addChild(modelDebugInput);
|
scrollable.addChild(modelDebugInput);
|
||||||
modelDebugInput.setText("Model path goes here");
|
modelDebugInput.setText("Model path goes here");
|
||||||
|
|
||||||
//label 3 (load model and debug)
|
//label 3 (load model and debug)
|
||||||
Button debugModelButton = new Button();
|
Button debugModelButton = new Button();
|
||||||
Label debugModelLabel = new Label(fontSize);
|
Label debugModelLabel = Label.createLabel("Print Model Debug Info");
|
||||||
debugModelLabel.setText("Print Model Debug Info");
|
|
||||||
debugModelButton.addChild(debugModelLabel);
|
debugModelButton.addChild(debugModelLabel);
|
||||||
scrollable.addChild(debugModelButton);
|
scrollable.addChild(debugModelButton);
|
||||||
debugModelButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
debugModelButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -172,8 +159,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label 4 (reload all shaders)
|
//label 4 (reload all shaders)
|
||||||
Button reloadShaderButton = new Button();
|
Button reloadShaderButton = new Button();
|
||||||
Label reloadShaderLabel = new Label(fontSize);
|
Label reloadShaderLabel = Label.createLabel("Reload all shaders");
|
||||||
reloadShaderLabel.setText("Reload all shaders");
|
|
||||||
reloadShaderButton.addChild(reloadShaderLabel);
|
reloadShaderButton.addChild(reloadShaderLabel);
|
||||||
scrollable.addChild(reloadShaderButton);
|
scrollable.addChild(reloadShaderButton);
|
||||||
reloadShaderButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
reloadShaderButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -184,8 +170,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//reload all models
|
//reload all models
|
||||||
Button reloadModelButton = new Button();
|
Button reloadModelButton = new Button();
|
||||||
Label reloadModelLabel = new Label(fontSize);
|
Label reloadModelLabel = Label.createLabel("Reload all models");
|
||||||
reloadModelLabel.setText("Reload all models");
|
|
||||||
reloadModelButton.addChild(reloadModelLabel);
|
reloadModelButton.addChild(reloadModelLabel);
|
||||||
scrollable.addChild(reloadModelButton);
|
scrollable.addChild(reloadModelButton);
|
||||||
reloadModelButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
reloadModelButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -196,8 +181,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//disable drawing player character
|
//disable drawing player character
|
||||||
Button toggleDrawPlayerButton = new Button();
|
Button toggleDrawPlayerButton = new Button();
|
||||||
Label toggleDrawPlayerLabel = new Label(fontSize);
|
Label toggleDrawPlayerLabel = Label.createLabel("Toggle draw character");
|
||||||
toggleDrawPlayerLabel.setText("Toggle draw character");
|
|
||||||
toggleDrawPlayerButton.addChild(toggleDrawPlayerLabel);
|
toggleDrawPlayerButton.addChild(toggleDrawPlayerLabel);
|
||||||
scrollable.addChild(toggleDrawPlayerButton);
|
scrollable.addChild(toggleDrawPlayerButton);
|
||||||
toggleDrawPlayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
toggleDrawPlayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -217,8 +201,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//pull up character editor
|
//pull up character editor
|
||||||
Button characterSliderMenuButton = new Button();
|
Button characterSliderMenuButton = new Button();
|
||||||
Label characterSliderMenuLabel = new Label(fontSize);
|
Label characterSliderMenuLabel = Label.createLabel("Character slider menu");
|
||||||
characterSliderMenuLabel.setText("Character slider menu");
|
|
||||||
characterSliderMenuButton.addChild(characterSliderMenuLabel);
|
characterSliderMenuButton.addChild(characterSliderMenuLabel);
|
||||||
scrollable.addChild(characterSliderMenuButton);
|
scrollable.addChild(characterSliderMenuButton);
|
||||||
characterSliderMenuButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
characterSliderMenuButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -228,8 +211,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label (switch framebuffer)
|
//label (switch framebuffer)
|
||||||
Button switchFramebufferButton = new Button();
|
Button switchFramebufferButton = new Button();
|
||||||
Label switchFramebufferLabel = new Label(fontSize);
|
Label switchFramebufferLabel = Label.createLabel("Switch Active Framebuffer");
|
||||||
switchFramebufferLabel.setText("Switch Active Framebuffer");
|
|
||||||
switchFramebufferButton.addChild(switchFramebufferLabel);
|
switchFramebufferButton.addChild(switchFramebufferLabel);
|
||||||
scrollable.addChild(switchFramebufferButton);
|
scrollable.addChild(switchFramebufferButton);
|
||||||
switchFramebufferButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
switchFramebufferButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -240,8 +222,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label (toggle draw client collision spheres)
|
//label (toggle draw client collision spheres)
|
||||||
Button toggleClientCollisionSpheresButton = new Button();
|
Button toggleClientCollisionSpheresButton = new Button();
|
||||||
Label toggleClientCollisionSpheresLabel = new Label(fontSize);
|
Label toggleClientCollisionSpheresLabel = Label.createLabel("Toggle draw client collision spheres");
|
||||||
toggleClientCollisionSpheresLabel.setText("Toggle draw client collision spheres");
|
|
||||||
toggleClientCollisionSpheresButton.addChild(toggleClientCollisionSpheresLabel);
|
toggleClientCollisionSpheresButton.addChild(toggleClientCollisionSpheresLabel);
|
||||||
scrollable.addChild(toggleClientCollisionSpheresButton);
|
scrollable.addChild(toggleClientCollisionSpheresButton);
|
||||||
toggleClientCollisionSpheresButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
toggleClientCollisionSpheresButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -252,8 +233,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label (toggle draw server collision spheres)
|
//label (toggle draw server collision spheres)
|
||||||
Button toggleServerCollisionSpheresButton = new Button();
|
Button toggleServerCollisionSpheresButton = new Button();
|
||||||
Label toggleServerCollisionSpheresLabel = new Label(fontSize);
|
Label toggleServerCollisionSpheresLabel = Label.createLabel("Toggle draw server collision spheres");
|
||||||
toggleServerCollisionSpheresLabel.setText("Toggle draw server collision spheres");
|
|
||||||
toggleServerCollisionSpheresButton.addChild(toggleServerCollisionSpheresLabel);
|
toggleServerCollisionSpheresButton.addChild(toggleServerCollisionSpheresLabel);
|
||||||
scrollable.addChild(toggleServerCollisionSpheresButton);
|
scrollable.addChild(toggleServerCollisionSpheresButton);
|
||||||
toggleServerCollisionSpheresButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
toggleServerCollisionSpheresButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -264,8 +244,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label (toggle draw physics objects)
|
//label (toggle draw physics objects)
|
||||||
Button togglePhysicsObjectsButton = new Button();
|
Button togglePhysicsObjectsButton = new Button();
|
||||||
Label togglePhysicsObjectsLabel = new Label(fontSize);
|
Label togglePhysicsObjectsLabel = Label.createLabel("Toggle draw physics objects");
|
||||||
togglePhysicsObjectsLabel.setText("Toggle draw physics objects");
|
|
||||||
togglePhysicsObjectsButton.addChild(togglePhysicsObjectsLabel);
|
togglePhysicsObjectsButton.addChild(togglePhysicsObjectsLabel);
|
||||||
scrollable.addChild(togglePhysicsObjectsButton);
|
scrollable.addChild(togglePhysicsObjectsButton);
|
||||||
togglePhysicsObjectsButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
togglePhysicsObjectsButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -276,8 +255,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label (toggle draw movement vectors)
|
//label (toggle draw movement vectors)
|
||||||
Button toggleMovementVectorsButton = new Button();
|
Button toggleMovementVectorsButton = new Button();
|
||||||
Label toggleMovementVectorsLabel = new Label(fontSize);
|
Label toggleMovementVectorsLabel = Label.createLabel("Toggle draw movement vectors");
|
||||||
toggleMovementVectorsLabel.setText("Toggle draw movement vectors");
|
|
||||||
toggleMovementVectorsButton.addChild(toggleMovementVectorsLabel);
|
toggleMovementVectorsButton.addChild(toggleMovementVectorsLabel);
|
||||||
scrollable.addChild(toggleMovementVectorsButton);
|
scrollable.addChild(toggleMovementVectorsButton);
|
||||||
toggleMovementVectorsButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
toggleMovementVectorsButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -288,8 +266,7 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//label (toggle draw navmesh)
|
//label (toggle draw navmesh)
|
||||||
Button toggleNavmeshButton = new Button();
|
Button toggleNavmeshButton = new Button();
|
||||||
Label toggleNavmeshLabel = new Label(fontSize);
|
Label toggleNavmeshLabel = Label.createLabel("Toggle draw navmesh");
|
||||||
toggleNavmeshLabel.setText("Toggle draw navmesh");
|
|
||||||
toggleNavmeshButton.addChild(toggleNavmeshLabel);
|
toggleNavmeshButton.addChild(toggleNavmeshLabel);
|
||||||
scrollable.addChild(toggleNavmeshButton);
|
scrollable.addChild(toggleNavmeshButton);
|
||||||
toggleNavmeshButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
toggleNavmeshButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -306,17 +283,9 @@ public class MenuGeneratorsInGame {
|
|||||||
public static Window createInGameCharacterSliderMenu(){
|
public static Window createInGameCharacterSliderMenu(){
|
||||||
int width = 500;
|
int width = 500;
|
||||||
int height = 500;
|
int height = 500;
|
||||||
float fontSize = 0.4f;
|
Window rVal = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, width, height, true);
|
||||||
Window rVal = new Window(Globals.renderingEngine.getOpenGLState(),0,0,width,height,true);
|
ScrollableContainer scrollable = ScrollableContainer.createScrollable();
|
||||||
// int screenLeft = (Globals.WINDOW_WIDTH - width)/2;
|
|
||||||
// Div div = new Div();
|
|
||||||
// div.setPositionX(0);
|
|
||||||
// div.setPositionY(0);
|
|
||||||
// div.setWidth(500);
|
|
||||||
// div.setHeight(500);
|
|
||||||
ScrollableContainer scrollable = new ScrollableContainer(Globals.renderingEngine.getOpenGLState(), 0, 0, width, height);
|
|
||||||
rVal.addChild(scrollable);
|
rVal.addChild(scrollable);
|
||||||
// scrollable.addChild(div);
|
|
||||||
rVal.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
rVal.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN, createInGameDebugMainMenu());
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN, createInGameDebugMainMenu());
|
||||||
return false;
|
return false;
|
||||||
@ -324,15 +293,11 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//black texture background
|
//black texture background
|
||||||
ImagePanel imagePanel = ImagePanel.createImagePanelAbsolute(0,0,width,height + 1000,Globals.blackTexture);
|
ImagePanel imagePanel = ImagePanel.createImagePanelAbsolute(0,0,width,height + 1000,Globals.blackTexture);
|
||||||
// imagePanel.setWidth(width);
|
|
||||||
// imagePanel.setHeight(height);
|
|
||||||
// imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.blackTexture));
|
|
||||||
scrollable.addChild(imagePanel);
|
scrollable.addChild(imagePanel);
|
||||||
|
|
||||||
//label 1 (back)
|
//label 1 (back)
|
||||||
Button backButton = new Button();
|
Button backButton = new Button();
|
||||||
Label backLabel = new Label(fontSize);
|
Label backLabel = Label.createLabel("Back");
|
||||||
backLabel.setText("Back");
|
|
||||||
backButton.addChild(backLabel);
|
backButton.addChild(backLabel);
|
||||||
scrollable.addChild(backButton);
|
scrollable.addChild(backButton);
|
||||||
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class MenuGeneratorsInventory {
|
|||||||
|
|
||||||
|
|
||||||
public static Element worldItemDropCaptureWindow(){
|
public static Element worldItemDropCaptureWindow(){
|
||||||
Window rVal = new Window(Globals.renderingEngine.getOpenGLState(),0,0,Globals.WINDOW_WIDTH,Globals.WINDOW_HEIGHT,true);
|
Window rVal = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, false);
|
||||||
Div div = Div.createDiv();
|
Div div = Div.createDiv();
|
||||||
div.setOnDragRelease(new DragEventCallback() {public boolean execute(DragEvent event){
|
div.setOnDragRelease(new DragEventCallback() {public boolean execute(DragEvent event){
|
||||||
LoggerInterface.loggerUI.INFO("World item drop capture window received drag release");
|
LoggerInterface.loggerUI.INFO("World item drop capture window received drag release");
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
*/
|
*/
|
||||||
public static Window createLevelEditorSidePanel(){
|
public static Window createLevelEditorSidePanel(){
|
||||||
//setup window
|
//setup window
|
||||||
mainSidePanel = new Window(Globals.renderingEngine.getOpenGLState(),0,0,SIDE_PANEL_WIDTH,Globals.WINDOW_HEIGHT,true);
|
mainSidePanel = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, SIDE_PANEL_WIDTH, Globals.WINDOW_HEIGHT, true);
|
||||||
mainSidePanel.setParentAlignContent(YogaAlignment.End);
|
mainSidePanel.setParentAlignContent(YogaAlignment.End);
|
||||||
mainSidePanel.setParentJustifyContent(YogaJustification.End);
|
mainSidePanel.setParentJustifyContent(YogaJustification.End);
|
||||||
mainSidePanel.setParentAlignItem(YogaAlignment.End);
|
mainSidePanel.setParentAlignItem(YogaAlignment.End);
|
||||||
@ -344,8 +344,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
div.addChild(deleteButton);
|
div.addChild(deleteButton);
|
||||||
|
|
||||||
|
|
||||||
Label entityName = new Label(1.0f);
|
Label entityName = Label.createLabel("(" + entity.getId() + ") " + getEntityString(entity));
|
||||||
entityName.setText("(" + entity.getId() + ") " + getEntityString(entity));
|
|
||||||
div.addChild(entityName);
|
div.addChild(entityName);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class MenuGeneratorsTerrainEditing {
|
|||||||
*/
|
*/
|
||||||
public static Window createVoxelTypeSelectionPanel(){
|
public static Window createVoxelTypeSelectionPanel(){
|
||||||
//setup window
|
//setup window
|
||||||
terrainEditingSidePanelWindow = new Window(Globals.renderingEngine.getOpenGLState(),0,0,WINDOW_WIDTH,WINDOW_HEIGHT,true);
|
terrainEditingSidePanelWindow = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, true);
|
||||||
terrainEditingSidePanelWindow.setParentAlignContent(YogaAlignment.Center);
|
terrainEditingSidePanelWindow.setParentAlignContent(YogaAlignment.Center);
|
||||||
terrainEditingSidePanelWindow.setParentJustifyContent(YogaJustification.Center);
|
terrainEditingSidePanelWindow.setParentJustifyContent(YogaJustification.Center);
|
||||||
terrainEditingSidePanelWindow.setParentAlignItem(YogaAlignment.Center);
|
terrainEditingSidePanelWindow.setParentAlignItem(YogaAlignment.Center);
|
||||||
@ -147,8 +147,7 @@ public class MenuGeneratorsTerrainEditing {
|
|||||||
newButton.setMarginRight(MARGIN_EACH_SIDE);
|
newButton.setMarginRight(MARGIN_EACH_SIDE);
|
||||||
newButton.setMarginTop(MARGIN_EACH_SIDE);
|
newButton.setMarginTop(MARGIN_EACH_SIDE);
|
||||||
//label
|
//label
|
||||||
Label voxelLabel = new Label(1.0f);
|
Label voxelLabel = Label.createLabel(type.getName());
|
||||||
voxelLabel.setText(type.getName());
|
|
||||||
//icon/model
|
//icon/model
|
||||||
ImagePanel texturePanel = ImagePanel.createImagePanel(type.getTexture());
|
ImagePanel texturePanel = ImagePanel.createImagePanel(type.getTexture());
|
||||||
if(type.getTexture() != null){
|
if(type.getTexture() != null){
|
||||||
|
|||||||
@ -24,8 +24,7 @@ public class MenuGeneratorsDemo {
|
|||||||
rVal.setAlignContent(YogaAlignment.Start);
|
rVal.setAlignContent(YogaAlignment.Start);
|
||||||
|
|
||||||
//label (title)
|
//label (title)
|
||||||
Label titleLabel = new Label(1.0f);
|
Label titleLabel = Label.createLabel("ORPG");
|
||||||
titleLabel.setText("ORPG");
|
|
||||||
rVal.addChild(titleLabel);
|
rVal.addChild(titleLabel);
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import electrosphere.entity.scene.SceneFile;
|
|||||||
import electrosphere.game.data.voxel.VoxelType;
|
import electrosphere.game.data.voxel.VoxelType;
|
||||||
import electrosphere.menu.WindowUtils;
|
import electrosphere.menu.WindowUtils;
|
||||||
import electrosphere.menu.ingame.MenuGeneratorsTerrainEditing;
|
import electrosphere.menu.ingame.MenuGeneratorsTerrainEditing;
|
||||||
|
import electrosphere.renderer.ui.components.InputMacros;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
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;
|
||||||
@ -17,7 +18,6 @@ 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;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
import electrosphere.renderer.ui.macros.InputMacros;
|
|
||||||
import electrosphere.server.datacell.GriddedDataCellManager;
|
import electrosphere.server.datacell.GriddedDataCellManager;
|
||||||
import electrosphere.server.saves.SaveUtils;
|
import electrosphere.server.saves.SaveUtils;
|
||||||
|
|
||||||
|
|||||||
@ -1,38 +1,18 @@
|
|||||||
package electrosphere.menu.mainmenu;
|
package electrosphere.menu.mainmenu;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.joml.Vector3f;
|
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
|
||||||
import electrosphere.game.data.creature.type.visualattribute.AttributeVariant;
|
|
||||||
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
|
||||||
import electrosphere.menu.MenuGenerators;
|
import electrosphere.menu.MenuGenerators;
|
||||||
import electrosphere.menu.WindowUtils;
|
import electrosphere.menu.WindowUtils;
|
||||||
import electrosphere.net.parser.net.message.CharacterMessage;
|
import electrosphere.renderer.ui.components.CharacterCustomizer;
|
||||||
import electrosphere.renderer.actor.Actor;
|
|
||||||
import electrosphere.renderer.actor.ActorStaticMorph;
|
|
||||||
import electrosphere.renderer.actor.ActorUtils;
|
|
||||||
import electrosphere.renderer.anim.Animation;
|
|
||||||
import electrosphere.renderer.ui.elements.ActorPanel;
|
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
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.ScrollableContainer;
|
|
||||||
import electrosphere.renderer.ui.elements.Slider;
|
|
||||||
import electrosphere.renderer.ui.elements.StringCarousel;
|
import electrosphere.renderer.ui.elements.StringCarousel;
|
||||||
import electrosphere.renderer.ui.elementtypes.ClickableElement;
|
import electrosphere.renderer.ui.elementtypes.ClickableElement;
|
||||||
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaFlexDirection;
|
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
import electrosphere.renderer.ui.elementtypes.Element;
|
||||||
import electrosphere.renderer.ui.elementtypes.ValueElement.ValueChangeEventCallback;
|
import electrosphere.renderer.ui.elementtypes.ValueElement.ValueChangeEventCallback;
|
||||||
import electrosphere.renderer.ui.events.ClickEvent;
|
import electrosphere.renderer.ui.events.ClickEvent;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
import electrosphere.util.Utilities;
|
|
||||||
|
|
||||||
public class MenuGeneratorsMultiplayer {
|
public class MenuGeneratorsMultiplayer {
|
||||||
|
|
||||||
@ -41,8 +21,7 @@ public class MenuGeneratorsMultiplayer {
|
|||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Button createButton = new Button();
|
Button createButton = new Button();
|
||||||
Label createLabel = new Label(1.0f);
|
Label createLabel = Label.createLabel("Create Character");
|
||||||
createLabel.setText("Create Character");
|
|
||||||
createButton.addChild(createLabel);
|
createButton.addChild(createLabel);
|
||||||
rVal.addChild(createButton);
|
rVal.addChild(createButton);
|
||||||
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -69,164 +48,15 @@ public class MenuGeneratorsMultiplayer {
|
|||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Button createButton = new Button();
|
Button createButton = new Button();
|
||||||
Label createLabel = new Label(1.0f);
|
Label createLabel = Label.createLabel("Select Race");
|
||||||
createLabel.setText("Select Race");
|
|
||||||
createButton.addChild(createLabel);
|
createButton.addChild(createLabel);
|
||||||
rVal.addChild(createButton);
|
rVal.addChild(createButton);
|
||||||
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsMultiplayer.createMultiplayerCharacterCreationTweakWindow(selectedRace));
|
WindowUtils.replaceMainMenuContents(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace));
|
||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Element createMultiplayerCharacterCreationTweakWindow(String race){
|
|
||||||
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
|
||||||
int verticalPosition = 125;
|
|
||||||
int horizontalPosition = 300;
|
|
||||||
|
|
||||||
//figure out race data
|
|
||||||
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
|
||||||
|
|
||||||
//spawn camera so renderer doesn't crash (once render pipeline is modularized this shouldn't be necessary)
|
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3f(0,0,0), new Vector3f(0,0.3f,1).normalize());
|
|
||||||
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera);
|
|
||||||
// CameraEntityUtils.setCameraEye(Globals.playerCamera, new Vector3f(-1,3f,0).normalize());
|
|
||||||
// CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f(0,0,0));
|
|
||||||
|
|
||||||
//create actor panel
|
|
||||||
Actor characterActor = ActorUtils.createActorFromModelPath(selectedRaceType.getModelPath());
|
|
||||||
ActorPanel actorPanel = new ActorPanel(Globals.renderingEngine.getOpenGLState(), 1200, 100, 500, 500, characterActor);
|
|
||||||
actorPanel.setAnimation(Animation.ANIMATION_IDLE_1);
|
|
||||||
actorPanel.setPosition(new Vector3f(0,-0.5f,-0.6f));
|
|
||||||
// actorPanel.setRotation(new Quaternionf().rotateLocalY(0));
|
|
||||||
actorPanel.setScale(new Vector3f(1.0f));
|
|
||||||
|
|
||||||
//have to build static morph while looping through attributes
|
|
||||||
ActorStaticMorph staticMorph = new ActorStaticMorph();
|
|
||||||
|
|
||||||
//create creature template
|
|
||||||
CreatureTemplate template = CreatureTemplate.create(race);
|
|
||||||
|
|
||||||
List<Element> controlsToAdd = new LinkedList<Element>();
|
|
||||||
//create edit controls here
|
|
||||||
for(VisualAttribute attribute : selectedRaceType.getVisualAttributes()){
|
|
||||||
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
|
||||||
//add label for slider
|
|
||||||
Label sliderName = new Label(0.6f);
|
|
||||||
sliderName.setText(attribute.getAttributeId());
|
|
||||||
controlsToAdd.add(sliderName);
|
|
||||||
//add a slider
|
|
||||||
Slider boneSlider = new Slider(horizontalPosition, verticalPosition + 10, 500, 20, new Vector3f(0.1f,0.1f,0.1f), new Vector3f(1,1,1));
|
|
||||||
float min = attribute.getMinValue();
|
|
||||||
float max = attribute.getMaxValue();
|
|
||||||
float defaultValue = min + (max - min)/2.0f;
|
|
||||||
boneSlider.setMinimum(min);
|
|
||||||
boneSlider.setMaximum(max);
|
|
||||||
boneSlider.setValue(defaultValue);
|
|
||||||
controlsToAdd.add(boneSlider);
|
|
||||||
//actually add attributes to static morph
|
|
||||||
if(attribute.getPrimaryBone() != null && staticMorph.getBoneTransforms(attribute.getPrimaryBone()) == null){
|
|
||||||
staticMorph.initBoneTransforms(attribute.getPrimaryBone());
|
|
||||||
}
|
|
||||||
if(attribute.getMirrorBone() != null && staticMorph.getBoneTransforms(attribute.getMirrorBone()) == null){
|
|
||||||
staticMorph.initBoneTransforms(attribute.getMirrorBone());
|
|
||||||
}
|
|
||||||
//add attribute to creature template
|
|
||||||
template.putAttributeValue(attribute.getAttributeId(), defaultValue);
|
|
||||||
//set callback for when we change the slider value to update the static morph
|
|
||||||
boneSlider.setOnValueChangeCallback(new ValueChangeEventCallback() {public void execute(ValueChangeEvent event) {
|
|
||||||
if(characterActor.getStaticMorph() != null){
|
|
||||||
ActorStaticMorph staticMorph = characterActor.getStaticMorph();
|
|
||||||
staticMorph.updateValue(attribute.getSubtype(), attribute.getPrimaryBone(), event.getAsFloat());
|
|
||||||
if(attribute.getMirrorBone() != null){
|
|
||||||
staticMorph.updateValue(attribute.getSubtype(), attribute.getMirrorBone(), event.getAsFloat());
|
|
||||||
}
|
|
||||||
template.getAttributeValue(attribute.getAttributeId()).setValue(event.getAsFloat());
|
|
||||||
}
|
|
||||||
}});
|
|
||||||
} else if(attribute.getType().equals(VisualAttribute.TYPE_REMESH)){
|
|
||||||
//add label for carousel
|
|
||||||
Label sliderName = new Label(0.6f);
|
|
||||||
sliderName.setText(attribute.getAttributeId());
|
|
||||||
controlsToAdd.add(sliderName);
|
|
||||||
//for adding the value to the creature template
|
|
||||||
boolean hasAddedValue = false;
|
|
||||||
//add a carousel
|
|
||||||
StringCarousel variantCarousel = new StringCarousel(horizontalPosition, verticalPosition, 1.0f);
|
|
||||||
for(AttributeVariant variant : attribute.getVariants()){
|
|
||||||
variantCarousel.addOption(variant.getId());
|
|
||||||
//if we haven't already added a value, add a value to the creature template
|
|
||||||
if(!hasAddedValue){
|
|
||||||
hasAddedValue = true;
|
|
||||||
//add attribute to template
|
|
||||||
template.putAttributeValue(attribute.getAttributeId(), variant.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//callback for updating remesh
|
|
||||||
variantCarousel.setOnValueChangeCallback(new ValueChangeEventCallback(){public void execute(ValueChangeEvent event) {
|
|
||||||
//TODO: implement updating visuals
|
|
||||||
template.getAttributeValue(attribute.getAttributeId()).setVariantId(event.getAsString());
|
|
||||||
AttributeVariant variant = null;
|
|
||||||
for(AttributeVariant variantCurrent : attribute.getVariants()){
|
|
||||||
if(variantCurrent.getId().equals(event.getAsString())){
|
|
||||||
variant = variantCurrent;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(variant != null){
|
|
||||||
Globals.assetManager.addModelPathToQueue(variant.getModel());
|
|
||||||
for(String mesh : variant.getMeshes()){
|
|
||||||
characterActor.getMeshMask().queueMesh(variant.getModel(), mesh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}});
|
|
||||||
controlsToAdd.add(variantCarousel);
|
|
||||||
}
|
|
||||||
verticalPosition = verticalPosition + 100;
|
|
||||||
}
|
|
||||||
//finally set static morph
|
|
||||||
characterActor.setActorStaticMorph(staticMorph);
|
|
||||||
|
|
||||||
//add button to actually create the character
|
|
||||||
Button createCharacterButton = new Button();
|
|
||||||
Label createCharacterLabel = new Label(1.0f);
|
|
||||||
createCharacterLabel.setText("Create");
|
|
||||||
createCharacterButton.addChild(createCharacterLabel);
|
|
||||||
controlsToAdd.add(createCharacterButton);
|
|
||||||
createCharacterButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
|
||||||
return false;
|
|
||||||
}});
|
|
||||||
|
|
||||||
int width = 1800;
|
|
||||||
int height = verticalPosition + 300;
|
|
||||||
|
|
||||||
Div rVal = Div.createDiv();
|
|
||||||
rVal.setFlexDirection(YogaFlexDirection.Row);
|
|
||||||
|
|
||||||
ScrollableContainer scrollable = new ScrollableContainer(Globals.renderingEngine.getOpenGLState(), 0, 0, width, height);
|
|
||||||
for(Element newControl : controlsToAdd){
|
|
||||||
scrollable.addChild(newControl);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rVal.addChild(scrollable);
|
|
||||||
rVal.addChild(actorPanel);
|
|
||||||
// rVal.addChild(scrollable);
|
|
||||||
|
|
||||||
// Label testLabel = new Label(100,215,1.0f);
|
|
||||||
// testLabel.setText("Aaaaaaa");
|
|
||||||
// rVal.addChild(testLabel);
|
|
||||||
|
|
||||||
// //black texture background
|
|
||||||
// ImagePanel imagePanel = new ImagePanel(0,0,width,height + 1000,Globals.blackTexture);
|
|
||||||
// scrollable.addChild(imagePanel);
|
|
||||||
|
|
||||||
return rVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,14 +33,12 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
rVal.setFlexGrow(1.0f);
|
rVal.setFlexGrow(1.0f);
|
||||||
|
|
||||||
//label (title)
|
//label (title)
|
||||||
Label titleLabel = new Label(1.0f);
|
Label titleLabel = Label.createLabel("ORPG");
|
||||||
titleLabel.setText("ORPG");
|
|
||||||
rVal.addChild(titleLabel);
|
rVal.addChild(titleLabel);
|
||||||
|
|
||||||
//button (multiplayer)
|
//button (multiplayer)
|
||||||
Button singleplayerButton = new Button();
|
Button singleplayerButton = new Button();
|
||||||
Label singleplayerLabel = new Label(1.0f);
|
Label singleplayerLabel = Label.createLabel("Singleplayer");
|
||||||
singleplayerLabel.setText("Singleplayer");
|
|
||||||
singleplayerButton.addChild(singleplayerLabel);
|
singleplayerButton.addChild(singleplayerLabel);
|
||||||
rVal.addChild(singleplayerButton);
|
rVal.addChild(singleplayerButton);
|
||||||
singleplayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
singleplayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -50,8 +48,7 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
|
|
||||||
//button (multiplayer)
|
//button (multiplayer)
|
||||||
Button multiplayerButton = new Button();
|
Button multiplayerButton = new Button();
|
||||||
Label multiplayerLabel = new Label(1.0f);
|
Label multiplayerLabel = Label.createLabel("Multiplayer");
|
||||||
multiplayerLabel.setText("Multiplayer");
|
|
||||||
multiplayerButton.addChild(multiplayerLabel);
|
multiplayerButton.addChild(multiplayerLabel);
|
||||||
rVal.addChild(multiplayerButton);
|
rVal.addChild(multiplayerButton);
|
||||||
multiplayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
multiplayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -61,8 +58,7 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
|
|
||||||
//button (static level)
|
//button (static level)
|
||||||
Button staticLevelButton = new Button();
|
Button staticLevelButton = new Button();
|
||||||
Label staticLevelLabel = new Label(1.0f);
|
Label staticLevelLabel = Label.createLabel("Level Editor");
|
||||||
staticLevelLabel.setText("Level Editor");
|
|
||||||
staticLevelButton.addChild(staticLevelLabel);
|
staticLevelButton.addChild(staticLevelLabel);
|
||||||
rVal.addChild(staticLevelButton);
|
rVal.addChild(staticLevelButton);
|
||||||
staticLevelButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
staticLevelButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -72,8 +68,7 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
|
|
||||||
//button (options)
|
//button (options)
|
||||||
Button optionsButton = new Button();
|
Button optionsButton = new Button();
|
||||||
Label optionsLabel = new Label(1.0f);
|
Label optionsLabel = Label.createLabel("Options");
|
||||||
optionsLabel.setText("Options");
|
|
||||||
optionsButton.addChild(optionsLabel);
|
optionsButton.addChild(optionsLabel);
|
||||||
rVal.addChild(optionsButton);
|
rVal.addChild(optionsButton);
|
||||||
optionsButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
optionsButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -83,8 +78,7 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
|
|
||||||
//button (sp debug)
|
//button (sp debug)
|
||||||
Button uiDebugSPQuickstartButton = new Button();
|
Button uiDebugSPQuickstartButton = new Button();
|
||||||
Label uiDebugSPQuickstartLabel = new Label(1.0f);
|
Label uiDebugSPQuickstartLabel = Label.createLabel("Debug SP Quickstart");
|
||||||
uiDebugSPQuickstartLabel.setText("Debug SP Quickstart");
|
|
||||||
uiDebugSPQuickstartButton.addChild(uiDebugSPQuickstartLabel);
|
uiDebugSPQuickstartButton.addChild(uiDebugSPQuickstartLabel);
|
||||||
rVal.addChild(uiDebugSPQuickstartButton);
|
rVal.addChild(uiDebugSPQuickstartButton);
|
||||||
uiDebugSPQuickstartButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
uiDebugSPQuickstartButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -97,8 +91,7 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
|
|
||||||
//button (ui testing)
|
//button (ui testing)
|
||||||
Button uiTestingButton = new Button();
|
Button uiTestingButton = new Button();
|
||||||
Label uiTestingLabel = new Label(1.0f);
|
Label uiTestingLabel = Label.createLabel("UI Testing");
|
||||||
uiTestingLabel.setText("UI Testing");
|
|
||||||
uiTestingButton.addChild(uiTestingLabel);
|
uiTestingButton.addChild(uiTestingLabel);
|
||||||
rVal.addChild(uiTestingButton);
|
rVal.addChild(uiTestingButton);
|
||||||
uiTestingButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
uiTestingButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
@ -108,8 +101,7 @@ public class MenuGeneratorsTitleMenu {
|
|||||||
|
|
||||||
//button (Viewport Test)
|
//button (Viewport Test)
|
||||||
Button viewportTestingButton = new Button();
|
Button viewportTestingButton = new Button();
|
||||||
Label viewportTestingLabel = new Label(1.0f);
|
Label viewportTestingLabel = Label.createLabel("Viewport Test");
|
||||||
viewportTestingLabel.setText("Viewport Test");
|
|
||||||
viewportTestingButton.addChild(viewportTestingLabel);
|
viewportTestingButton.addChild(viewportTestingLabel);
|
||||||
rVal.addChild(viewportTestingButton);
|
rVal.addChild(viewportTestingButton);
|
||||||
viewportTestingButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
viewportTestingButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
|
|||||||
@ -19,18 +19,17 @@ import electrosphere.menu.WindowUtils;
|
|||||||
import electrosphere.renderer.actor.ActorUtils;
|
import electrosphere.renderer.actor.ActorUtils;
|
||||||
import electrosphere.renderer.ui.components.CharacterCustomizer;
|
import electrosphere.renderer.ui.components.CharacterCustomizer;
|
||||||
import electrosphere.renderer.ui.components.EquipmentInventoryPanel;
|
import electrosphere.renderer.ui.components.EquipmentInventoryPanel;
|
||||||
|
import electrosphere.renderer.ui.components.InputMacros;
|
||||||
import electrosphere.renderer.ui.components.NaturalInventoryPanel;
|
import electrosphere.renderer.ui.components.NaturalInventoryPanel;
|
||||||
import electrosphere.renderer.ui.elements.ActorPanel;
|
import electrosphere.renderer.ui.elements.ActorPanel;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
import electrosphere.renderer.ui.elements.FormElement;
|
import electrosphere.renderer.ui.elements.FormElement;
|
||||||
import electrosphere.renderer.ui.elements.Label;
|
|
||||||
import electrosphere.renderer.ui.elements.Slider;
|
import electrosphere.renderer.ui.elements.Slider;
|
||||||
import electrosphere.renderer.ui.elements.StringCarousel;
|
import electrosphere.renderer.ui.elements.StringCarousel;
|
||||||
import electrosphere.renderer.ui.elements.VirtualScrollable;
|
import electrosphere.renderer.ui.elements.VirtualScrollable;
|
||||||
import electrosphere.renderer.ui.elementtypes.ContainerElement;
|
import electrosphere.renderer.ui.elementtypes.ContainerElement;
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
import electrosphere.renderer.ui.elementtypes.Element;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
import electrosphere.renderer.ui.macros.InputMacros;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu generators for creating test visualizations for ui elements
|
* Menu generators for creating test visualizations for ui elements
|
||||||
@ -98,11 +97,7 @@ public class MenuGeneratorsUITesting {
|
|||||||
VirtualScrollable virtualScrollable = new VirtualScrollable(300, 75);
|
VirtualScrollable virtualScrollable = new VirtualScrollable(300, 75);
|
||||||
//add a ton of children
|
//add a ton of children
|
||||||
for(int i = 0; i < 10; i++){
|
for(int i = 0; i < 10; i++){
|
||||||
Button testButton = new Button();
|
virtualScrollable.addChild(Button.createButton("Test button " + i, () -> {}));
|
||||||
Label testLabel = new Label(1.0f);
|
|
||||||
testLabel.setText("Test button " + i);
|
|
||||||
testButton.addChild(testLabel);
|
|
||||||
virtualScrollable.addChild(testButton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// slider test
|
// slider test
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class TutorialMenus {
|
|||||||
windowEl = (Window)Globals.elementService.getWindow(WindowStrings.TUTORIAL_POPUP);
|
windowEl = (Window)Globals.elementService.getWindow(WindowStrings.TUTORIAL_POPUP);
|
||||||
} else {
|
} else {
|
||||||
//create the window
|
//create the window
|
||||||
windowEl = new Window(Globals.renderingEngine.getOpenGLState(),0,0,TUTORIAL_POPUP_WIDTH,TUTORIAL_POPUP_HEIGHT,true);
|
windowEl = Window.create(Globals.renderingEngine.getOpenGLState(), 0, 0, TUTORIAL_POPUP_WIDTH, TUTORIAL_POPUP_HEIGHT, true);
|
||||||
//parent container
|
//parent container
|
||||||
windowEl.setParentAlignContent(YogaAlignment.Center);
|
windowEl.setParentAlignContent(YogaAlignment.Center);
|
||||||
windowEl.setParentAlignItem(YogaAlignment.Center);
|
windowEl.setParentAlignItem(YogaAlignment.Center);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package electrosphere.renderer.ui.macros;
|
package electrosphere.renderer.ui.components;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@ -28,7 +28,6 @@ public class InputMacros {
|
|||||||
* @param placeholder The placeholder (can be null if no placeholder desired)
|
* @param placeholder The placeholder (can be null if no placeholder desired)
|
||||||
* @return The div encapsulating all the individual elements
|
* @return The div encapsulating all the individual elements
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static Div createTextInput(String label, String placeholder){
|
public static Div createTextInput(String label, String placeholder){
|
||||||
Div rVal = Div.createDiv();
|
Div rVal = Div.createDiv();
|
||||||
rVal.setFlexDirection(YogaFlexDirection.Row);
|
rVal.setFlexDirection(YogaFlexDirection.Row);
|
||||||
@ -48,6 +47,30 @@ 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 createTextInputVertical(String label, String placeholder){
|
||||||
|
Div rVal = Div.createCol();
|
||||||
|
|
||||||
|
//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
|
||||||
@ -55,7 +78,6 @@ public class InputMacros {
|
|||||||
* @param callback A callback fired when the text input changes value
|
* @param callback A callback fired when the text input changes value
|
||||||
* @return The div encapsulating all the individual elements
|
* @return The div encapsulating all the individual elements
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static Div createTextInput(String label, String placeholder, Consumer<ValueChangeEvent> callback){
|
public static Div createTextInput(String label, String placeholder, Consumer<ValueChangeEvent> callback){
|
||||||
Div rVal = Div.createDiv();
|
Div rVal = Div.createDiv();
|
||||||
rVal.setFlexDirection(YogaFlexDirection.Row);
|
rVal.setFlexDirection(YogaFlexDirection.Row);
|
||||||
@ -84,7 +106,6 @@ public class InputMacros {
|
|||||||
* @param defaultValue The default value for the slider (between 0.0 and 1.0)
|
* @param defaultValue The default value for the slider (between 0.0 and 1.0)
|
||||||
* @return The slider element
|
* @return The slider element
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static Div createSliderInput(String label, Consumer<ValueChangeEvent> onChange, float defaultValue){
|
public static Div createSliderInput(String label, Consumer<ValueChangeEvent> onChange, float defaultValue){
|
||||||
Div rVal = Div.createDiv();
|
Div rVal = Div.createDiv();
|
||||||
rVal.setFlexDirection(YogaFlexDirection.Row);
|
rVal.setFlexDirection(YogaFlexDirection.Row);
|
||||||
@ -109,7 +130,6 @@ public class InputMacros {
|
|||||||
* @param onChange The on change callback
|
* @param onChange The on change callback
|
||||||
* @return The div containing a labeled toggle
|
* @return The div containing a labeled toggle
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static Div createToggle(String label, boolean defaultValue, Consumer<ValueChangeEvent> onChange){
|
public static Div createToggle(String label, boolean defaultValue, Consumer<ValueChangeEvent> onChange){
|
||||||
Div rVal = Div.createDiv();
|
Div rVal = Div.createDiv();
|
||||||
rVal.setFlexDirection(YogaFlexDirection.Row);
|
rVal.setFlexDirection(YogaFlexDirection.Row);
|
||||||
@ -47,8 +47,7 @@ public class Label extends StandardContainerElement implements DrawableElement {
|
|||||||
* Simplified constructor
|
* Simplified constructor
|
||||||
* @param fontSize the size of the font (default is 1.0f)
|
* @param fontSize the size of the font (default is 1.0f)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
private Label(float fontSize){
|
||||||
public Label(float fontSize){
|
|
||||||
super();
|
super();
|
||||||
this.font = Globals.fontManager.getFont("default");
|
this.font = Globals.fontManager.getFont("default");
|
||||||
setHeight((int)(font.getFontHeight() * fontSize));
|
setHeight((int)(font.getFontHeight() * fontSize));
|
||||||
@ -56,23 +55,6 @@ public class Label extends StandardContainerElement implements DrawableElement {
|
|||||||
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
|
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a label with absolute positioning
|
|
||||||
* @param x the x position
|
|
||||||
* @param y the y position
|
|
||||||
* @param fontSize the font size (default is 1.0f)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Label(int x, int y, float fontSize){
|
|
||||||
super();
|
|
||||||
this.setPositionX(x);
|
|
||||||
this.setPositionY(y);
|
|
||||||
this.font = Globals.fontManager.getFont("default");
|
|
||||||
setHeight((int)(font.getFontHeight() * fontSize));
|
|
||||||
this.fontSize = fontSize;
|
|
||||||
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateLetters(){
|
void generateLetters(){
|
||||||
//free children
|
//free children
|
||||||
for(Element child : childList){
|
for(Element child : childList){
|
||||||
|
|||||||
@ -56,9 +56,6 @@ public class ScrollableContainer extends BufferedStandardDrawableContainerElemen
|
|||||||
*/
|
*/
|
||||||
private ScrollableContainer(){
|
private ScrollableContainer(){
|
||||||
super();
|
super();
|
||||||
|
|
||||||
setWidth(DEFAULT_WIDTH);
|
|
||||||
setHeight(DEFAULT_HEIGHT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -80,23 +80,6 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
|||||||
Yoga.YGNodeStyleSetMinHeight(this.yogaNode, font.imageHeight * fontSize);
|
Yoga.YGNodeStyleSetMinHeight(this.yogaNode, font.imageHeight * fontSize);
|
||||||
Yoga.YGNodeStyleSetMinWidth(this.yogaNode, 1);
|
Yoga.YGNodeStyleSetMinWidth(this.yogaNode, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param fontSize
|
|
||||||
*/
|
|
||||||
public TextInput(int x, int y, float fontSize){
|
|
||||||
super();
|
|
||||||
this.font = Globals.fontManager.getFont("default");
|
|
||||||
this.fontSize = fontSize;
|
|
||||||
this.color = new Vector3f(1,1,1);
|
|
||||||
setHeight((int)(font.getFontHeight() * fontSize));
|
|
||||||
Yoga.YGNodeStyleSetFlexDirection(this.yogaNode, Yoga.YGFlexDirectionRow);
|
|
||||||
Yoga.YGNodeStyleSetMinHeight(this.yogaNode, font.imageHeight * fontSize);
|
|
||||||
Yoga.YGNodeStyleSetMinWidth(this.yogaNode, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateLetters(){
|
void generateLetters(){
|
||||||
for(Element el : getChildren()){
|
for(Element el : getChildren()){
|
||||||
|
|||||||
@ -48,6 +48,15 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
|
|
||||||
static final Vector3f windowDrawDebugColor = new Vector3f(1.0f,0.0f,0.0f);
|
static final Vector3f windowDrawDebugColor = new Vector3f(1.0f,0.0f,0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default width of popups
|
||||||
|
*/
|
||||||
|
static final int DEFAULT_POPUP_WIDTH = 1000;
|
||||||
|
/**
|
||||||
|
* Default height of popups
|
||||||
|
*/
|
||||||
|
static final int DEFAULT_POPUP_HEIGHT = 1000;
|
||||||
|
|
||||||
//controls whether to show window decorations (ie the frame)
|
//controls whether to show window decorations (ie the frame)
|
||||||
boolean showDecorations = true;
|
boolean showDecorations = true;
|
||||||
|
|
||||||
@ -92,14 +101,10 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
/**
|
/**
|
||||||
* Private constructor
|
* Private constructor
|
||||||
* @param openGLState
|
* @param openGLState
|
||||||
* @param positionX
|
|
||||||
* @param positionY
|
|
||||||
* @param width
|
|
||||||
* @param height
|
|
||||||
*/
|
*/
|
||||||
private Window(OpenGLState openGLState, int positionX, int positionY, int width, int height){
|
private Window(OpenGLState openGLState){
|
||||||
try {
|
try {
|
||||||
widgetBuffer = FramebufferUtils.generateTextureFramebuffer(openGLState, width, height);
|
widgetBuffer = FramebufferUtils.generateTextureFramebuffer(openGLState, DEFAULT_POPUP_WIDTH, DEFAULT_POPUP_HEIGHT);
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
LoggerInterface.loggerRenderer.ERROR(e);
|
LoggerInterface.loggerRenderer.ERROR(e);
|
||||||
}
|
}
|
||||||
@ -114,8 +119,8 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
setParentAlignItem(YogaAlignment.Start);
|
setParentAlignItem(YogaAlignment.Start);
|
||||||
setParentJustifyContent(YogaJustification.Start);
|
setParentJustifyContent(YogaJustification.Start);
|
||||||
this.setFlexDirection(YogaFlexDirection.Column);
|
this.setFlexDirection(YogaFlexDirection.Column);
|
||||||
this.setMinWidth(width);
|
this.setMinWidth(DEFAULT_POPUP_WIDTH);
|
||||||
this.setMinHeight(height);
|
this.setMinHeight(DEFAULT_POPUP_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,7 +148,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
* @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, int posX, int posY, int width, int height){
|
||||||
Window rVal = new Window(openGLState, posX, posY, width, height);
|
Window rVal = new Window(openGLState);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +162,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
* @return The window element
|
* @return The window element
|
||||||
*/
|
*/
|
||||||
public static Window createExpandableCenterAligned(OpenGLState openGLState, int width, int height){
|
public static Window createExpandableCenterAligned(OpenGLState openGLState, int width, int height){
|
||||||
Window rVal = new Window(openGLState, 0, 0, width, height);
|
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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user