ui is stupid
This commit is contained in:
parent
194592c18d
commit
14d096230a
@ -11,16 +11,17 @@ uniform vec3 tDimension;
|
||||
|
||||
void main(){
|
||||
vec2 finalPos = vec2(
|
||||
aPos.x * mDimension.x - (1 - mDimension.x) + mPosition.x,
|
||||
aPos.y * mDimension.y + (1 - mDimension.y) - mPosition.y
|
||||
((aPos.x + 1)/2 * mDimension.x + mPosition.x) * 2 - 1,
|
||||
((1-(aPos.y + 1)/2) * mDimension.y + mPosition.y) * 2 - 1
|
||||
// aPos.y * mDimension.y + (mPosition.y) + (1 - mDimension.y)
|
||||
);
|
||||
gl_Position = vec4(finalPos.x, finalPos.y, 0.0, 1.0);
|
||||
|
||||
vec2 finalTex = vec2(
|
||||
aTexCoords.x * tDimension.x + tPosition.x,
|
||||
aTexCoords.y * tDimension.y + tPosition.y
|
||||
);
|
||||
// vec2 finalTex = aTexCoords;
|
||||
// vec2 finalTex = vec2(
|
||||
// aTexCoords.x * tDimension.x + tPosition.x,
|
||||
// aTexCoords.y * tDimension.y + tPosition.y
|
||||
// );
|
||||
vec2 finalTex = aTexCoords;
|
||||
// vec2 finalTex = vec2(
|
||||
// aTexCoords.x + 0.7,
|
||||
// aTexCoords.y
|
||||
|
||||
@ -15,34 +15,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.joml.Vector2f;
|
||||
import org.joml.Vector3f;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_DISABLED;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_HIDDEN;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_NORMAL;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_0;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_1;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_2;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_3;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_4;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_5;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_6;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_7;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_8;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_9;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_A;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_BACKSPACE;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_D;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ENTER;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT_CONTROL;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_PERIOD;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_S;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_SPACE;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_UP;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_W;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_PRESS;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetCursorPos;
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetKey;
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetMouseButton;
|
||||
@ -81,6 +54,32 @@ public class ControlHandler {
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_8 = "menuType8";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_9 = "menuType9";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_PERIOD = "menuType.";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_A = "menuTypeA";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_B = "menuTypeB";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_C = "menuTypeC";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_D = "menuTypeD";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_E = "menuTypeE";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_F = "menuTypeF";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_G = "menuTypeG";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_H = "menuTypeH";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_I = "menuTypeI";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_J = "menuTypeJ";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_K = "menuTypeK";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_L = "menuTypeL";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_M = "menuTypeM";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_N = "menuTypeN";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_O = "menuTypeO";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_P = "menuTypeP";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_Q = "menuTypeQ";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_R = "menuTypeR";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_S = "menuTypeS";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_T = "menuTypeT";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_U = "menuTypeU";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_V = "menuTypeV";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_W = "menuTypeW";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_X = "menuTypeX";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_Y = "menuTypeY";
|
||||
public static final String DATA_STRING_INPUT_CODE_MENU_TYPE_Z = "menuTypeZ";
|
||||
|
||||
|
||||
public static enum ControlsState {
|
||||
@ -140,6 +139,32 @@ public class ControlHandler {
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_8, new Control(true,false,GLFW_KEY_8));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_9, new Control(true,false,GLFW_KEY_9));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_PERIOD, new Control(true,false,GLFW_KEY_PERIOD));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_A, new Control(true,false,GLFW_KEY_A));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_B, new Control(true,false,GLFW_KEY_B));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_C, new Control(true,false,GLFW_KEY_C));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_D, new Control(true,false,GLFW_KEY_D));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_E, new Control(true,false,GLFW_KEY_E));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_F, new Control(true,false,GLFW_KEY_F));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_G, new Control(true,false,GLFW_KEY_G));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_H, new Control(true,false,GLFW_KEY_H));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_I, new Control(true,false,GLFW_KEY_I));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_J, new Control(true,false,GLFW_KEY_J));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_K, new Control(true,false,GLFW_KEY_K));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_L, new Control(true,false,GLFW_KEY_L));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_M, new Control(true,false,GLFW_KEY_M));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_N, new Control(true,false,GLFW_KEY_N));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_O, new Control(true,false,GLFW_KEY_O));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_P, new Control(true,false,GLFW_KEY_P));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_Q, new Control(true,false,GLFW_KEY_Q));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_R, new Control(true,false,GLFW_KEY_R));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_S, new Control(true,false,GLFW_KEY_S));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_T, new Control(true,false,GLFW_KEY_T));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_U, new Control(true,false,GLFW_KEY_U));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_V, new Control(true,false,GLFW_KEY_V));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_W, new Control(true,false,GLFW_KEY_W));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_X, new Control(true,false,GLFW_KEY_X));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_Y, new Control(true,false,GLFW_KEY_Y));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_TYPE_Z, new Control(true,false,GLFW_KEY_Z));
|
||||
|
||||
/*
|
||||
set state
|
||||
@ -398,7 +423,7 @@ public class ControlHandler {
|
||||
controls.get(currentKey).setState(true);
|
||||
} else {
|
||||
if(controls.get(currentKey).isState() == true){
|
||||
MenuTransition.menuType(Globals.currentMenu,currentKey);
|
||||
MenuTransition.menuHandleKeypress(Globals.currentMenu,currentKey);
|
||||
}
|
||||
controls.get(currentKey).setState(false);
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ public class Menu {
|
||||
setMenuOptionColor(option,new Vector3f(0.2f,0.8f,0.5f));
|
||||
}
|
||||
|
||||
public int getCurrentOption(){
|
||||
return option;
|
||||
public Widget getCurrentOption(){
|
||||
return optionList.get(option);
|
||||
}
|
||||
|
||||
public MenuType getType(){
|
||||
|
||||
@ -17,9 +17,9 @@ public class MenuTransition {
|
||||
public static void selectOption(Menu m){
|
||||
switch(m.getType()){
|
||||
case TITLE_MENU:
|
||||
switch(m.getCurrentOption()){
|
||||
switch(((TextBox)m.getCurrentOption()).getText()){
|
||||
//single player
|
||||
case 0:
|
||||
case "SINGLEPLAYER":
|
||||
// m.dispose();
|
||||
// Globals.loadingThread = new LoadingThread(LoadingThread.LOAD_MAIN_GAME);
|
||||
// Globals.RUN_CLIENT = true;
|
||||
@ -29,12 +29,12 @@ public class MenuTransition {
|
||||
Globals.currentMenu = MenuUtils.createWorldSelectMenu();
|
||||
break;
|
||||
//multi player
|
||||
case 1:
|
||||
case "MULTIPLAYER":
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createMultiplayerMenu();
|
||||
break;
|
||||
//arena
|
||||
case 2:
|
||||
case "ARENA":
|
||||
m.dispose();
|
||||
Globals.loadingThread = new LoadingThread(LoadingThread.LOAD_ARENA);
|
||||
Globals.RUN_CLIENT = true;
|
||||
@ -42,12 +42,12 @@ public class MenuTransition {
|
||||
Globals.loadingThread.start();
|
||||
break;
|
||||
//options
|
||||
case 3:
|
||||
case "OPTIONS":
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createOptionsMainMenu();
|
||||
break;
|
||||
//test
|
||||
case 4:
|
||||
case "UI TESTING":
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createTestMainMenu();
|
||||
break;
|
||||
@ -59,10 +59,14 @@ public class MenuTransition {
|
||||
break;
|
||||
case SAVE_CREATE_MENU:
|
||||
break;
|
||||
case CHARACTER_CREATE_MENU:
|
||||
break;
|
||||
case FINALIZE_SAVE_CREATION_MENU:
|
||||
break;
|
||||
case MULTIPLAYER_MENU:
|
||||
switch(m.getCurrentOption()){
|
||||
switch(((TextBox)m.getCurrentOption()).getText()){
|
||||
//HOST
|
||||
case 0:
|
||||
case "HOST":
|
||||
m.dispose();
|
||||
Globals.loadingThread = new LoadingThread(LoadingThread.LOAD_MAIN_GAME);
|
||||
Globals.RUN_CLIENT = true;
|
||||
@ -70,21 +74,21 @@ public class MenuTransition {
|
||||
Globals.loadingThread.start();
|
||||
break;
|
||||
//JOIN
|
||||
case 1:
|
||||
case "JOIN":
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createIPMenu();
|
||||
break;
|
||||
//back
|
||||
case 2:
|
||||
case "BACK":
|
||||
backout(m);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case IP_MENU:
|
||||
switch(m.getCurrentOption()){
|
||||
switch(((TextBox)m.getCurrentOption()).getText()){
|
||||
//connect
|
||||
case 2:
|
||||
case "CONNECT":
|
||||
NetUtils.setAddress( ( (TextBox)m.getOptions().get(0) ).getText() );
|
||||
NetUtils.setPort( Integer.parseInt( ( (TextBox)m.getOptions().get(1) ).getText() ) );
|
||||
m.dispose();
|
||||
@ -94,7 +98,7 @@ public class MenuTransition {
|
||||
Globals.loadingThread.start();
|
||||
break;
|
||||
//back
|
||||
case 3:
|
||||
case "BACK":
|
||||
backout(m);
|
||||
break;
|
||||
}
|
||||
@ -111,6 +115,22 @@ public class MenuTransition {
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createTitleMenu();
|
||||
break;
|
||||
case WORLD_CREATE_MENU:
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createWorldSelectMenu();
|
||||
break;
|
||||
case SAVE_CREATE_MENU:
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createWorldSelectMenu();
|
||||
break;
|
||||
case CHARACTER_CREATE_MENU:
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createSaveCreationMenu();
|
||||
break;
|
||||
case FINALIZE_SAVE_CREATION_MENU:
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createCharacterCreationMenu();
|
||||
break;
|
||||
case MULTIPLAYER_MENU:
|
||||
m.dispose();
|
||||
Globals.currentMenu = MenuUtils.createTitleMenu();
|
||||
@ -130,11 +150,11 @@ public class MenuTransition {
|
||||
}
|
||||
}
|
||||
|
||||
public static void menuType(Menu m, String code){
|
||||
public static void menuHandleKeypress(Menu m, String keycode){
|
||||
char toWrite = ' ';
|
||||
Widget currentOption = m.getOptions().get(m.getCurrentOption());
|
||||
Widget currentOption = m.getCurrentOption();
|
||||
boolean backspace = false;
|
||||
switch(code){
|
||||
switch(keycode){
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_BACKSPACE:
|
||||
if(currentOption instanceof TextBox){
|
||||
TextBox currentTextBox = (TextBox)currentOption;
|
||||
@ -175,6 +195,84 @@ public class MenuTransition {
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_9:
|
||||
toWrite = '9';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_A:
|
||||
toWrite = 'A';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_B:
|
||||
toWrite = 'B';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_C:
|
||||
toWrite = 'C';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_D:
|
||||
toWrite = 'D';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_E:
|
||||
toWrite = 'E';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_F:
|
||||
toWrite = 'F';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_G:
|
||||
toWrite = 'G';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_H:
|
||||
toWrite = 'H';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_I:
|
||||
toWrite = 'I';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_J:
|
||||
toWrite = 'J';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_K:
|
||||
toWrite = 'K';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_L:
|
||||
toWrite = 'L';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_M:
|
||||
toWrite = 'M';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_N:
|
||||
toWrite = 'N';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_O:
|
||||
toWrite = 'O';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_P:
|
||||
toWrite = 'P';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_Q:
|
||||
toWrite = 'Q';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_R:
|
||||
toWrite = 'R';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_S:
|
||||
toWrite = 'S';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_T:
|
||||
toWrite = 'T';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_U:
|
||||
toWrite = 'U';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_V:
|
||||
toWrite = 'V';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_W:
|
||||
toWrite = 'W';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_X:
|
||||
toWrite = 'X';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_Y:
|
||||
toWrite = 'Y';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_Z:
|
||||
toWrite = 'Z';
|
||||
break;
|
||||
case ControlHandler.DATA_STRING_INPUT_CODE_MENU_TYPE_PERIOD:
|
||||
toWrite = '.';
|
||||
break;
|
||||
|
||||
@ -65,10 +65,33 @@ public class MenuUtils {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static Menu createCharacterCreationMenu(){
|
||||
Menu rVal = new Menu(MenuType.CHARACTER_CREATE_MENU);
|
||||
int screenTop = Globals.WINDOW_HEIGHT - 150;
|
||||
List<String> saveNames = SaveUtils.getSaves();
|
||||
int verticalPosition = 125;
|
||||
//TODO: add text input to name world
|
||||
rVal.addOption(WidgetUtils.createVerticallyAlignedMinSizeTextBoxFromCharCount(40, 40, screenTop - verticalPosition, "CREATE WORLD", true));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static Menu createFinalizeSaveCReationMenu(){
|
||||
Menu rVal = new Menu(MenuType.FINALIZE_SAVE_CREATION_MENU);
|
||||
int screenTop = Globals.WINDOW_HEIGHT - 150;
|
||||
List<String> saveNames = SaveUtils.getSaves();
|
||||
int verticalPosition = 125;
|
||||
//TODO: add text input to name world
|
||||
rVal.addOption(WidgetUtils.createVerticallyAlignedMinSizeTextBoxFromCharCount(40, 40, screenTop - verticalPosition, "CREATE WORLD", true));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static Menu createMultiplayerMenu(){
|
||||
Menu rVal = new Menu(MenuType.SAVE_CREATE_MENU);
|
||||
int screenTop = Globals.WINDOW_HEIGHT - 150;
|
||||
rVal.addOption( WidgetUtils.createVerticallyAlignedMinSizeTextBoxFromCharCount(40, 40, screenTop - 125, "CREATE", true));
|
||||
rVal.addOption( WidgetUtils.createVerticallyAlignedMinSizeTextBoxFromCharCount(40, 40, screenTop - 125, "HOST", true));
|
||||
rVal.setMenuOptionColor(0, new Vector3f(0.2f,0.8f,0.5f));
|
||||
rVal.addOption( WidgetUtils.createVerticallyAlignedMinSizeTextBoxFromCharCount(40, 40, screenTop - 200, "JOIN", true));
|
||||
rVal.addOption( WidgetUtils.createVerticallyAlignedMinSizeTextBoxFromCharCount(40, 40, screenTop - 275, "BACK", true));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -681,6 +681,8 @@ public class ModelUtils {
|
||||
uiMat.set_diffuse("/Textures/Fonts/myfont1-harsher.png");
|
||||
uiMat.set_specular("/Textures/Fonts/myfont1-harsher.png");
|
||||
m.setMaterial(uiMat);
|
||||
rVal.materials = new ArrayList();
|
||||
rVal.materials.add(uiMat);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
|
||||
|
||||
@ -574,7 +574,7 @@ public class RenderingEngine {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
for(Widget currentWidget : Globals.widgetManager.getWidgetList()){
|
||||
if(currentWidget.getVisible()){
|
||||
currentWidget.draw(GL_DEFAULT_FRAMEBUFFER);
|
||||
currentWidget.draw(GL_DEFAULT_FRAMEBUFFER, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,4 +617,8 @@ public class RenderingEngine {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, framebufferPointer);
|
||||
}
|
||||
|
||||
public void setViewportSize(int width, int height){
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package electrosphere.renderer.framebuffer;
|
||||
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
import static org.lwjgl.opengl.GL30.GL_FRAMEBUFFER;
|
||||
import static org.lwjgl.opengl.GL30.GL_FRAMEBUFFER_COMPLETE;
|
||||
@ -45,4 +47,14 @@ public class Framebuffer {
|
||||
public void free(){
|
||||
glDeleteFramebuffers(framebufferPointer);
|
||||
}
|
||||
|
||||
public void blockUntilCompiled(){
|
||||
while(glCheckFramebufferStatus(framebufferPointer) != GL_FRAMEBUFFER_COMPLETE){
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(1);
|
||||
} catch (InterruptedException ex) {
|
||||
LoggerInterface.loggerEngine.ERROR("Failed to sleep in framebuffer blocker", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
package electrosphere.renderer.framebuffer;
|
||||
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.main.Globals;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_COMPONENT;
|
||||
import static org.lwjgl.opengl.GL11.GL_FLOAT;
|
||||
import static org.lwjgl.opengl.GL11.GL_LINEAR;
|
||||
@ -106,6 +110,8 @@ public class FramebufferUtils {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Renderbuffer generateScreensizeStencilDepthRenderbuffer(){
|
||||
Renderbuffer buffer = new Renderbuffer();
|
||||
buffer.bind();
|
||||
|
||||
@ -6,11 +6,14 @@ package electrosphere.renderer.ui;
|
||||
*/
|
||||
public abstract class Widget {
|
||||
|
||||
public int width;
|
||||
public int height;
|
||||
public int width = 1;
|
||||
public int height = 1;
|
||||
|
||||
public int positionX;
|
||||
public int positionY;
|
||||
public int positionX = 0;
|
||||
public int positionY = 0;
|
||||
|
||||
public int parentWidth = 1;
|
||||
public int parentHeight = 1;
|
||||
|
||||
public boolean visible = false;
|
||||
|
||||
@ -54,6 +57,14 @@ public abstract class Widget {
|
||||
this.visible = draw;
|
||||
}
|
||||
|
||||
public abstract void draw(int parentFramebufferPointer);
|
||||
public void setParentWidth(int width){
|
||||
parentWidth = width;
|
||||
}
|
||||
|
||||
public void setParentHeight(int height){
|
||||
parentHeight = height;
|
||||
}
|
||||
|
||||
public abstract void draw(int parentFramebufferPointer, int parentWidth, int parentHeight);
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import electrosphere.main.Globals;
|
||||
import electrosphere.renderer.ui.font.TextBox;
|
||||
import electrosphere.renderer.ui.layout.LayoutSchemeListScrollable;
|
||||
import electrosphere.renderer.ui.widgets.ImagePanel;
|
||||
import electrosphere.renderer.ui.widgets.TextInput;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -57,29 +58,51 @@ public class WidgetUtils {
|
||||
}
|
||||
|
||||
public static Widget createWindowTEST(){
|
||||
Window rVal = new Window(500, 500, 500, 500);
|
||||
//panel 1
|
||||
ImagePanel imagePanel = new ImagePanel();
|
||||
imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.testingTexture));
|
||||
imagePanel.setPositionX(100);
|
||||
imagePanel.setPositionY(100);
|
||||
imagePanel.setVisible(true);
|
||||
rVal.addWidget(imagePanel);
|
||||
//panel 2
|
||||
imagePanel = new ImagePanel();
|
||||
imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.testingTexture));
|
||||
imagePanel.setVisible(true);
|
||||
rVal.addWidget(imagePanel);
|
||||
rVal.setVisible(true);
|
||||
//window top
|
||||
imagePanel = new ImagePanel();
|
||||
imagePanel.setTexture(Globals.assetManager.fetchTexture("Textures/ui/WindowBorder.png"));
|
||||
imagePanel.setWidth(100);
|
||||
imagePanel.setHeight(50);
|
||||
imagePanel.setPositionX(200);
|
||||
imagePanel.setPositionY(50);
|
||||
imagePanel.setVisible(true);
|
||||
rVal.addWidget(imagePanel);
|
||||
Window rVal = new Window(0, 0, 1920, 1080);
|
||||
// //panel 1
|
||||
// ImagePanel imagePanel = new ImagePanel();
|
||||
// imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.testingTexture));
|
||||
// imagePanel.setPositionX(100);
|
||||
// imagePanel.setPositionY(100);
|
||||
// imagePanel.setVisible(true);
|
||||
// rVal.addWidget(imagePanel);
|
||||
// //panel 2
|
||||
// imagePanel = new ImagePanel();
|
||||
// imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.testingTexture));
|
||||
// imagePanel.setVisible(true);
|
||||
// rVal.addWidget(imagePanel);
|
||||
// rVal.setVisible(true);
|
||||
// //window top
|
||||
// imagePanel = new ImagePanel();
|
||||
// imagePanel.setTexture(Globals.assetManager.fetchTexture("Textures/ui/WindowBorder.png"));
|
||||
// imagePanel.setWidth(100);
|
||||
// imagePanel.setHeight(50);
|
||||
// imagePanel.setPositionX(200);
|
||||
// imagePanel.setPositionY(50);
|
||||
// imagePanel.setVisible(true);
|
||||
// rVal.addWidget(imagePanel);
|
||||
TextInput textInput = new TextInput();
|
||||
textInput.setText("TESTESTE$STESTET\nTESTESTE$STESTET\nTESTESTE$STESTET\nTESTESTE$STESTET\nTESTESTE$STESTET\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\nAAAAAAAAAABBBBBBBBBB\n");
|
||||
textInput.setPositionX(0);
|
||||
textInput.setPositionY(0);
|
||||
textInput.setWidth(500);
|
||||
textInput.setHeight(500);
|
||||
textInput.setFontWidth(10);
|
||||
textInput.setFontHeight(27);
|
||||
textInput.setVisible(true);
|
||||
rVal.addWidget(textInput);
|
||||
|
||||
// TextInput textInput2 = new TextInput();
|
||||
// textInput2.setText("TESTESTE$STESTET\nTESTESTE$STESTET\nTESTESTE$STESTET\nTESTESTE$STESTET\nTESTESTE$STESTET\n");
|
||||
// textInput2.setPositionX(500);
|
||||
// textInput2.setPositionY(0);
|
||||
// textInput2.setWidth(500);
|
||||
// textInput2.setHeight(500);
|
||||
// textInput2.setFontWidth(20);
|
||||
// textInput2.setFontHeight(40);
|
||||
// textInput2.setVisible(true);
|
||||
// rVal.addWidget(textInput2);
|
||||
|
||||
rVal.setVisible(true);
|
||||
Globals.widgetManager.registerWidget(rVal);
|
||||
return rVal;
|
||||
|
||||
@ -30,28 +30,33 @@ public class Window extends Widget {
|
||||
// widgetBuffer = FramebufferUtils.generateTextureFramebuffer(width, height);
|
||||
widgetBuffer = FramebufferUtils.generateScreensizeTextureFramebuffer();
|
||||
customMat.setTexturePointer(widgetBuffer.getTexturePointer());
|
||||
// customMat.setTexturePointer(Globals.assetManager.fetchTexture("Textures/Testing1.png").getTexturePointer());
|
||||
float ndcX = (float)positionX/Globals.WINDOW_WIDTH;
|
||||
float ndcY = (float)positionY/Globals.WINDOW_HEIGHT;
|
||||
float ndcWidth = (float)width/Globals.WINDOW_WIDTH;
|
||||
float ndcHeight = (float)height/Globals.WINDOW_HEIGHT;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
boxPosition = new Vector3f(ndcX,ndcY,0);
|
||||
boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer) {
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
|
||||
widgetBuffer.bind();
|
||||
// Globals.renderingEngine.setViewportSize(width, height);
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
for(Widget child : widgetList){
|
||||
child.draw(widgetBuffer.getFramebufferPointer());
|
||||
child.draw(widgetBuffer.getFramebufferPointer(),width,height);
|
||||
}
|
||||
//this call binds the screen as the "texture" we're rendering to
|
||||
//have to call before actually rendering
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, parentFramebufferPointer);
|
||||
Globals.renderingEngine.setViewportSize(parentWidth, parentHeight);
|
||||
|
||||
Model planeModel = Globals.assetManager.fetchModel(Globals.planeModelID);
|
||||
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);
|
||||
@ -68,12 +73,32 @@ public class Window extends Widget {
|
||||
|
||||
public void addWidget(Widget widget) {
|
||||
widgetList.add(widget);
|
||||
widget.setParentWidth(width);
|
||||
widget.setParentHeight(height);
|
||||
widget.setVisible(false);
|
||||
}
|
||||
|
||||
public List<Widget> getWidgets() {
|
||||
return widgetList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth(int width){
|
||||
this.width = width;
|
||||
for(Widget widget : widgetList){
|
||||
widget.setParentWidth(width);
|
||||
widget.setParentHeight(height);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(int height){
|
||||
this.height = height;
|
||||
for(Widget widget : widgetList){
|
||||
widget.setParentWidth(height);
|
||||
widget.setParentHeight(height);
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
|
||||
@ -72,7 +72,7 @@ public class TextBox extends Widget{
|
||||
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer){
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight){
|
||||
Globals.renderingEngine.bindFramebuffer(parentFramebufferPointer);
|
||||
float ndcX = (float)positionX/Globals.WINDOW_WIDTH;
|
||||
float ndcY = (float)positionY/Globals.WINDOW_HEIGHT;
|
||||
|
||||
@ -54,12 +54,12 @@ public class LayoutSchemeListScrollable extends Widget {
|
||||
static float aaaa = 0;
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer) {
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
widgetBuffer.bind();
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
for(Widget child : widgetList){
|
||||
child.draw(widgetBuffer.getFramebufferPointer());
|
||||
child.draw(widgetBuffer.getFramebufferPointer(),width,height);
|
||||
}
|
||||
//this call binds the screen as the "texture" we're rendering to
|
||||
//have to call before actually rendering
|
||||
|
||||
@ -55,7 +55,7 @@ public class TextBox extends Widget{
|
||||
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer){
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight){
|
||||
throw new UnsupportedOperationException("Transparent Text box draw function not implemented yet oop");
|
||||
// float ndcX = (float)positionX/Globals.WINDOW_WIDTH;
|
||||
// float ndcY = (float)positionY/Globals.WINDOW_HEIGHT;
|
||||
|
||||
@ -73,7 +73,7 @@ public class ImagePanel extends Widget {
|
||||
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer) {
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
//this call binds the screen as the "texture" we're rendering to
|
||||
//have to call before actually rendering
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, parentFramebufferPointer);
|
||||
|
||||
177
src/main/java/electrosphere/renderer/ui/widgets/TextInput.java
Normal file
177
src/main/java/electrosphere/renderer/ui/widgets/TextInput.java
Normal file
@ -0,0 +1,177 @@
|
||||
package electrosphere.renderer.ui.widgets;
|
||||
|
||||
import electrosphere.main.Globals;
|
||||
import electrosphere.renderer.Material;
|
||||
import electrosphere.renderer.Model;
|
||||
import electrosphere.renderer.assetmanager.AssetDataStrings;
|
||||
import electrosphere.renderer.framebuffer.Framebuffer;
|
||||
import electrosphere.renderer.framebuffer.FramebufferUtils;
|
||||
import electrosphere.renderer.texture.Texture;
|
||||
import electrosphere.renderer.ui.Widget;
|
||||
import electrosphere.renderer.ui.font.FontUtils;
|
||||
import org.joml.Vector3f;
|
||||
import static org.lwjgl.opengl.GL30.GL_FRAMEBUFFER;
|
||||
import static org.lwjgl.opengl.GL30.glBindFramebuffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class TextInput extends Widget {
|
||||
|
||||
Framebuffer widgetBuffer;
|
||||
Material customMat = new Material();
|
||||
|
||||
Vector3f boxPosition = new Vector3f(0,0,0);
|
||||
Vector3f boxDimensions = new Vector3f(1,1,0);
|
||||
Vector3f texPosition = new Vector3f(0,0,0);
|
||||
Vector3f texScale = new Vector3f(1,1,0);
|
||||
|
||||
String text = "";
|
||||
|
||||
int fontWidth = 10;
|
||||
int fontHeight = 20;
|
||||
|
||||
int linePaddingHorizonal = 2;
|
||||
int linePaddingVertical = 5;
|
||||
|
||||
Vector3f color = new Vector3f(0,0,0);
|
||||
|
||||
public TextInput(){
|
||||
//TODO: figure out why this has to be 1920x1080
|
||||
// widgetBuffer = FramebufferUtils.generateTextureFramebuffer(500, 500);
|
||||
widgetBuffer = FramebufferUtils.generateScreensizeTextureFramebuffer();
|
||||
customMat.setTexturePointer(widgetBuffer.getTexturePointer());
|
||||
// customMat.setTexturePointer(Globals.assetManager.fetchTexture("Textures/Testing1.png").getTexturePointer());
|
||||
// customMat.setTexturePointer(Globals.assetManager.fetchTexture("Textures/default_diffuse.png").getTexturePointer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionY(int positionY) {
|
||||
float ndcY = (float)positionY/(float)Globals.WINDOW_HEIGHT;
|
||||
boxPosition.y = ndcY;
|
||||
super.setPositionY(positionY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionX(int positionX) {
|
||||
float ndcX = (float)positionX/(float)Globals.WINDOW_WIDTH;
|
||||
boxPosition.x = ndcX;
|
||||
super.setPositionX(positionX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(int height) {
|
||||
float ndcHeight = (float)height/(float)parentHeight;
|
||||
boxDimensions.y = ndcHeight;
|
||||
Framebuffer newBuffer = FramebufferUtils.generateTextureFramebuffer(width, height);
|
||||
Framebuffer oldBuffer = widgetBuffer;
|
||||
widgetBuffer = newBuffer;
|
||||
customMat.setTexturePointer(widgetBuffer.getTexturePointer());
|
||||
oldBuffer.free();
|
||||
// customMat.setTexturePointer(Globals.assetManager.fetchTexture("Textures/Testing1.png").getTexturePointer());
|
||||
super.setHeight(height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth(int width) {
|
||||
float ndcWidth = (float)width/(float)parentWidth;
|
||||
boxDimensions.x = ndcWidth;
|
||||
System.out.println(ndcWidth);
|
||||
Framebuffer newBuffer = FramebufferUtils.generateTextureFramebuffer(width, height);
|
||||
Framebuffer oldBuffer = widgetBuffer;
|
||||
widgetBuffer = newBuffer;
|
||||
customMat.setTexturePointer(widgetBuffer.getTexturePointer());
|
||||
oldBuffer.free();
|
||||
// widgetBuffer = FramebufferUtils.generateTextureFramebuffer(width, height);
|
||||
// customMat.setTexturePointer(Globals.assetManager.fetchTexture("Textures/Testing1.png").getTexturePointer());
|
||||
super.setWidth(width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentWidth(int parentWidth){
|
||||
this.parentWidth = parentWidth;
|
||||
setWidth(width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentHeight(int parentHeight){
|
||||
this.parentHeight = parentHeight;
|
||||
setHeight(height);
|
||||
}
|
||||
|
||||
public void setFontWidth(int width){
|
||||
fontWidth = width;
|
||||
}
|
||||
|
||||
public void setFontHeight(int height){
|
||||
fontHeight = height;
|
||||
}
|
||||
|
||||
public int getFontWidth(){
|
||||
return fontWidth;
|
||||
}
|
||||
|
||||
public int getFontHeight(){
|
||||
return fontHeight;
|
||||
}
|
||||
|
||||
public void setText(String text){
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
widgetBuffer.bind();
|
||||
Globals.renderingEngine.setViewportSize(width, height);
|
||||
|
||||
//monowidth for the moment
|
||||
float charWidth = (float)fontWidth/(float)width;
|
||||
float charHeight = (float)fontHeight/(float)height;
|
||||
float charSpacing = (float)linePaddingHorizonal/(float)width;
|
||||
float lineSpacing = (float)linePaddingVertical/(float)height;
|
||||
|
||||
Model charModel = Globals.assetManager.fetchModel(AssetDataStrings.ASSET_STRING_BITMAP_FONT);
|
||||
int verticalPosition = 0;
|
||||
int horizontalPosition = 0;
|
||||
int charPos = 0;
|
||||
while(charPos < text.length()){
|
||||
char currentChar = text.charAt(charPos);
|
||||
if(currentChar == '\n'){
|
||||
verticalPosition++;
|
||||
horizontalPosition = 0;
|
||||
} else {
|
||||
|
||||
Vector3f characterPosition = new Vector3f(horizontalPosition * (charWidth + charSpacing),-verticalPosition * (charHeight + lineSpacing),0);
|
||||
Vector3f characterDimensions = new Vector3f(charWidth,charHeight,0);
|
||||
Vector3f bitMapPosition = FontUtils.getPositionOfCharacter(currentChar);
|
||||
Vector3f bitMapDimension = FontUtils.getDimensionOfCharacter(currentChar);
|
||||
|
||||
if(charModel != null && currentChar != ' '){
|
||||
charModel.pushUniformToMesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME, "mPosition", characterPosition);
|
||||
charModel.pushUniformToMesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME, "mDimension", characterDimensions);
|
||||
charModel.pushUniformToMesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME, "tPosition", bitMapPosition);
|
||||
charModel.pushUniformToMesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME, "tDimension", bitMapDimension);
|
||||
charModel.pushUniformToMesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME, "color", color);
|
||||
charModel.drawUI();
|
||||
}
|
||||
horizontalPosition++;
|
||||
}
|
||||
charPos++;
|
||||
}
|
||||
|
||||
|
||||
//draw the previous texture to a quad
|
||||
Globals.renderingEngine.bindFramebuffer(parentFramebufferPointer);
|
||||
Globals.renderingEngine.setViewportSize(parentWidth, parentHeight);
|
||||
|
||||
Model planeModel = Globals.assetManager.fetchModel(Globals.planeModelID);
|
||||
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", new Vector3f(0,0,0));
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", new Vector3f(1,1,0));
|
||||
planeModel.meshes.get(0).setMaterial(customMat);
|
||||
planeModel.drawUI();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user