Back to project page candy-drop.
The source code is released under:
Copyright (c) 2014, Gregory Martin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project candy-drop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gregfmartin.facetapper.entities; // www . j ava2s . c o m import android.util.Log; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.scenes.scene2d.Stage; import com.gregfmartin.facetapper.GameCore; import com.gregfmartin.facetapper.utils.*; import java.util.Locale; /** * Custom implementation of {@link com.badlogic.gdx.Screen} that automatically implements and appropriately places * calls to methods from {@link com.gregfmartin.facetapper.utils.StagePrep}. Any classes in the screens package will * inherit from this implementation. */ public class Screen implements com.badlogic.gdx.Screen, StagePrep, CoreUtil { // Used for reporting issues through DDMS static final private String TAG = Screen.class.getSimpleName(); // Reference to the current GameCore instance protected GameCore mGameCoreRef; // Root node in the Scene Graph protected Stage mStage; /** * Does nothing. Shouldn't be used. Exists more to keep Lint from being an asshole. */ public Screen() { } public Screen(GameCore gameCore) { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: Non-default Constructor Encountered", Screen.class.getCanonicalName())); } if(null == gameCore) { if(DevSettings.DEBUG) { // Log.e(TAG, "Screen Constructor :: Argument gameCore cannot be null!"); Log.e(TAG, String.format(Locale.US, "%s :: Argument gameCore cannot be null!", Screen.class.getCanonicalName())); } } mGameCoreRef = gameCore; castingCall(); rehearsal(); } @Override public void render(float delta) { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: render Encountered", Screen.class.getCanonicalName())); } logic(delta); draw(delta); } @Override public void resize(int width, int height) { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: resize Encountered", Screen.class.getCanonicalName())); } } @Override public void show() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: show Encountered", Screen.class.getCanonicalName())); } } @Override public void hide() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: hide Encountered", Screen.class.getCanonicalName())); } } @Override public void pause() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: pause Encountered", Screen.class.getCanonicalName())); } } @Override public void resume() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: resume Encountered", Screen.class.getCanonicalName())); } } @Override public void dispose() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: dispose Encountered", Screen.class.getCanonicalName())); } mStage.dispose(); } @Override public void castingCall() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: castingCall Encountered", Screen.class.getCanonicalName())); } mStage = new Stage(); Gdx.input.setInputProcessor(mStage); } @Override public void rehearsal() { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: rehearsal Encountered", Screen.class.getCanonicalName())); } } @Override public void logic(float delta) { if(DevSettings.DEBUG) { Log.i(TAG, String.format(Locale.US, "%s :: logic Encountered", Screen.class.getCanonicalName())); } mStage.act(delta); } @Override public void draw(float delta) { Gl20Utils.glClearColour(Colour.WHITE); mStage.draw(); } }