-
Notifications
You must be signed in to change notification settings - Fork 1
/
LoadingScreen.java
99 lines (78 loc) · 2.28 KB
/
LoadingScreen.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import javax.imageio.ImageIO;
import java.io.File;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D;
public class LoadingScreen extends Screen implements Runnable{
private BufferedImage loadingImage;
private String loadingText;
public static final int RES_WIDTH = 600;
public static final int RES_HEIGHT = 400;
public LoadingScreen(Window gw, int width, int height){
super(gw,width,height);
try{
loadingImage = ImageIO.read(new File("loadingscreen/loading.png"));
}catch(Exception e){e.printStackTrace();}
input = new InputLoading(gw,this);
loadingText = "Loading assets...";
}
public void loadAssets(){
loadingText = "Loading thing assets...";
Thing.loadAssets();
loadingText = "Loading lemmings assets...";
loadLemmingsAssets();
loadingText = "Loading items assets...";
loadItemsAssets();
loadingText = "Loading input assets...";
loadInputsAssets();
loadingText = "Loading game scene assets...";
GameScene.loadAssets();
}
public void loadLemmingsAssets(){
Lemmings.loadAssets();
Walker.loadAssets();
Stopper.loadAssets();
Digger.loadAssets();
Builder.loadAssets();
Basher.loadAssets();
Excavater.loadAssets();
Miner.loadAssets();
}
public void loadItemsAssets(){
Item.loadAssets();
Outside.loadAssets();
Spawner.loadAssets();
SpitFire.loadAssets();
}
public void loadInputsAssets(){
Input.loadAssets();
InputGame.loadAssets();
InputMainMenu.loadAssets();
InputMainMenu.loadAssets();
InputScore.loadAssets();
}
public void run(){
System.out.println("running");
loadAssets();
loadingText = "loading world...";
while(gw.getCurrentWorld() == null){
System.out.println("waiting for world");
try{
Thread.sleep(1000);
}catch(InterruptedException e){e.printStackTrace();}
}
System.out.println("moving to gamescene, game is ready to load");
gw.moveToGameScene();
}
/*public static void main(String[] args){
}*/
public void render(){
screenGraphics.drawImage(loadingImage,0,0,null);
screenGraphics.setColor(Color.white);
screenGraphics.setFont(new Font("default", Font.BOLD, 12));
screenGraphics.drawString(loadingText,40,360);
}
}