Android Open Source - game-api-android debug Object






From Project

Back to project page game-api-android.

License

The source code is released under:

MIT License

If you think the Android project game-api-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package testGames.gameEngineTest;
//from  w  ww .  j  av  a 2 s  .c om
import android.gameengine.icadroids.engine.GameEngine;
import android.gameengine.icadroids.objects.GameObject;
import android.gameengine.icadroids.objects.MoveableGameObject;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

/**
 * DebugObject is responsible the rendering of the (textual) debuginfo.
 * 
 * @author Bas van der Zandt
 * 
 */
public class debugObject extends GameObject {
  Paint pt = new Paint();
  Paint vierkanten = new Paint();
  public boolean renderGameObjects = false;
  public boolean renderTimers = false;
  public boolean renderObjectInfo = false;
  public MoveableGameObject gob;

  public debugObject() {
    pt.setColor(Color.BLACK);
    pt.setTextSize(18);
    vierkanten.setColor(Color.BLUE);
  }

  @Override
  public void update() {
    super.update();
  }

  @Override
  public void drawGameObject(Canvas canvas) {
    super.drawGameObject(canvas);
    if (renderGameObjects) {
      canvas.drawText("number of objects: " + GameEngine.items.size(),
          100, 80, pt);
      for (int i = 0; i < GameEngine.items.size(); i++) {
        canvas.drawText("Object: " + GameEngine.items.get(i), 100,
            100 + (i * 20), pt);
      }
    }
    if (renderTimers) {
      canvas.drawText(
          "Number of Alarms: " + GameEngine.gameAlarms.size(), 120,
          60, pt);
      for (int i = 0; i < GameEngine.gameAlarms.size(); i++) {
        canvas.drawText("Alarm: " + GameEngine.gameAlarms.get(i), 150,
            100 + (i * 20), pt);
      }
    }
    if (renderObjectInfo && gob != null) {

      canvas.drawRect(gob.getX() - 10, gob.getY() - 10,
          gob.getX() + gob.getFrameWidth() + 20,
          gob.getY() + gob.getFrameHeight() + 20, vierkanten);

      canvas.drawText("clicked GameObject: " + gob, 140, 60, pt);

      if (gob instanceof MoveableGameObject) {
        canvas.drawText("speed: " + gob.getSpeed(), 140, 80, pt);
        canvas.drawText("x: " + gob.getX() + " y: " + gob.getY(), 140,
            100, pt);
        canvas.drawText("xSpeed: " + gob.getxSpeed(), 140, 120, pt);
        canvas.drawText("ySpeed: " + gob.getySpeed(), 140, 140, pt);
        canvas.drawText("direction: " + gob.getDirection(), 140, 160,
            pt);
        canvas.drawText("friction: " + gob.getFriction(), 140, 180, pt);
        canvas.drawText("frameWidth: " + gob.getFrameWidth(), 140, 200,
            pt);
        canvas.drawText("frameHeight: " + gob.getFrameHeight(), 140,
            220, pt);
      }

    }
  }

}




Java Source Code List

android.gameengine.icadroids.alarms.Alarm.java
android.gameengine.icadroids.alarms.IAlarm.java
android.gameengine.icadroids.dashboard.DashboardImageView.java
android.gameengine.icadroids.dashboard.DashboardTextView.java
android.gameengine.icadroids.engine.GameEngine.java
android.gameengine.icadroids.engine.GameFPSCounter.java
android.gameengine.icadroids.engine.GameThread.java
android.gameengine.icadroids.engine.GameView.java
android.gameengine.icadroids.engine.Viewport.java
android.gameengine.icadroids.forms.GameForm.java
android.gameengine.icadroids.forms.IFormInput.java
android.gameengine.icadroids.forms.ViewCreator.java
android.gameengine.icadroids.forms.ViewRemover.java
android.gameengine.icadroids.input.MotionSensor.java
android.gameengine.icadroids.input.OnScreenButton.java
android.gameengine.icadroids.input.OnScreenButtons.java
android.gameengine.icadroids.input.TouchInput.java
android.gameengine.icadroids.objects.GameObject.java
android.gameengine.icadroids.objects.MoveableGameObject.java
android.gameengine.icadroids.objects.collisions.CollidingObject.java
android.gameengine.icadroids.objects.collisions.ICollision.java
android.gameengine.icadroids.objects.collisions.TileCollision.java
android.gameengine.icadroids.objects.graphics.AnimatedSprite.java
android.gameengine.icadroids.objects.graphics.Sprite.java
android.gameengine.icadroids.persistence.GamePersistence.java
android.gameengine.icadroids.sound.GameSound.java
android.gameengine.icadroids.sound.MusicPlayer.java
android.gameengine.icadroids.tiles.GameTiles.java
android.gameengine.icadroids.tiles.Tile.java
com.android.vissenspel.Monster.java
com.android.vissenspel.StrawberryControler.java
com.android.vissenspel.Strawberry.java
com.android.vissenspel.Vis.java
com.android.vissenspel.Vissenkom.java
game.MyAndroidGame.java
testGames.AndroidCraft_demo.java
testGames.FormTest.java
testGames.Player.java
testGames.TestGameBas.java
testGames.TestGameLex.java
testGames.TestGameRoel.java
testGames.gameEngineTest.DebugEngine.java
testGames.gameEngineTest.GameEngineTestGame.java
testGames.gameEngineTest.TestGameObject.java
testGames.gameEngineTest.debugObject.java
testGames.gameEngineTest.randomObject.java
testGames.testGameObjectBas.java
testGames.testGame.java