Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/gamecore/gui/components/InputComponent.java

39 lines
732 B

package mightypork.gamecore.gui.components;
import mightypork.gamecore.control.bus.events.MouseButtonEvent;
import mightypork.gamecore.control.interf.Enableable;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.ActionTrigger;
public abstract class InputComponent extends VisualComponent implements Enableable, ActionTrigger, MouseButtonEvent.Listener {
private boolean enabled;
private Action action;
@Override
public void setAction(Action action)
{
this.action = action;
}
@Override
public void enable(boolean yes)
{
this.enabled = yes;
}
@Override
public boolean isEnabled()
{
return enabled;
}
protected void triggerAction() {
if(action != null) action.run();
}
}