blob: 841eaa41df1c3c6dd3d918328d49a94e37c5ee83 (
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
39
|
/*
* 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)
{
CharSet temp = new CharSet();
temp.charSetImage = ObjectLoader.getImage("CharSet", charSet);
return temp;
}
}
|