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.
67 lines
1.2 KiB
67 lines
1.2 KiB
10 years ago
|
package mightypork.gamecore.gui.screens;
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
import mightypork.gamecore.control.Subsystem;
|
||
|
import mightypork.gamecore.input.KeyBinder;
|
||
|
import mightypork.gamecore.input.KeyBindingPool;
|
||
|
import mightypork.gamecore.input.KeyStroke;
|
||
|
import mightypork.gamecore.render.Renderable;
|
||
|
import mightypork.utils.math.constraints.RectConstraint;
|
||
10 years ago
|
import mightypork.utils.math.coord.Rect;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Screen display layer
|
||
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
10 years ago
|
public abstract class ScreenLayer extends Subsystem implements Renderable, RectConstraint, KeyBinder {
|
||
10 years ago
|
|
||
10 years ago
|
private final Screen screen;
|
||
|
|
||
|
private final KeyBindingPool keybindings = new KeyBindingPool();
|
||
10 years ago
|
|
||
|
|
||
|
public ScreenLayer(Screen screen) {
|
||
|
super(screen); // screen as AppAccess
|
||
|
|
||
|
this.screen = screen;
|
||
10 years ago
|
addChildClient(keybindings);
|
||
10 years ago
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
10 years ago
|
public final void bindKeyStroke(KeyStroke stroke, Runnable task)
|
||
|
{
|
||
|
keybindings.bindKeyStroke(stroke, task);
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
|
@Override
|
||
10 years ago
|
public final void unbindKeyStroke(KeyStroke stroke)
|
||
|
{
|
||
|
keybindings.unbindKeyStroke(stroke);
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
|
protected Screen screen()
|
||
|
{
|
||
|
return screen;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public Rect getRect()
|
||
|
{
|
||
|
return screen.getRect();
|
||
|
}
|
||
|
|
||
10 years ago
|
|
||
|
@Override
|
||
|
protected void deinit()
|
||
|
{
|
||
|
// noimpl
|
||
|
}
|
||
|
|
||
10 years ago
|
}
|