46 lines
1.4 KiB
Java
46 lines
1.4 KiB
Java
|
package com.jalenwinslow.game.ui;
|
||
|
|
||
|
import com.badlogic.gdx.graphics.Texture;
|
||
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||
|
import com.badlogic.gdx.math.Rectangle;
|
||
|
import com.badlogic.gdx.math.Vector2;
|
||
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||
|
import com.jalenwinslow.game.Handler;
|
||
|
|
||
|
/**
|
||
|
* Created by jalen on 2/19/2018.
|
||
|
*/
|
||
|
|
||
|
public abstract class UIObject extends Actor {
|
||
|
|
||
|
protected Handler handler;
|
||
|
protected Texture texture;
|
||
|
protected Vector2 pos;
|
||
|
//protected boolean visible;
|
||
|
protected Rectangle bounds;
|
||
|
|
||
|
public UIObject(Handler handler, Texture texture, float x, float y, boolean visible) {
|
||
|
this.handler = handler;
|
||
|
this.texture = texture;
|
||
|
this.pos = new Vector2(x, y);
|
||
|
this.setVisible(visible);
|
||
|
this.bounds = new Rectangle();
|
||
|
}
|
||
|
|
||
|
public abstract void update(float dt);
|
||
|
@Override
|
||
|
public abstract void draw(Batch batch, float parentAlpha);
|
||
|
|
||
|
//Getters and Setters
|
||
|
public Texture getTexture() {return texture;}
|
||
|
public Vector2 getPos() {return pos;}
|
||
|
public float getPosX() {return pos.x;}
|
||
|
public float getPosY() {return pos.y;}
|
||
|
public Rectangle getBounds() {return bounds;}
|
||
|
|
||
|
public void setTexture(Texture texture) {this.texture = texture;}
|
||
|
public void setPos(float x, float y) {pos.set(x, y);}
|
||
|
public void setBounds(Rectangle bounds) {this.bounds = bounds;}
|
||
|
}
|