blob: b6e23d6757ec339853819a4ab40041a821aa7738 (
plain) (
blame)
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
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.fourisland.fourpuzzle.gamestate.mapview;
import com.fourisland.fourpuzzle.*;
import com.fourisland.fourpuzzle.util.ObjectLoader;
import java.awt.image.BufferedImage;
/**
*
* @author hatkirby
*/
public class CharSet {
private BufferedImage charSetImage;
private CharSet()
{
}
public BufferedImage getImage(int offset, Direction direction, int step)
{
int sx = ((offset % 4) * 72) + (step * 24);
int sy = ((offset / 4) * 128) + (direction.ordinal() * 32);
return charSetImage.getSubimage(sx, sy, 24, 32);
}
public static CharSet getCharSet(String charSet) throws Exception {
CharSet temp = new CharSet();
temp.charSetImage = ObjectLoader.getImage("CharSet", charSet);
return temp;
}
}
|