-
Notifications
You must be signed in to change notification settings - Fork 0
/
Drawables.java
executable file
·106 lines (96 loc) · 3.18 KB
/
Drawables.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*******************************************************************************
* Copyright (C) 2019-2020 ROMAINPC
* Copyright (C) 2019-2020 Picachoc
*
* This file is part of PICROM-Wars
*
* PICROM-Wars is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PICROM-Wars is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package picrom.utils;
import javafx.scene.image.Image;
/**
* Class for load all game pictures.
*/
public class Drawables {
public static Image worldBackground;
public static Image infosBackground;
public static Image circled;
public static Image hammer;
public static Image crown;
public static Image treasure;
public static Image door_close;
public static Image door_open;
public static EntityAssets castle;
public static Image castle_s;
public static Image castle_e;
public static Image castle_w;
public static EntityAssets onager;
public static EntityAssets knight;
public static EntityAssets pikeman;
/**
* Constructor, instantiate it to load pictures in Image object.
*
* @see javafx.scene.image.Image
*/
public Drawables() {
worldBackground = new Image("Drawables/world_background.png");
infosBackground = new Image("Drawables/infos_background.png");
circled = new Image("Drawables/circled.png");
hammer = new Image("Drawables/hammer.png");
crown = new Image("Drawables/crown.png");
treasure = new Image("Drawables/treasure.png");
door_close = new Image("Drawables/door_close.png");
door_open = new Image("Drawables/door_open.png");
castle = new EntityAssets("castle");
castle_s = new Image("Drawables/castle_s.png");
castle_e = new Image("Drawables/castle_e.png");
castle_w = new Image("Drawables/castle_w.png");
onager = new EntityAssets("onager");
knight = new EntityAssets("knight");
pikeman = new EntityAssets("pikeman");
}
/**
* Usefull class for Entity. Combine two Image for showing Entity.
*
* @see picrom.entity.Entity
* @see Drawables
*/
public class EntityAssets {
private Image image;
private Image mask;
/**
* Constructor, load Images from file.
*
* @param name Name of the file to laod. (exemple AAA if files are AAA.png and
* AAA_mask.png)
*/
private EntityAssets(String name) {
image = new Image("Drawables/" + name + ".png");
mask = new Image("Drawables/" + name + "_mask.png");
}
/**
* @return The main Image to show an entity.
*/
public Image getImage() {
return image;
}
/**
* @return A second Image, only white and transparent, which will be colored and
* superposed on the main Image.
*/
public Image getMask() {
return mask;
}
}
}