Rev 200 | Go to most recent revision | 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; |
||
| 5 | import com.gebauz.Bauzoid.math.Vector4; |
||
| 6 | |||
| 7 | /** Game state base class. */ |
||
| 8 | public abstract class BaseGameState extends GameObject |
||
| 9 | { |
||
| 10 | private Vector4 mFadeInColor = new Vector4(0, 0, 0, 0); |
||
| 11 | private Vector4 mFadeOutColor = new Vector4(0, 0, 0, 0); |
||
| 220 | chris | 12 | private boolean mDoFadeIn = false; |
| 13 | private boolean mDoFadeOut = false; |
||
| 200 | chris | 14 | |
| 15 | /** Constructor. */ |
||
| 16 | public BaseGameState(Game game) |
||
| 17 | { |
||
| 18 | super(game); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** Called when game state is initialized. */ |
||
| 22 | public abstract void init(); |
||
| 23 | |||
| 24 | /** Called when game state is exited and destroyed. */ |
||
| 25 | public abstract void exit(); |
||
| 26 | |||
| 27 | /** Update game logic. */ |
||
| 28 | public abstract void update(float deltaTime); |
||
| 29 | |||
| 30 | /** Update game logic during fading for animations that may continue even during fading. */ |
||
| 31 | public void updateFading(float deltaTime) {} |
||
| 32 | |||
| 33 | /** Render the game. */ |
||
| 34 | public abstract void render(); |
||
| 35 | |||
| 36 | /** Called when the surface has been destroyed and recreated. */ |
||
| 37 | public void onSurfaceChanged(int w, int h) {} |
||
| 38 | |||
| 39 | /** Check if the specific game state requires fading in. */ |
||
| 40 | public final boolean doFadeIn() |
||
| 41 | { |
||
| 42 | return mDoFadeIn; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** Check if the specific game state requires fading out. */ |
||
| 46 | public final boolean doFadeOut() |
||
| 47 | { |
||
| 48 | return mDoFadeOut; |
||
| 49 | } |
||
| 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 | |||
| 82 | } |
||
| 83 | |||
| 84 |