package dev.kris.justi.simplegame.ui;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
public abstract class UIObject {
protected float x,y;
protected int width, height;
protected boolean hovering = false;
public UIObject(float x,float y,int width, int height){
System.
out.
println("utworzylem obiekt");
this.x=x;
this.y=y;
this.width=width;
this.height=height;
bounds
= new Rectangle((int)x,
(int)y,width,height
);
}
public abstract void tick();
public abstract void render
(Graphics g
);
public abstract void onClick();
public abstract void renderSetUp
(Graphics g
);
public abstract void renderGame
(Graphics g
);
public abstract void renderMulti
(Graphics g
);
if(bounds.contains(e.getX(),e.getY()))
hovering= true;
else
hovering= false;
}
public void onMouseRelease
(MouseEvent e
){ // oznacza ze myszka zostala nacisnieta
if(hovering)
onClick();
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public boolean isHovering() {
return hovering;
}
public void setHovering(boolean hovering) {
this.hovering = hovering;
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}