Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gui;
- import org.newdawn.slick.Color;
- import org.newdawn.slick.GameContainer;
- import org.newdawn.slick.Graphics;
- /**
- * User: Zsolt
- * Date: 2013.04.21.
- * Time: 17:53
- */
- public abstract class GUI {
- protected int x, y, width, height;
- protected ActionHandler handler;
- protected Color color = Color.darkGray;
- public GUI(int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
- public void setX(int x) {
- this.x = x;
- }
- public void setY(int y) {
- this.y = y;
- }
- public void setColor(Color color) {
- this.color = color;
- }
- public void add(ActionHandler handler) {
- this.handler = handler;
- }
- public ActionHandler getHandler() {
- return handler;
- }
- public boolean checkClick(float mouseX, float mouseY) {
- if (mouseX > x - width / 2 && mouseX < x + width / 2 && mouseY > y - height / 2 && mouseY < y + height / 2) {
- return true;
- }
- return false;
- }
- public abstract void render(GameContainer gc, Graphics g);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement