Public Member Functions | |
String | getAppletInfo () |
Provides applet information text. | |
void | init () |
Applet initialization routine. | |
void | reset_game () |
Prepares all stuff for new game. | |
void | start () |
Starts a brand new game. | |
boolean | mouseDown (Event e, int x, int y) |
Evaluate mouse button press event and perform action according to current state of the game. | |
void | paint (Graphics g) |
Paint applet's window. | |
synchronized void | update (Graphics g) |
update applet's window. | |
Private Member Functions | |
boolean | is_empty (int x, int y) |
Queries is empty and there are no mine fields surrounding it. | |
void | revealcount (int x, int y) |
Uncovers a field specified by position. | |
void | zeroafter909 (int x, int y) |
Recursively uncover all adjoining empty fields starting at specified position. | |
void | do_draw (Graphics g) |
Repaint whole scene. | |
Private Attributes | |
Image | buffer |
Screen buffer. | |
Graphics | screen |
Screen destination. | |
byte[] | pground |
Battlefield. | |
Image[] | img |
Array containing all sprites. | |
boolean | fl_done |
Game state (true => game done). | |
int | screen_x |
Applet screen width. | |
int | screen_y |
Applet screen height. | |
int | bgcolor = 0xE0E0E0 |
Default background color. | |
int | nr_mines = 85 |
Number of mines in the game. | |
int | size_x = 30 |
Playground's width (number of cells). | |
int | size_y = 15 |
Playground's height (number of cells). | |
int | nr_uncovered = 0 |
Count of uncovered fields. | |
final byte | F_MINE = 9 |
Mine field. | |
final byte | B_UNCOVERED = 0x10 |
Uncovered field. | |
final byte | B_MARKED = 0x20 |
Marked field (mine suspection). | |
final byte | COUNT_MASK = 0x0F |
Low-nibble mask. It holds count of surrounding mines (0-8). | |
final byte | C_SIZE = 15 |
Cell size in pixels. |
Definition at line 11 of file minezj.java.
|
Repaint whole scene.
Definition at line 296 of file minezj.java. References B_MARKED, B_UNCOVERED, bgcolor, C_SIZE, COUNT_MASK, F_MINE, fl_done, img, nr_mines, nr_uncovered, pground, screen_x, screen_y, size_x, and size_y. Referenced by update(). |
|
Applet initialization routine. Acquires basic information and loads graphics from disk. Definition at line 40 of file minezj.java. References bgcolor, buffer, img, pground, screen, screen_x, screen_y, size_x, and size_y. |
|
Queries is empty and there are no mine fields surrounding it.
Definition at line 149 of file minezj.java. References pground, and size_x. Referenced by zeroafter909(). |
|
Evaluate mouse button press event and perform action according to current state of the game. In case that game is not running new one is started. In case that game runs left click reveals a field and right click toggles mine suspection flag.
Definition at line 221 of file minezj.java. References B_MARKED, B_UNCOVERED, C_SIZE, COUNT_MASK, F_MINE, fl_done, nr_mines, nr_uncovered, pground, reset_game(), size_x, size_y, and zeroafter909(). |
|
Paint applet's window.
Definition at line 275 of file minezj.java. References update(). |
|
Prepares all stuff for new game. Initializes needed variables, and generates new playground. Definition at line 67 of file minezj.java. References F_MINE, fl_done, nr_mines, nr_uncovered, pground, size_x, and size_y. Referenced by mouseDown(), and start(). |
|
Uncovers a field specified by position.
Definition at line 158 of file minezj.java. References B_UNCOVERED, COUNT_MASK, nr_uncovered, pground, and size_x. Referenced by zeroafter909(). |
|
update applet's window.
Definition at line 283 of file minezj.java. References buffer, do_draw(), and screen. Referenced by paint(). |
|
Recursively uncover all adjoining empty fields starting at specified position. This method may be called recursively.
Definition at line 170 of file minezj.java. References B_UNCOVERED, is_empty(), nr_uncovered, pground, revealcount(), size_x, and size_y. Referenced by mouseDown(). |