DEADSOFTWARE

Initial commit.
[LongFlight.git] / src / code / kalter / longflight / space / Space.java
1 package code.kalter.longflight.space;
3 import java.io.IOException;
4 import javax.microedition.lcdui.Graphics;
6 /**
7 * Космос: звёзды, планеты и фон
8 *
9 * @author KalterFive
10 */
11 public class Space {
13 private static Space instance;
15 public static Space getInstance(int screenW, int screenH)
16 throws IOException {
17 if (instance == null) {
18 instance = new Space(screenW, screenH);
19 }
20 return instance;
21 }
23 private final Egg egg;
24 private final Tile tile;
25 private final Planet planet;
26 private final Star star;
28 private Space(int screenW, int screenH) throws IOException {
29 egg = new Egg("/gfx/ship/5.png", screenW, screenH);
30 tile = new Tile("/gfx/space/background.png", screenW, screenH);
31 planet = new Planet(screenW, screenH);
32 star = new Star(screenW, screenH);
33 }
35 public void paint(Graphics graphics) {
36 tile.paint(graphics);
37 planet.paint(graphics);
38 star.paint(graphics);
39 egg.paint(graphics);
40 }
42 public void update() {
43 planet.upd();
44 tile.upd();
45 star.upd();
46 egg.upd();
47 }
49 public void activateEgg() {
50 egg.activate();
51 }
53 public void deactivateEgg() {
54 egg.deactivate();
55 }
56 }