Android Open Source - YOGOSec G U I






From Project

Back to project page YOGOSec.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project YOGOSec 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 YOGOSec.core.gui;
/*  ww  w. jav a 2  s  . c  o m*/
import YOGOSec.core.render.Render;
import YOGOSec.core.util.Point2i;
import com.badlogic.gdx.Gdx;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author Aritz Lopez
 * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
 */
public abstract class GUI implements InputListener {

    protected final List<GUIComponent> components = Lists.newArrayList();

    public void render(Render render) {
        for (GUIComponent component : this.components) {
            component.render(render);
        }
    }

    @Override
    public boolean keyDown(int keycode) {
        for (GUIComponent component : this.components) component.keyDown(keycode);
        return false;
    }

    @Override
    public boolean keyUp(int keycode) {
        for (GUIComponent component : this.components) component.keyUp(keycode);
        return false;
    }

    @Override
    public boolean touchDown(Point2i point, int pointer, int button) {
        for (GUIComponent component : this.components) {
            component.touchDown(point, pointer, button);
        }
        return false;
    }

    @Override
    public boolean touchUp(Point2i point, int pointer, int button) {
        for (GUIComponent component : this.components) {
            component.touchUp(point, pointer, button);
        }
        return false;
    }

    @Override
    public boolean touchDragged(Point2i point, int pointer) {
        for (GUIComponent component : this.components) {
            component.touchDragged(point, pointer);
        }
        return false;
    }

    @Override
    public boolean mouseMoved(Point2i point) {
        for (GUIComponent component : this.components) {
            if (component.getBounds().contains(point)) component.mouseMoved(point);
        }
        return false;
    }

    @Override
    public boolean scrolled(int amount) {
        for (GUIComponent component : this.components) component.scrolled(amount);
        return false;
    }

    public void addComponent(GUIComponent component) {
        this.components.add(component);
    }

    public void onScreenResized(int width, int height) {
        for (GUIComponent component : this.components) {
            component.onGUIResized(width, height);
        }
    }

    public void dispose() {
        Gdx.app.log("YOGOSec", "Disposing...");
        for(GUIComponent component : this.components) {
            component.dispose();
        }
    }
}




Java Source Code List

YOGOSec.android.GameActivity.java
YOGOSec.core.Game.java
YOGOSec.core.gui.Button.java
YOGOSec.core.gui.GUIComponent.java
YOGOSec.core.gui.GUI.java
YOGOSec.core.gui.IActionListener.java
YOGOSec.core.gui.InputListener.java
YOGOSec.core.gui.ProgressBar.java
YOGOSec.core.input.Input.java
YOGOSec.core.render.Render.java
YOGOSec.core.render.YUpPixmap.java
YOGOSec.core.screens.MainMenuScreen.java
YOGOSec.core.screens.MyScreen.java
YOGOSec.core.util.Point2f.java
YOGOSec.core.util.Point2i.java
YOGOSec.core.util.Point.java
YOGOSec.core.util.Rectangle.java
YOGOSec.core.util.Rectanglef.java
YOGOSec.core.util.Rectanglei.java
YOGOSec.java.GameDesktop.java