Rev 192 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 155 | chris | 1 | package com.gebauz.Bauzoid.gamestates; |
| 2 | |||
| 184 | chris | 3 | import com.gebauz.Bauzoid.app.Game; |
| 185 | chris | 4 | import com.gebauz.Bauzoid.app.GameObject; |
| 192 | chris | 5 | import com.gebauz.Bauzoid.math.Vector4; |
| 184 | chris | 6 | |
| 192 | chris | 7 | /** Game state base class. */ |
| 185 | chris | 8 | public abstract class BaseGameState extends GameObject |
| 156 | chris | 9 | { |
| 192 | chris | 10 | private Vector4 mFadeInColor = new Vector4(0, 0, 0, 0); |
| 11 | private Vector4 mFadeOutColor = new Vector4(0, 0, 0, 0); |
||
| 12 | private boolean mDoFadeIn = true; |
||
| 13 | private boolean mDoFadeOut = true; |
||
| 14 | |||
| 15 | /** Constructor. */ |
||
| 184 | chris | 16 | public BaseGameState(Game game) |
| 156 | chris | 17 | { |
| 184 | chris | 18 | super(game); |
| 156 | chris | 19 | } |
| 20 | |||
| 192 | chris | 21 | /** Called when game state is initialized. */ |
| 159 | chris | 22 | public abstract void init(); |
| 156 | chris | 23 | |
| 192 | chris | 24 | /** Called when game state is exited and destroyed. */ |
| 159 | chris | 25 | public abstract void exit(); |
| 156 | chris | 26 | |
| 192 | chris | 27 | /** Update game logic. */ |
| 159 | chris | 28 | public abstract void update(float deltaTime); |
| 156 | chris | 29 | |
| 192 | chris | 30 | /** Update game logic during fading for animations that may continue even during fading. */ |
| 159 | chris | 31 | public void updateFading(float deltaTime) {} |
| 156 | chris | 32 | |
| 192 | chris | 33 | /** Render the game. */ |
| 159 | chris | 34 | public abstract void render(); |
| 156 | chris | 35 | |
| 192 | chris | 36 | /** Called when the surface has been destroyed and recreated. */ |
| 160 | chris | 37 | public void onSurfaceChanged(int w, int h) {} |
| 38 | |||
| 192 | chris | 39 | /** Check if the specific game state requires fading in. */ |
| 40 | public final boolean doFadeIn() |
||
| 156 | chris | 41 | { |
| 192 | chris | 42 | return mDoFadeIn; |
| 156 | chris | 43 | } |
| 44 | |||
| 192 | chris | 45 | /** Check if the specific game state requires fading out. */ |
| 46 | public final boolean doFadeOut() |
||
| 156 | chris | 47 | { |
| 192 | chris | 48 | return mDoFadeOut; |
| 156 | chris | 49 | } |
| 192 | chris | 50 | |
| 51 | /** Set fading modes. */ |
||
| 52 | public final void setFading(boolean fadeIn, boolean fadeOut) |
||
| 53 | { |
||
| 54 | mDoFadeIn = fadeIn; |
||
| 55 | mDoFadeOut = fadeOut; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** Set fade in color. */ |
||
| 59 | public final void setFadeInColor(Vector4 fadeInColor) |
||
| 60 | { |
||
| 61 | mFadeInColor = fadeInColor; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** Get fade in color. */ |
||
| 65 | public final Vector4 getFadeInColor() |
||
| 66 | { |
||
| 67 | return mFadeInColor; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** Set fade out color. */ |
||
| 71 | public final void setFadeOutColor(Vector4 fadeOutColor) |
||
| 72 | { |
||
| 73 | mFadeOutColor = fadeOutColor; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** Get fade out color. */ |
||
| 77 | public final Vector4 getFadeOutColor() |
||
| 78 | { |
||
| 79 | return mFadeOutColor; |
||
| 80 | } |
||
| 81 | |||
| 155 | chris | 82 | } |
| 156 | chris | 83 | |
| 84 |