Menu sound suite, continued UI work
This commit is contained in:
parent
8a61d0815f
commit
fc335b8df2
BIN
assets/Audio/MenuBackspace.ogg
Normal file
BIN
assets/Audio/MenuBackspace.ogg
Normal file
Binary file not shown.
BIN
assets/Audio/MenuBadOption.ogg
Normal file
BIN
assets/Audio/MenuBadOption.ogg
Normal file
Binary file not shown.
BIN
assets/Audio/MenuChangeOption.ogg
Normal file
BIN
assets/Audio/MenuChangeOption.ogg
Normal file
Binary file not shown.
BIN
assets/Audio/MenuType.ogg
Normal file
BIN
assets/Audio/MenuType.ogg
Normal file
Binary file not shown.
BIN
assets/Textures/ow1.png
Normal file
BIN
assets/Textures/ow1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 718 B |
@ -191,6 +191,8 @@ public class Globals {
|
|||||||
|
|
||||||
public static String blackTexture;
|
public static String blackTexture;
|
||||||
public static String testingTexture;
|
public static String testingTexture;
|
||||||
|
public static String whiteTexture;
|
||||||
|
public static String offWhiteTexture;
|
||||||
|
|
||||||
public static String planeModelID;
|
public static String planeModelID;
|
||||||
|
|
||||||
@ -298,7 +300,8 @@ public class Globals {
|
|||||||
public static boolean RENDER_FLAG_RENDER_SHADOW_MAP = false;
|
public static boolean RENDER_FLAG_RENDER_SHADOW_MAP = false;
|
||||||
public static boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
|
public static boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
|
||||||
public static boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
|
public static boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
|
||||||
public static boolean RENDER_FLAG_RENDER_BLACK_BACKGROUND = true;
|
public static boolean RENDER_FLAG_RENDER_BLACK_BACKGROUND = false;
|
||||||
|
public static boolean RENDER_FLAG_RENDER_WHITE_BACKGROUND = true;
|
||||||
public static boolean RENDER_FLAG_RENDER_UI = true;
|
public static boolean RENDER_FLAG_RENDER_UI = true;
|
||||||
|
|
||||||
|
|
||||||
@ -336,6 +339,13 @@ public class Globals {
|
|||||||
playerManager = new PlayerManager();
|
playerManager = new PlayerManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initDefaultAudioResources(){
|
||||||
|
Globals.assetManager.addAudioPathToQueue("/Audio/MenuBackspace.ogg");
|
||||||
|
Globals.assetManager.addAudioPathToQueue("/Audio/MenuBadOption.ogg");
|
||||||
|
Globals.assetManager.addAudioPathToQueue("/Audio/MenuChangeOption.ogg");
|
||||||
|
Globals.assetManager.addAudioPathToQueue("/Audio/MenuType.ogg");
|
||||||
|
}
|
||||||
|
|
||||||
public static void initDefaultGraphicalResources(){
|
public static void initDefaultGraphicalResources(){
|
||||||
//create default textures
|
//create default textures
|
||||||
Globals.assetManager.addTexturePathtoQueue("Textures/default_diffuse.png");
|
Globals.assetManager.addTexturePathtoQueue("Textures/default_diffuse.png");
|
||||||
@ -354,6 +364,12 @@ public class Globals {
|
|||||||
//black texture for backgrouns
|
//black texture for backgrouns
|
||||||
blackTexture = "Textures/b1.png";
|
blackTexture = "Textures/b1.png";
|
||||||
Globals.assetManager.addTexturePathtoQueue(blackTexture);
|
Globals.assetManager.addTexturePathtoQueue(blackTexture);
|
||||||
|
//white texture for backgrounds
|
||||||
|
whiteTexture = "Textures/w1.png";
|
||||||
|
Globals.assetManager.addTexturePathtoQueue(whiteTexture);
|
||||||
|
//off white texture for backgrounds
|
||||||
|
offWhiteTexture = "Textures/ow1.png";
|
||||||
|
Globals.assetManager.addTexturePathtoQueue(offWhiteTexture);
|
||||||
//loading box
|
//loading box
|
||||||
loadingBox = WidgetUtils.createVerticallyAlignedTextBox(520, 100, 50, 7, 1, "LOADING", true);
|
loadingBox = WidgetUtils.createVerticallyAlignedTextBox(520, 100, 50, 7, 1, "LOADING", true);
|
||||||
//init default shaderProgram
|
//init default shaderProgram
|
||||||
|
|||||||
@ -185,6 +185,7 @@ public class Main {
|
|||||||
|
|
||||||
//init default resources
|
//init default resources
|
||||||
Globals.initDefaultGraphicalResources();
|
Globals.initDefaultGraphicalResources();
|
||||||
|
Globals.initDefaultAudioResources();
|
||||||
|
|
||||||
//fire off a loading thread for the title menus/screen
|
//fire off a loading thread for the title menus/screen
|
||||||
Globals.loadingThread = new LoadingThread(LoadingThread.LOAD_TITLE_MENU);
|
Globals.loadingThread = new LoadingThread(LoadingThread.LOAD_TITLE_MENU);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package electrosphere.menu;
|
package electrosphere.menu;
|
||||||
|
|
||||||
|
import electrosphere.audio.AudioSource;
|
||||||
|
import electrosphere.audio.AudioUtils;
|
||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
import electrosphere.renderer.ui.Widget;
|
import electrosphere.renderer.ui.Widget;
|
||||||
import electrosphere.renderer.ui.font.TextBox;
|
import electrosphere.renderer.ui.font.TextBox;
|
||||||
@ -63,6 +65,7 @@ public class Menu {
|
|||||||
option = 0;
|
option = 0;
|
||||||
}
|
}
|
||||||
setMenuOptionColor(option,new Vector3f(0.2f,0.8f,0.5f));
|
setMenuOptionColor(option,new Vector3f(0.2f,0.8f,0.5f));
|
||||||
|
AudioSource startupSound = AudioUtils.playAudioAtLocation("/Audio/MenuChangeOption.ogg", new Vector3f(0,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decrementMenuOption(){
|
public void decrementMenuOption(){
|
||||||
@ -72,6 +75,7 @@ public class Menu {
|
|||||||
option = optionMax - 1;
|
option = optionMax - 1;
|
||||||
}
|
}
|
||||||
setMenuOptionColor(option,new Vector3f(0.2f,0.8f,0.5f));
|
setMenuOptionColor(option,new Vector3f(0.2f,0.8f,0.5f));
|
||||||
|
AudioSource startupSound = AudioUtils.playAudioAtLocation("/Audio/MenuChangeOption.ogg", new Vector3f(0,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Widget getCurrentOption(){
|
public Widget getCurrentOption(){
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package electrosphere.menu;
|
package electrosphere.menu;
|
||||||
|
|
||||||
|
import electrosphere.audio.AudioSource;
|
||||||
|
import electrosphere.audio.AudioUtils;
|
||||||
import electrosphere.controls.ControlHandler;
|
import electrosphere.controls.ControlHandler;
|
||||||
import electrosphere.engine.LoadingThread;
|
import electrosphere.engine.LoadingThread;
|
||||||
import electrosphere.game.server.saves.SaveUtils;
|
import electrosphere.game.server.saves.SaveUtils;
|
||||||
@ -9,6 +11,7 @@ import electrosphere.net.NetUtils;
|
|||||||
import electrosphere.net.client.ClientNetworking;
|
import electrosphere.net.client.ClientNetworking;
|
||||||
import electrosphere.renderer.ui.Widget;
|
import electrosphere.renderer.ui.Widget;
|
||||||
import electrosphere.renderer.ui.font.TextBox;
|
import electrosphere.renderer.ui.font.TextBox;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -140,6 +143,7 @@ public class MenuTransition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void backout(Menu m){
|
public static void backout(Menu m){
|
||||||
|
AudioSource startupSound = AudioUtils.playAudioAtLocation("/Audio/MenuBackspace.ogg", new Vector3f(0,0,0));
|
||||||
switch(m.getType()){
|
switch(m.getType()){
|
||||||
case TITLE_MENU:
|
case TITLE_MENU:
|
||||||
Main.running = false;
|
Main.running = false;
|
||||||
@ -194,6 +198,7 @@ public class MenuTransition {
|
|||||||
String currentText = currentTextBox.getText();
|
String currentText = currentTextBox.getText();
|
||||||
if(currentText.length() > 0){
|
if(currentText.length() > 0){
|
||||||
currentTextBox.setText(currentText.substring(0, currentText.length() - 1));
|
currentTextBox.setText(currentText.substring(0, currentText.length() - 1));
|
||||||
|
AudioSource startupSound = AudioUtils.playAudioAtLocation("/Audio/MenuBackspace.ogg", new Vector3f(0,0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
backspace = true;
|
backspace = true;
|
||||||
@ -316,6 +321,7 @@ public class MenuTransition {
|
|||||||
String currentText = currentTextBox.getText();
|
String currentText = currentTextBox.getText();
|
||||||
if(currentText.length() < currentTextBox.getCols()){
|
if(currentText.length() < currentTextBox.getCols()){
|
||||||
currentTextBox.setText(currentText + toWrite);
|
currentTextBox.setText(currentText + toWrite);
|
||||||
|
AudioSource startupSound = AudioUtils.playAudioAtLocation("/Audio/MenuType.ogg", new Vector3f(0,0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -305,6 +305,13 @@ public class RenderingEngine {
|
|||||||
renderBlackBackground();
|
renderBlackBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Render white background
|
||||||
|
*/
|
||||||
|
if(Globals.RENDER_FLAG_RENDER_WHITE_BACKGROUND){
|
||||||
|
renderWhiteBackground();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Render any ui elements
|
Render any ui elements
|
||||||
*/
|
*/
|
||||||
@ -668,6 +675,20 @@ public class RenderingEngine {
|
|||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void renderWhiteBackground(){
|
||||||
|
//render full screen quad
|
||||||
|
glUseProgram(screenTextureShaders.shaderProgram);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glBindVertexArray(screenTextureVAO);
|
||||||
|
Texture blackTexture = Globals.assetManager.fetchTexture(Globals.offWhiteTexture);
|
||||||
|
if(blackTexture != null){
|
||||||
|
blackTexture.bind();
|
||||||
|
}
|
||||||
|
// glBindTexture(GL_TEXTURE_2D, screenFramebuffer.getTexture());
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||||
|
glBindVertexArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setActiveShader(ShaderProgram program){
|
public void setActiveShader(ShaderProgram program){
|
||||||
glUseProgram(program.shaderProgram);
|
glUseProgram(program.shaderProgram);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user