Subversion Repositories AndroidProjects

Rev

Rev 220 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
200 chris 1
package com.gebauz.Bauzoid.gamestates;
2
 
3
import com.gebauz.Bauzoid.app.Game;
4
import com.gebauz.Bauzoid.app.GameObject;
224 chris 5
import com.gebauz.Bauzoid.graphics.Graphics;
6
import com.gebauz.Bauzoid.graphics.renderstates.RenderStates;
200 chris 7
import com.gebauz.Bauzoid.math.Vector4;
8
 
9
/** Game state base class. */
10
public abstract class BaseGameState extends GameObject
11
{
12
        private Vector4 mFadeInColor = new Vector4(0, 0, 0, 0);
13
        private Vector4 mFadeOutColor = new Vector4(0, 0, 0, 0);
220 chris 14
        private boolean mDoFadeIn = false;
15
        private boolean mDoFadeOut = false;
200 chris 16
 
17
        /** Constructor. */
18
        public BaseGameState(Game game)
19
        {
20
                super(game);
21
        }
22
 
23
        /** Called when game state is initialized. */
24
        public abstract void init();
25
 
26
        /** Called when game state is exited and destroyed. */
27
        public abstract void exit();
28
 
29
        /** Update game logic. */
30
        public abstract void update(float deltaTime);
31
 
32
        /** Update game logic during fading for animations that may continue even during fading. */
33
        public void updateFading(float deltaTime) {}
34
 
35
        /** Render the game. */
36
        public abstract void render();
37
 
38
        /** Called when the surface has been destroyed and recreated. */
39
        public void onSurfaceChanged(int w, int h) {}
40
 
41
        /** Check if the specific game state requires fading in. */
42
        public final boolean doFadeIn()
43
        {
44
                return mDoFadeIn;
45
        }
46
 
47
        /** Check if the specific game state requires fading out. */
48
        public final boolean doFadeOut()
49
        {
50
                return mDoFadeOut;
51
        }
52
 
53
        /** Set fading modes. */
54
        public final void setFading(boolean fadeIn, boolean fadeOut)
55
        {
56
                mDoFadeIn = fadeIn;
57
                mDoFadeOut = fadeOut;
58
        }
59
 
60
        /** Set fade in color. */
61
        public final void setFadeInColor(Vector4 fadeInColor)
62
        {
63
                mFadeInColor = fadeInColor;
64
        }
65
 
66
        /** Get fade in color. */
67
        public final Vector4 getFadeInColor()
68
        {
69
                return mFadeInColor;
70
        }
71
 
72
        /** Set fade out color. */
73
        public final void setFadeOutColor(Vector4 fadeOutColor)
74
        {
75
                mFadeOutColor = fadeOutColor;
76
        }
77
 
78
        /** Get fade out color. */
79
        public final Vector4 getFadeOutColor()
80
        {
81
                return mFadeOutColor;
82
        }
83
 
224 chris 84
        /** Convenience getter. */
85
        public final Graphics getGraphics()
86
        {
87
                return getGame().getGraphics();
88
        }
89
 
90
        /** Convenience getter. */
91
        public final RenderStates getRenderStates()
92
        {
93
                return getGraphics().renderStates;
94
        }
95
 
200 chris 96
}
97
 
98