diff options
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java')
-rw-r--r-- | src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java new file mode 100644 index 0000000..6eb40cc --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.fourpuzzle.gamestate.mapview; | ||
7 | |||
8 | import com.fourisland.fourpuzzle.PuzzleApplication; | ||
9 | import com.fourisland.fourpuzzle.util.ObjectLoader; | ||
10 | import java.awt.Graphics; | ||
11 | import java.awt.Image; | ||
12 | import java.awt.image.BufferedImage; | ||
13 | import java.util.HashMap; | ||
14 | import java.util.Vector; | ||
15 | |||
16 | /** | ||
17 | * | ||
18 | * @author hatkirby | ||
19 | */ | ||
20 | public abstract class ChipSet { | ||
21 | |||
22 | public abstract void initalize(); | ||
23 | |||
24 | private BufferedImage chipSetImage; | ||
25 | public BufferedImage getImage(int offset) | ||
26 | { | ||
27 | int sx = (offset % 8) * 16; | ||
28 | int sy = (offset / 8) * 16; | ||
29 | |||
30 | return chipSetImage.getSubimage(sx, sy, 16, 16); | ||
31 | } | ||
32 | |||
33 | public static ChipSet getChipSet(String chipSet) throws Exception | ||
34 | { | ||
35 | Class chipSetClass = Class.forName(PuzzleApplication.INSTANCE.getGamePackage() + ".gamedata.chipset." + chipSet); | ||
36 | Object chipSetObject = chipSetClass.newInstance(); | ||
37 | ChipSet temp = (ChipSet) chipSetObject; | ||
38 | temp.initalize(); | ||
39 | temp.chipSetImage = ObjectLoader.getImage("ChipSet", chipSet); | ||
40 | |||
41 | return temp; | ||
42 | } | ||
43 | |||
44 | private HashMap<Integer,ChipSetData> chipSetData = new HashMap<Integer,ChipSetData>(); //162 | ||
45 | public HashMap<Integer,ChipSetData> getChipSetData() | ||
46 | { | ||
47 | return chipSetData; | ||
48 | } | ||
49 | |||
50 | } | ||