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.
60 lines
1.1 KiB
60 lines
1.1 KiB
11 years ago
|
package mightypork.rogue.gui;
|
||
11 years ago
|
|
||
|
|
||
|
import mightypork.rogue.bus.ChildClient;
|
||
11 years ago
|
import mightypork.rogue.gui.constraints.Renderable;
|
||
11 years ago
|
import mightypork.rogue.input.KeyBinder;
|
||
|
import mightypork.rogue.input.KeyBindingPool;
|
||
|
import mightypork.rogue.input.KeyStroke;
|
||
11 years ago
|
import mightypork.utils.math.constraints.ConstraintContext;
|
||
11 years ago
|
import mightypork.utils.math.coord.Rect;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Screen display layer
|
||
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
11 years ago
|
public abstract class ScreenLayer extends ChildClient implements Renderable, ConstraintContext, KeyBinder {
|
||
11 years ago
|
|
||
11 years ago
|
private final Screen screen;
|
||
|
|
||
|
private final KeyBindingPool keybindings = new KeyBindingPool();
|
||
11 years ago
|
|
||
|
|
||
|
public ScreenLayer(Screen screen) {
|
||
|
super(screen); // screen as AppAccess
|
||
|
|
||
|
this.screen = screen;
|
||
11 years ago
|
addChildClient(keybindings);
|
||
11 years ago
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
11 years ago
|
public final void bindKeyStroke(KeyStroke stroke, Runnable task)
|
||
|
{
|
||
|
keybindings.bindKeyStroke(stroke, task);
|
||
|
}
|
||
11 years ago
|
|
||
|
|
||
|
@Override
|
||
11 years ago
|
public final void unbindKeyStroke(KeyStroke stroke)
|
||
|
{
|
||
|
keybindings.unbindKeyStroke(stroke);
|
||
|
}
|
||
11 years ago
|
|
||
|
|
||
|
protected Screen screen()
|
||
|
{
|
||
|
return screen;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public Rect getRect()
|
||
|
{
|
||
|
return screen.getRect();
|
||
|
}
|
||
|
|
||
|
}
|