Skip to content

Commit 2a9ec34

Browse files
committed
Fixed died screen
1 parent 5e8cdc3 commit 2a9ec34

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

src/main/java/ml/sakii/factoryisland/AssetLibrary.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class AssetLibrary {
2626
public static BufferedImage StandardBG, FreezeBG;
2727
public static BufferedImage PausedBG, PausedTitle;
2828
public static BufferedImage SettingsTitle;
29+
public static BufferedImage DeadTitle;
2930

3031

3132
public static void load() {
@@ -34,6 +35,7 @@ public static void load() {
3435

3536
SettingsTitle = loadTexture("textures/settings_title.png");
3637
PausedTitle = loadTexture("textures/paused_title.png");
38+
DeadTitle = loadTexture("textures/dead_title.png");
3739
StandardBG = loadTexture("textures/BG.png");
3840
Logo = loadTexture("textures/logo.png");
3941
MainMenuBG = loadTexture("textures/mainmenu.png");

src/main/java/ml/sakii/factoryisland/Game.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public class Game extends JPanel implements KeyListener, MouseListener, MouseWhe
9292
VolatileImage VolatileFrameBuffer;
9393
BufferedImage FrameBuffer;
9494
BufferedImage prevFrame;
95-
private BufferedImageOp op;
95+
private BufferedImageOp pauseOp, deadOp;
9696

9797

9898
private BlockFace SelectedFace;
@@ -281,10 +281,15 @@ private void init()
281281
resizeScreen(Config.getWidth(), Config.getHeight());
282282

283283

284-
op = new RescaleOp(
284+
pauseOp = new RescaleOp(
285285
new float[]{0.2f, 0.2f, 0.2f, 1f}, // scale factors for red, green, blue, alpha
286286
new float[]{0, 0, 0, 0}, // offsets for red, green, blue, alpha
287287
null);
288+
289+
deadOp = new RescaleOp(
290+
new float[]{4f, 0.6f, 0.6f, 1f}, // scale factors for red, green, blue, alpha
291+
new float[]{0, 0, 0, 0}, // offsets for red, green, blue, alpha
292+
null);
288293

289294
try
290295
{
@@ -1297,9 +1302,18 @@ private void pauseTo(String UiName) {
12971302
}else if(Config.renderMethod == RenderMethod.VOLATILE){
12981303
BufferedImage tmp = new BufferedImage(VolatileFrameBuffer.getWidth(),VolatileFrameBuffer.getHeight(),BufferedImage.TYPE_INT_ARGB);
12991304
tmp.getGraphics().drawImage(VolatileFrameBuffer, 0,0,tmp.getWidth(), tmp.getHeight(), null);
1300-
AssetLibrary.FreezeBG = op.filter(tmp, null);
1305+
1306+
if(UiName=="died") {
1307+
AssetLibrary.FreezeBG = deadOp.filter(tmp, null);
1308+
}else {
1309+
AssetLibrary.FreezeBG = pauseOp.filter(tmp, null);
1310+
}
13011311
}else {
1302-
AssetLibrary.FreezeBG = op.filter(FrameBuffer, null);
1312+
if(UiName=="died") {
1313+
AssetLibrary.FreezeBG = deadOp.filter(FrameBuffer, null);
1314+
}else {
1315+
AssetLibrary.FreezeBG = pauseOp.filter(FrameBuffer, null);
1316+
}
13031317
}
13041318
if (Engine.isSingleplayer()) { // ezek multiplayerben nem allhatnak le
13051319
//Engine.ticker.stop();

src/main/java/ml/sakii/factoryisland/screens/DeadGUI.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ml.sakii.factoryisland.screens;
22

3+
import java.awt.Graphics;
34
import java.awt.event.ActionEvent;
45
import java.awt.event.ActionListener;
56
import java.awt.event.ComponentAdapter;
@@ -10,11 +11,13 @@
1011
import javax.swing.JButton;
1112

1213
import ml.sakii.factoryisland.AssetLibrary;
14+
import ml.sakii.factoryisland.Config;
1315
import ml.sakii.factoryisland.GUIManager;
1416
import ml.sakii.factoryisland.Main;
17+
import ml.sakii.factoryisland.RenderMethod;
1518
import ml.sakii.factoryisland.screens.components.Button;
1619

17-
public class DeadGUI extends PaintedScreen implements ActionListener, KeyListener {
20+
public class DeadGUI extends TexturedScreen implements ActionListener, KeyListener {
1821
private static final long serialVersionUID = 334783618749307739L;
1922

2023
private JButton respawnButton, exitButton;
@@ -40,7 +43,7 @@ public void componentShown( ComponentEvent e ) {
4043
add(respawnButton);
4144

4245

43-
exitButton = new Button("Save & Exit to Main Menu",Main.Width/2-EntryWidth/2, (int)(Main.Height/3.4+EntrySpacing-EntryHeight/2), EntryWidth, EntryHeight);
46+
exitButton = new Button("Save & Exit to Main Menu",Main.Width/2-EntryWidth/2, (int)(Main.Height/3.4+EntrySpacing+EntryHeight-EntryHeight/2), EntryWidth, EntryHeight);
4447
exitButton.setActionCommand("exit");
4548
exitButton.setVisible(true);
4649
exitButton.addActionListener(this);
@@ -49,6 +52,24 @@ public void componentShown( ComponentEvent e ) {
4952

5053

5154

55+
}
56+
57+
@Override
58+
protected void paintComponent(Graphics g) {
59+
if(Config.renderMethod==RenderMethod.DIRECT || AssetLibrary.FreezeBG == AssetLibrary.StandardBG) { //utobbi akkor ha most valtott at directrol masra
60+
super.paintComponent(g);
61+
}else{
62+
g.drawImage(AssetLibrary.FreezeBG, 0, 0, this.getWidth(), this.getHeight(), null);
63+
64+
}
65+
66+
67+
int titleHeight = Main.Height/7;
68+
int titleWidth = titleHeight*AssetLibrary.DeadTitle.getWidth()/AssetLibrary.DeadTitle.getHeight();
69+
70+
g.drawImage(AssetLibrary.DeadTitle, Main.Width/2-titleWidth/2, Main.Height/15, titleWidth, titleHeight, null);
71+
72+
5273
}
5374

5475

60.8 KB
Loading

0 commit comments

Comments
 (0)