parent
1121c31509
commit
66adc1ffa9
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.8 KiB |
Binary file not shown.
@ -0,0 +1,28 @@ |
||||
package mightypork.rogue.world.events; |
||||
|
||||
|
||||
import mightypork.gamecore.eventbus.BusEvent; |
||||
import mightypork.gamecore.eventbus.event_flags.UnloggedEvent; |
||||
import mightypork.rogue.world.entity.entities.PlayerEntity; |
||||
|
||||
|
||||
@UnloggedEvent |
||||
public class PlayerStepEndEvent extends BusEvent<PlayerStepEndListener> { |
||||
|
||||
private final PlayerEntity player; |
||||
|
||||
|
||||
public PlayerStepEndEvent(PlayerEntity player) |
||||
{ |
||||
super(); |
||||
this.player = player; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void handleBy(PlayerStepEndListener handler) |
||||
{ |
||||
handler.onStepFinished(player); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
package mightypork.rogue.world.events; |
||||
|
||||
|
||||
import mightypork.rogue.world.entity.entities.PlayerEntity; |
||||
|
||||
|
||||
public interface PlayerStepEndListener { |
||||
|
||||
void onStepFinished(PlayerEntity player); |
||||
} |
@ -0,0 +1,27 @@ |
||||
package mightypork.rogue.world.events; |
||||
|
||||
|
||||
import mightypork.gamecore.eventbus.BusEvent; |
||||
import mightypork.rogue.world.World; |
||||
|
||||
|
||||
/** |
||||
* Toggle world pause state |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public class WorldPauseRequest extends BusEvent<World> { |
||||
|
||||
|
||||
@Override |
||||
protected void handleBy(World handler) |
||||
{ |
||||
// toggle paused state
|
||||
if (!handler.isPaused()) { |
||||
handler.pause(); |
||||
} else { |
||||
handler.resume(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,22 +1,31 @@ |
||||
package mightypork.rogue.world.gui.interaction; |
||||
|
||||
|
||||
import mightypork.gamecore.eventbus.events.Updateable; |
||||
import mightypork.gamecore.util.math.constraints.vect.Vect; |
||||
import mightypork.rogue.world.PlayerControl; |
||||
import mightypork.rogue.world.events.PlayerStepEndListener; |
||||
import mightypork.rogue.world.gui.MapView; |
||||
|
||||
|
||||
public interface MapInteractionPlugin { |
||||
public abstract class MapInteractionPlugin implements Updateable, PlayerStepEndListener { |
||||
|
||||
boolean onStepEnd(MapView mapView, PlayerControl player); |
||||
protected final MapView mapView; |
||||
|
||||
|
||||
boolean onClick(MapView mapView, PlayerControl player, Vect mouse, int button, boolean down); |
||||
public MapInteractionPlugin(MapView mapView) |
||||
{ |
||||
super(); |
||||
this.mapView = mapView; |
||||
} |
||||
|
||||
|
||||
public abstract boolean onClick(Vect mouse, int button, boolean down); |
||||
|
||||
|
||||
boolean onKey(MapView mapView, PlayerControl player, int key, boolean down); |
||||
public abstract boolean onKey(int key, boolean down); |
||||
|
||||
|
||||
void update(MapView mapView, PlayerControl pc, double delta); |
||||
@Override |
||||
public abstract void update(double delta); |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue