First Commit

This commit is contained in:
Jalen Winslow
2018-06-18 15:17:56 -07:00
commit 0c9289cf96
15 changed files with 766 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package com.jalenwinslow.game.ui;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.jalenwinslow.game.Handler;
import com.jalenwinslow.game.utils.Assets;
/**
* Created by jalen on --/--/----.
*/
public class UIDebug extends UIObject {
//private BitmapFont font;
public String msg;
private String debugMsg;
public UIDebug(Handler handler, Texture texture, float x, float y, boolean visible) {
super(handler, texture, x, y, visible);
//font = new BitmapFont(Gdx.files.internal(Assets.customPixelFont1));
//font.setColor(1, 0, 0, 1);
//font.getData().scale(2f);
msg = "";
debugMsg = "Debugger: ";
}
@Override
public void update(float dt) {
debugMsg = "Debugger(FPS:" + Gdx.graphics.getFramesPerSecond() + "): " + msg;
}
@Override
public void draw(Batch batch, float parentAlpha) {
//font.draw(batch, debugMsg, pos.x, pos.y);
}
public void dispose() {
//font.dispose();
remove();
}
}

View File

@@ -0,0 +1,45 @@
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;}
}