summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java50
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
6package com.fourisland.fourpuzzle.gamestate.mapview;
7
8import com.fourisland.fourpuzzle.PuzzleApplication;
9import com.fourisland.fourpuzzle.util.ObjectLoader;
10import java.awt.Graphics;
11import java.awt.Image;
12import java.awt.image.BufferedImage;
13import java.util.HashMap;
14import java.util.Vector;
15
16/**
17 *
18 * @author hatkirby
19 */
20public 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}