Rev 739 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 367 | chris | 1 | package com.gebauz.PonPonChun; |
| 2 | |||
| 3 | import com.gebauz.Bauzoid.app.BauzoidApp; |
||
| 674 | chris | 4 | import com.gebauz.Bauzoid.game.Game.IGameFactory; |
| 370 | chris | 5 | import com.gebauz.PonPonChun.PonPonChunCustomServices; |
| 6 | import com.gebauz.PonPonChun.game.GameConsts; |
||
| 367 | chris | 7 | |
| 434 | chris | 8 | public class PonPonChunApp extends BauzoidApp |
| 367 | chris | 9 | { |
| 578 | chris | 10 | |
| 11 | private String mFpsString; |
||
| 12 | private String mFrameTimeString; |
||
| 13 | private float mFpsUpdateTimer = 1.0f; |
||
| 14 | |||
| 676 | chris | 15 | public PonPonChunApp(boolean adsEnabled) |
| 16 | { |
||
| 17 | this(adsEnabled, null); |
||
| 18 | } |
||
| 19 | |||
| 674 | chris | 20 | public PonPonChunApp(boolean adsEnabled, IGameFactory gameFactory) |
| 367 | chris | 21 | { |
| 674 | chris | 22 | super("Pon-Pon Chun", adsEnabled, gameFactory); |
| 559 | chris | 23 | } |
| 367 | chris | 24 | |
| 25 | @Override |
||
| 26 | public void initGame() |
||
| 27 | { |
||
| 28 | // Global initializations |
||
| 372 | chris | 29 | mGame.setCustomServices(new PonPonChunCustomServices(mGame)); |
| 370 | chris | 30 | |
| 31 | mGame.getInput().setVirtualSize(GameConsts.VIRTUAL_SCREEN_WIDTH, GameConsts.VIRTUAL_SCREEN_HEIGHT); |
||
| 32 | |||
| 480 | chris | 33 | mGame.getGameStateManager().setDefaultPackage(this.getClass().getPackage().getName() + ".gamestates"); |
| 593 | chris | 34 | mGame.getGameStateManager().setLoadingScreen(new LoadingScreen(mGame)); |
| 526 | chris | 35 | |
| 36 | String initialState = mGame.getSettings().getSetting("initstate"); |
||
| 37 | String stateParams = mGame.getSettings().getSetting("state_param"); |
||
| 38 | mGame.getGameStateManager().switchTo(initialState, stateParams); |
||
| 472 | chris | 39 | //mGame.getGameStateManager().switchTo(com.gebauz.PonPonChun.gamestates.EndlessState.class, ""); |
| 530 | chris | 40 | |
| 41 | // Global sounds. |
||
| 42 | mGame.getAudio().newManagedSound("data/sounds/menu_push.wav"); |
||
| 43 | mGame.getAudio().newManagedSound("data/sounds/menu_click.wav"); |
||
| 610 | chris | 44 | mGame.getAudio().newManagedSound("data/sounds/menu_confirm.wav"); |
| 578 | chris | 45 | |
| 46 | mFpsString = String.format("%.2ffps", mGame.getFps()); |
||
| 47 | mFrameTimeString = String.format("%.4fms", mGame.getFrameTime()); |
||
| 367 | chris | 48 | } |
| 49 | |||
| 50 | @Override |
||
| 51 | public void exitGame() |
||
| 52 | { |
||
| 578 | chris | 53 | } |
| 367 | chris | 54 | |
| 578 | chris | 55 | @Override |
| 591 | chris | 56 | public void render() |
| 578 | chris | 57 | { |
| 591 | chris | 58 | super.render(); |
| 59 | |||
| 60 | // TODO: put this in engine part |
||
| 762 | chris | 61 | /*if (mFpsUpdateTimer > 0.0f) |
| 578 | chris | 62 | { |
| 591 | chris | 63 | mFpsUpdateTimer -= mGame.getDeltaTime(); |
| 367 | chris | 64 | |
| 578 | chris | 65 | if (mFpsUpdateTimer <= 0.0f) |
| 66 | { |
||
| 593 | chris | 67 | mFpsString = String.format("%.2ffps", mGame.getFps()); |
| 68 | mFrameTimeString = String.format("%.4fms", mGame.getFrameTime()); |
||
| 578 | chris | 69 | |
| 70 | mFpsUpdateTimer = 1.0f; |
||
| 71 | } |
||
| 762 | chris | 72 | }*/ |
| 512 | chris | 73 | |
| 739 | chris | 74 | //PonPonChunCustomServices.getInstance().getFont().drawText(mFpsString, GameConsts.VIRTUAL_SCREEN_WIDTH - 100, 30, GameConsts.WHITE_COLOR); |
| 75 | //PonPonChunCustomServices.getInstance().getFont().drawText(mFrameTimeString, GameConsts.VIRTUAL_SCREEN_WIDTH - 100, 50, GameConsts.WHITE_COLOR); |
||
| 512 | chris | 76 | } |
| 77 | |||
| 367 | chris | 78 | |
| 79 | } |