-
Notifications
You must be signed in to change notification settings - Fork 0
/
Babel.pde
67 lines (55 loc) · 1.71 KB
/
Babel.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Babel
import ddf.minim.*;
static StateManager stateManager;
static PFont font;
static PFont fontHUD;
static Minim minim;
//static AudioPlayer player;
void setup()
{
size( 800, 600 );
frameRate( 30 );
minim = new Minim( this );
font = loadFont( "Sreda-48.vlw" );
fontHUD = loadFont( "Signika-Regular-24.vlw" );
stateManager = new StateManager();
stateManager.switchState( StateManager.STATE_MENU, false );
//stateManager.switchState( StateManager.STATE_DUNGEON, false );
//stateManager.switchState( StateManager.STATE_ENDING, false );
}
void mousePressed()
{
if ( stateManager.currentState != null )
stateManager.currentState.handleMouse();
}
void draw()
{
//if ( stateManager.currentState != null )
//{
// stateManager.currentState.handleKeys();
// stateManager.currentState.update();
// stateManager.currentState.draw();
//}
stateManager.currentState.handleKeys();
stateManager.currentState.update();
stateManager.currentState.draw();
if ( stateManager.transitioning )
{
//println("A");
tint( 255, stateManager.transitionAlpha );
stateManager.nextState.renderAlpha = stateManager.transitionAlpha;
stateManager.nextState.draw();
//noTint();
stateManager.transitionAlpha += 10;
if ( stateManager.transitionAlpha > 255 )
{
stateManager.transitionAlpha = 255;
stateManager.transitioning = false;
stateManager.transitionAlpha = 0;
stateManager.currentState = stateManager.nextState;
stateManager.nextState = null;
println( "Transition Ready" );
}
noTint();
}
}