Last change
on this file since e5d2936 was ebd3538, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago |
Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.
|
-
Property mode
set to
100644
|
File size:
1.9 KB
|
Line | |
---|
1 | package main;
|
---|
2 |
|
---|
3 | import java.awt.Graphics;
|
---|
4 | import utils.DynamicImage;
|
---|
5 |
|
---|
6 | public class MapImage
|
---|
7 | {
|
---|
8 | int xDrawOffset;
|
---|
9 | int yDrawOffset;
|
---|
10 | int xSortOffset;
|
---|
11 | int ySortOffset;
|
---|
12 | DynamicImage img;
|
---|
13 | MapType type;
|
---|
14 | boolean needsBase;
|
---|
15 | int key;
|
---|
16 | static int lastKey;
|
---|
17 |
|
---|
18 | static {
|
---|
19 | MapImage.lastKey = -1;
|
---|
20 | }
|
---|
21 |
|
---|
22 | public MapImage(final DynamicImage img, final MapType type) {
|
---|
23 | this.xDrawOffset = 0;
|
---|
24 | this.yDrawOffset = 0;
|
---|
25 | this.xSortOffset = 0;
|
---|
26 | this.ySortOffset = 0;
|
---|
27 | this.needsBase = false;
|
---|
28 | this.img = img;
|
---|
29 | this.type = type;
|
---|
30 | ++MapImage.lastKey;
|
---|
31 | this.key = MapImage.lastKey;
|
---|
32 | }
|
---|
33 |
|
---|
34 | public static int nextKey() {
|
---|
35 | return MapImage.lastKey + 1;
|
---|
36 | }
|
---|
37 |
|
---|
38 | public MapType getType() {
|
---|
39 | return this.type;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public DynamicImage getImg() {
|
---|
43 | return this.img;
|
---|
44 | }
|
---|
45 |
|
---|
46 | public int getWidth() {
|
---|
47 | return this.img.getWidth();
|
---|
48 | }
|
---|
49 |
|
---|
50 | public int getHeight() {
|
---|
51 | return this.img.getHeight();
|
---|
52 | }
|
---|
53 |
|
---|
54 | public int getXSortOffset() {
|
---|
55 | return this.xSortOffset;
|
---|
56 | }
|
---|
57 |
|
---|
58 | public int getYSortOffset() {
|
---|
59 | return this.ySortOffset;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public void setDrawOffset(final int x, final int y) {
|
---|
63 | this.xDrawOffset = x;
|
---|
64 | this.yDrawOffset = y;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public void setSortOffset(final int x, final int y) {
|
---|
68 | this.xSortOffset = x;
|
---|
69 | this.ySortOffset = y;
|
---|
70 | }
|
---|
71 |
|
---|
72 | public boolean needsBase() {
|
---|
73 | return this.needsBase;
|
---|
74 | }
|
---|
75 |
|
---|
76 | public void setNeedsBase(final boolean needsBase) {
|
---|
77 | this.needsBase = needsBase;
|
---|
78 | }
|
---|
79 |
|
---|
80 | public int getKey() {
|
---|
81 | return this.key;
|
---|
82 | }
|
---|
83 |
|
---|
84 | public void draw(final Graphics g, final int x, final int y) {
|
---|
85 | this.img.draw(g, x + this.xDrawOffset, y + this.yDrawOffset);
|
---|
86 | }
|
---|
87 |
|
---|
88 | public void drawNoOffset(final Graphics g, final int x, final int y) {
|
---|
89 | this.img.draw(g, x, y);
|
---|
90 | }
|
---|
91 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.