99ab8307cfafa261987bf88746677173d7ce653e
1 package code
.kalter
.longflight
.space
;
3 import code
.kalter
.longflight
.Loader
;
4 import code
.kalter
.longflight
.LongFlight
;
5 import java
.io
.IOException
;
6 import javax
.microedition
.lcdui
.Graphics
;
7 import javax
.microedition
.lcdui
.Image
;
16 private final Image tile
;
17 private final int screenW
;
18 private final int screenH
;
19 private final int widthOfTile
;
20 private final int heightOfTile
;
21 private int positionY
;
23 public Tile(Image tile
, int screenW
, int screenH
) {
25 this.screenW
= screenW
;
26 this.screenH
= screenH
;
27 this.widthOfTile
= tile
.getWidth();
28 this.heightOfTile
= tile
.getHeight();
29 this.positionY
= -128;
32 public Tile(String path
, int screenW
, int screenH
) throws IOException
{
33 this(Loader
.getInstance().getImage(path
), screenW
, screenH
);
36 public void paint(Graphics graph
) {
37 for (int x
= 0; x
< screenW
; x
+= widthOfTile
) {
38 for (int y
= positionY
; y
< screenH
; y
+= heightOfTile
) {
39 graph
.drawImage(tile
, x
, y
, 0);
45 if ((positionY
++) > 0) {