save game settings and parse them

This commit is contained in:
2025-12-12 11:34:01 +01:00
parent d294578a74
commit 099f52278c
6 changed files with 91 additions and 18 deletions

View File

@@ -28,11 +28,11 @@ public class GamePanel extends JPanel implements Runnable {
public final int screenHeight = tileSize * maxScreenRow; // 576 pixels
// FULLSCREEN SETTINGS
public boolean fullscreen;
int fScreenWidth = screenWidth;
int fScreenHeight = screenHeight;
BufferedImage tempScreen;
Graphics2D fg2;
public boolean fullscreen;
// WORLD SETTINGS
public final int maxWorldCol = 50;
@@ -50,8 +50,9 @@ public class GamePanel extends JPanel implements Runnable {
public AssetSetter assetSetter = new AssetSetter(this);
public UI ui = new UI(this);
public EventHandler eventH = new EventHandler(this);
public Sound se = new Sound();
public Sound sfx = new Sound();
public Sound music = new Sound();
public Config config = new Config(this);
Thread gameThread;
// ENTITY AND OBJECT
@@ -211,9 +212,9 @@ public class GamePanel extends JPanel implements Runnable {
music.stop();
}
public void playSE(int i) {
Clip c = se.clips[i];
se.fc = (FloatControl) c.getControl(FloatControl.Type.MASTER_GAIN);
se.checkVolume();
Clip c = sfx.clips[i];
sfx.fc = (FloatControl) c.getControl(FloatControl.Type.MASTER_GAIN);
sfx.checkVolume();
if(c.isRunning()) c.stop();
c.setFramePosition(0);
c.start();
@@ -230,7 +231,7 @@ public class GamePanel extends JPanel implements Runnable {
tempScreen = new BufferedImage(screenWidth, screenHeight, BufferedImage.TYPE_INT_RGB);
fg2 = (Graphics2D) tempScreen.getGraphics();
//setFullscreen();
if(fullscreen) setFullscreen();
}
public void setFullscreen() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();