1 package org.argosfields.image;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.argosfields.model.Tile;
6 import org.argosfields.resource.ResourceManager;
7 import org.eclipse.swt.graphics.Image;
8
9 /***
10 * TileImageSet.java
11 *
12 * @author Xavier Cho
13 * @version $Revision: 1.5 $ $Date: 2003/10/26 05:41:12 $
14 */
15 public final class TileImageSet extends ImageSet {
16 private static Log log = LogFactory.getLog(TileImageSet.class);
17
18 public static final int OVERLAY_SELECTED = 4;
19 public static final int OVERLAY_DESTINATION = 3;
20
21 private static TileImageSet instance;
22 private Image image;
23
24 private TileImageSet() {
25 if (log.isDebugEnabled()) {
26 String msg = "Loading tile image set...";
27 log.debug(msg);
28 }
29
30 ResourceManager resources = ResourceManager.getInstance();
31 this.image = resources.getImage("image.tiles");
32 }
33
34 public static TileImageSet getInstance() {
35 if (instance == null) {
36 synchronized (TileImageSet.class) {
37 instance = new TileImageSet();
38 }
39 }
40
41 return instance;
42 }
43
44 /***
45 * @see org.argosfields.image.ImageSet#dispose()
46 */
47 public void dispose() {
48 if (image != null) {
49 image.dispose();
50
51 if (log.isDebugEnabled()) {
52 log.debug("Tile image set has been disposed.");
53 }
54 }
55 }
56
57 /***
58 * @see org.argosfields.image.ImageSet#getIconWidth()
59 */
60 public final int getIconWidth() {
61 return Tile.WIDTH;
62 }
63
64 /***
65 * @see org.argosfields.image.ImageSet#getIconHeight()
66 */
67 public final int getIconHeight() {
68 return Tile.HEIGHT;
69 }
70
71 /***
72 * @see org.argosfields.image.ImageSet#getImage()
73 */
74 protected Image getImage() {
75 return image;
76 }
77
78 /***
79 * @see org.argosfields.image.ImageSet#getColumns()
80 */
81 public final int getColumns() {
82 return 24;
83 }
84
85 /***
86 * @see org.argosfields.image.ImageSet#getRows()
87 */
88 public final int getRows() {
89 return 16;
90 }
91 }
This page was automatically generated by Maven