1 package code
.kalter
.longflight
.screen
;
3 import code
.kalter
.longflight
.Loader
;
4 import code
.kalter
.longflight
.LongFlight
;
5 import code
.kalter
.longflight
.Sprite
;
6 import java
.io
.IOException
;
7 import java
.util
.Random
;
8 import javax
.microedition
.lcdui
.Image
;
15 public class Splash
extends Screen
{
17 private final Random random
;
18 private final Sprite splash0
;
19 private final Sprite splash1
;
20 private long lastTime
;
22 public Splash() throws IOException
{
23 random
= new Random();
24 Loader loader
= Loader
.getInstance();
27 Image splash0Image
= loader
.getImage("/gfx/splash/0.png");
28 int splash0X
= (screenW
- splash0Image
.getWidth()) / 2;
29 int splash0Y
= (screenH
- splash0Image
.getHeight()) / 2;
30 splash0
= new Sprite(splash0Image
, splash0X
, splash0Y
);
33 Image splash1Image
= loader
.getImage("/gfx/splash/1.png");
34 int splash1X
= (screenW
- splash1Image
.getWidth()) / 2;
35 int splash1Y
= (screenH
- splash1Image
.getHeight()) / 2;
36 splash1
= new Sprite(splash1Image
, splash1X
, splash1Y
);
41 lastTime
= System
.currentTimeMillis();
47 while (getGameLoop()) {
50 space
.paint(graphics
);
51 long delta
= System
.currentTimeMillis() - lastTime
;
55 splash0
.paint(graphics
);
60 splash1
.paint(graphics
);
63 // painting white fucking effect
64 if ((delta
> 4000) && (delta
< 5000) || (delta
> 9000)) {
65 int c
= random
.nextInt(2) * 255;
66 graphics
.setColor((c
<< 16) | (c
<< 8) | c
);
67 graphics
.fillRect(0, 0, screenW
, screenH
);
70 // set screen menu and stop painting splash
72 LongFlight
.link
.setScreen(LongFlight
.MENU
);
76 LongFlight
.link
.sleep(20);