Android Open Source - android_game_engine H U D






From Project

Back to project page android_game_engine.

License

The source code is released under:

GNU General Public License

If you think the Android project android_game_engine 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 org.es.engine.hud;
/*from   w  ww  . j ava2s.  c o m*/
import android.graphics.Canvas;
import android.view.MotionEvent;

import org.es.engine.graphics.drawable.DrawableElement;
import org.es.engine.graphics.utils.DrawingParam;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Cyril Leroux
 *         Created 02/03/14.
 */
public class HUD implements DrawableElement {

    private final List<Control> mControls;

    public HUD() {
        mControls = new ArrayList<>();
    }

    public void addControl(Control control) {
        mControls.add(control);
    }

    @Override
    public void onUpdateSurfaceSize(int surfaceWidth, int surfaceHeight) { }

    @Override
    public void draw(Canvas canvas, DrawingParam param) {

        for (Control control : mControls) {
            control.draw(canvas);
        }
    }

    /**
     * Intercepts event sent by the drawing thread.
     * Returns true if the event is consumed. and false otherwise.
     * @param event the event to intercepts.
     * @return true if the event is consumed. False otherwise.
     */
    public boolean consumeEvent(MotionEvent event) {

        for (Control control : mControls) {
            if (control.consumeEvent(event)) {
                return true;
            }
        }

        return false;
    }

    @Override
    public float getPosX() { return 0; }

    @Override
    public float getPosY() { return 0; }

    @Override
    public void setPosition(float x, float y) { }

    @Override
    public void offsetPosition(float dx, float dy) { }

    @Override
    public float getWidth() { return 0; }

    @Override
    public float getHeight() { return 0; }
}




Java Source Code List

com.google.example.games.basegameutils.BaseGameActivity.java
com.google.example.games.basegameutils.GameHelperUtils.java
com.google.example.games.basegameutils.GameHelper.java
com.google.example.games.basegameutils.ScreenUtils.java
org.es.engine.audio.Sound.java
org.es.engine.game_mechanic.DrawingThread.java
org.es.engine.game_mechanic.DrawingView.java
org.es.engine.graphics.animation.AnimationCallback.java
org.es.engine.graphics.animation.Animation.java
org.es.engine.graphics.animation.BitmapAnimation.java
org.es.engine.graphics.animation.SpriteSheetAnimation.java
org.es.engine.graphics.drawable.DrawableElement.java
org.es.engine.graphics.sprite.GenericSprite.java
org.es.engine.graphics.sprite.SpriteSheet.java
org.es.engine.graphics.sprite.Sprite.java
org.es.engine.graphics.utils.DrawTextUtils.java
org.es.engine.graphics.utils.DrawingParam.java
org.es.engine.hud.Button.java
org.es.engine.hud.Control.java
org.es.engine.hud.HUD.java
org.es.engine.hud.Text.java
org.es.engine.hud.ToggleButton.java
org.es.engine.toolbox.pathfinding.Node.java
org.es.engine.toolbox.pathfinding.ShortestPath.java