-
Notifications
You must be signed in to change notification settings - Fork 53
/
Screen.pde
executable file
·48 lines (42 loc) · 1.1 KB
/
Screen.pde
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
/**
* Every thing in 2D sprite games happens in "Screen"s.
* Some screens are menus, some screens are levels, but
* the most generic class is the Screen class
*/
abstract class Screen {
// is this screen locked, or can it be swapped out?
boolean swappable = false;
// level dimensions
float width, height;
/**
* simple Constructor
*/
Screen(float _width, float _height) {
width = _width;
height = _height;
}
/**
* allow swapping for this screen
*/
void setSwappable() {
swappable = true;
}
/**
* draw the screen
*/
abstract void draw();
/**
* perform any cleanup when this screen is swapped out
*/
abstract void cleanUp();
/**
* passthrough events
*/
abstract void keyPressed(char key, int keyCode);
abstract void keyReleased(char key, int keyCode);
abstract void mouseMoved(int mx, int my);
abstract void mousePressed(int mx, int my, int button);
abstract void mouseDragged(int mx, int my, int button);
abstract void mouseReleased(int mx, int my, int button);
abstract void mouseClicked(int mx, int my, int button);
}