File tree 1 file changed +48
-0
lines changed 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments