Skip to content

Commit

Permalink
settings menu backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
micycle1 committed Dec 26, 2024
1 parent b256516 commit d51f5cb
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 23 deletions.
3 changes: 2 additions & 1 deletion src/main/java/project_16x16/Audio.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public final class Audio {
public enum BGM {
TEST0("first_theme.mp3"), // TODO
TEST1("cyberSynthwave.mp3"), // TODO
TEST2("First_level_take_1.mp3"), TEST3("Intro_Title_Pause_Screen_Take1_Loopable.mp3");
TEST2("First_level_take_1.mp3"),
TEST3("Intro_Title_Pause_Screen_Take1_Loopable.mp3");

private String filename;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/project_16x16/SideScroller.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public void keyPressed(processing.event.KeyEvent event) {
* keyReleased decides if the key pressed is valid and if it is then removes it
* from the keys ArrayList and keyReleaseEvent flag is set.
*
* FOR GLOBAL KEYS ONLY
* FOR GLOBAL KEYS ONLY (dev tools mostly for now...)
*/
@Override
public void keyReleased(processing.event.KeyEvent event) {
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/project_16x16/scene/AudioSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,36 @@ public AudioSettings(SideScroller a) {
volumeSFX = new Slider(game, 0.75f);
volumeSFX.setText("SFX");
volumeSFX.setPosition(a.width / 2, 350);

}

@Override
public void switchTo() {
originalVolumeBGM = Options.gainBGM;
originalVolumeSFX = Options.gainSFX;
// TODO properly align audio value and slider position
//volumeBGM.setValue(PApplet.map(originalVolumeBGM, -60, 0, 0, 1));
//volumeSFX.setValue(PApplet.map(originalVolumeSFX, -60, 0, 0, 1));
// volumeBGM.setValue(PApplet.map(originalVolumeBGM, -60, 0, 0, 1));
// volumeSFX.setValue(PApplet.map(originalVolumeSFX, -60, 0, 0, 1));
super.switchTo();
}

@Override
public void drawUI() {
game.background(Constants.Colors.MENU_GREY);
displayWindow();
apply.display();
quit.display();
volumeBGM.display();
volumeSFX.display();


}

private void displayWindow() {
background(19, 23, 35);
applet.fill(29, 33, 45);
applet.stroke(47, 54, 73);
applet.strokeWeight(8);
applet.rect(applet.gameResolution.x / 2, applet.gameResolution.y / 2, applet.gameResolution.x * 0.66f - 8,
applet.gameResolution.y - 8);
}

@Override
Expand Down Expand Up @@ -112,10 +121,10 @@ void mouseReleased(MouseEvent e) {
@Override
void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case PConstants.ESC : // Pause
case PConstants.ESC: // Pause
game.returnScene();
break;
default :
default:
break;
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/project_16x16/scene/ControlsSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void switchTo() {

@Override
public void drawUI() {
game.background(Constants.Colors.MENU_GREY);
displayWindow();
apply.display();
quit.display();

Expand All @@ -99,6 +99,15 @@ public void drawUI() {
game.text("Press a key to change the control!", game.width / 2, 100);
}
}

private void displayWindow() {
background(19, 23, 35);
applet.fill(29, 33, 45);
applet.stroke(47, 54, 73);
applet.strokeWeight(8);
applet.rect(applet.gameResolution.x / 2, applet.gameResolution.y / 2, applet.gameResolution.x * 0.66f - 8,
applet.gameResolution.y - 8);
}

@Override
void mouseReleased(MouseEvent e) {
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/project_16x16/scene/GraphicsSettings.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package project_16x16.scene;

import processing.core.PApplet;
import processing.core.PConstants;
import processing.event.KeyEvent;
import processing.event.MouseEvent;
import project_16x16.Audio;
import project_16x16.Constants;
import project_16x16.Options;
import project_16x16.Options.Option;
import project_16x16.SideScroller;
import project_16x16.ui.Button;
import project_16x16.ui.Notifications;
import project_16x16.ui.Slider;

public final class GraphicsSettings extends PScene {

Expand All @@ -37,18 +31,23 @@ public GraphicsSettings(SideScroller a) {

@Override
public void switchTo() {
// TODO properly align audio value and slider position
//volumeBGM.setValue(PApplet.map(originalVolumeBGM, -60, 0, 0, 1));
//volumeSFX.setValue(PApplet.map(originalVolumeSFX, -60, 0, 0, 1));
super.switchTo();
}

@Override
public void drawUI() {
game.background(Constants.Colors.MENU_GREY);
displayWindow();
apply.display();
quit.display();

}

private void displayWindow() {
background(19, 23, 35);
applet.fill(29, 33, 45);
applet.stroke(47, 54, 73);
applet.strokeWeight(8);
applet.rect(applet.gameResolution.x / 2, applet.gameResolution.y / 2, applet.gameResolution.x * 0.66f - 8,
applet.gameResolution.y - 8);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/project_16x16/scene/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class MainMenu extends PScene {

public Button pressStart;
public Button pressQuit;
public Button pressSettings; // TODO add settings menu
public Button pressSettings;
public Button pressMultiplayer;

private SideScroller game;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/project_16x16/scene/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void drawUI() {
applet.fill(255);
applet.textSize(60);
applet.textAlign(CENTER, TOP);
applet.text("Options", applet.gameResolution.x / 2, 20);
applet.text("Settings", applet.gameResolution.x / 2, 20);

quit.display();
apply.display();
Expand Down

0 comments on commit d51f5cb

Please sign in to comment.