Remove InputManager
This commit is contained in:
@@ -5,6 +5,7 @@ import com.bartlomiejpluta.base.api.game.entity.Entity;
|
||||
import com.bartlomiejpluta.base.api.game.gui.base.GUI;
|
||||
import com.bartlomiejpluta.base.api.game.image.Image;
|
||||
import com.bartlomiejpluta.base.api.game.input.Input;
|
||||
import com.bartlomiejpluta.base.api.game.input.KeyEvent;
|
||||
import com.bartlomiejpluta.base.api.game.runner.GameRunner;
|
||||
import com.bartlomiejpluta.base.api.game.screen.Screen;
|
||||
import com.bartlomiejpluta.base.api.internal.gc.Disposable;
|
||||
@@ -45,4 +46,6 @@ public interface Context extends Updatable, Renderable, Disposable {
|
||||
void init(Screen screen, Input input, Camera camera);
|
||||
|
||||
void input(Input input);
|
||||
|
||||
void handleKeyEvent(KeyEvent event);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.bartlomiejpluta.base.api.game.input;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public interface Input {
|
||||
boolean isKeyPressed(Key key);
|
||||
|
||||
void addKeyEventHandler(Consumer<KeyEvent> handler);
|
||||
|
||||
void removeKeyEventHandler(Consumer<KeyEvent> handler);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bartlomiejpluta.base.api.game.input;
|
||||
|
||||
public interface InputEvent {
|
||||
boolean isConsumed();
|
||||
|
||||
void consume();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bartlomiejpluta.base.api.game.input;
|
||||
|
||||
public enum KeyAction {
|
||||
PRESS,
|
||||
RELEASE,
|
||||
REPEAT
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bartlomiejpluta.base.api.game.input;
|
||||
|
||||
public interface KeyEvent extends InputEvent {
|
||||
Key getKey();
|
||||
|
||||
KeyAction getAction();
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package com.bartlomiejpluta.base.api.game.screen;
|
||||
import org.joml.Vector2fc;
|
||||
|
||||
public interface Screen {
|
||||
void init();
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
@@ -22,4 +20,8 @@ public interface Screen {
|
||||
void clear(float r, float g, float b, float alpha);
|
||||
|
||||
void restoreState();
|
||||
|
||||
void init();
|
||||
|
||||
long getID();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user