Skip to content

Commit a70c2f2

Browse files
Merge pull request #71 from ArtifactForms/working2
Loading screen test.
2 parents 1dc5fa9 + a9a0dba commit a70c2f2

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package engine.ui;
2+
3+
import engine.components.AbstractComponent;
4+
import engine.components.RenderableComponent;
5+
import math.Color;
6+
import workspace.ui.Graphics;
7+
8+
public class LoadingScreen extends AbstractComponent implements RenderableComponent {
9+
10+
private boolean visible = true;
11+
12+
@Override
13+
public void onAttach() {
14+
// TODO Auto-generated method stub
15+
16+
}
17+
18+
@Override
19+
public void onDetach() {
20+
// TODO Auto-generated method stub
21+
22+
}
23+
24+
@Override
25+
public void render(Graphics g) {
26+
if (!visible) return;
27+
28+
String text = "Scene is LOADING... Hang on!";
29+
float width = g.textWidth(text);
30+
float x = (g.getWidth() - width) / 2f;
31+
float y = (g.getHeight() - g.getTextSize()) / 2f;
32+
33+
g.setColor(Color.BLACK);
34+
g.fillRect(0, 0, g.getWidth(), g.getHeight());
35+
g.setColor(Color.WHITE);
36+
g.text(text, x, y);
37+
}
38+
39+
@Override
40+
public void onUpdate(float tpf) {
41+
// TODO Auto-generated method stub
42+
43+
}
44+
45+
public void hide() {
46+
visible = false;
47+
}
48+
}

0 commit comments

Comments
 (0)