blob: ba4410429d5f3e15c2c7be19961fa832964c5608 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*
* Jesse Morgan <jesterpm@u.washington.edu>
*
* TCSS 305 - Autumn 2009
* Tetris Project
* 17 November 2009
*/
package tetris.gui.images;
import java.awt.Image;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* Enumeration of the various image resources.
*
* @author Jesse Morgan <jesterpm@u.washington.edu>
* @version 1.0 23 November 2009
*/
public final class ImageRes {
/**
* Game board background image.
*/
public static final String GAME_BACKGROUND = "background.png";
/**
* Game over board background image.
*/
public static final String GAMEOVER_BACKGROUND = "gameover_background.png";
/**
* Tetris block.
*/
public static final String TETRIS_BLOCK = "square.png";
/**
* Game Over wording.
*/
public static final String GAME_OVER_LABEL = "gameover.png";
/**
* Game Over wording.
*/
public static final String PAUSED_LABEL = "paused.png";
/**
* Writing Pencil.
*/
public static final String WRITING_PENCIL = "writing_pencil.png";
/**
* You're not allowed to create an instance of this class.
*/
private ImageRes() { }
/**
* Utility to handle loading an image.
*
* @param the_file The filename we need to load.
* @return The loaded Image or null if the image can't be loaded.
*/
public static Image loadImage(final String the_file) {
try {
return ImageIO.read(ImageRes.class.
getResourceAsStream(the_file));
} catch (final IOException the_exception) {
return null;
}
}
}
|