Create Input model
This commit is contained in:
@@ -4,6 +4,7 @@ import com.bartlomiejpluta.base.api.game.camera.Camera;
|
||||
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.runner.GameRunner;
|
||||
import com.bartlomiejpluta.base.api.game.screen.Screen;
|
||||
import com.bartlomiejpluta.base.api.internal.gc.Disposable;
|
||||
@@ -17,6 +18,8 @@ public interface Context extends Updatable, Renderable, Disposable {
|
||||
|
||||
Camera getCamera();
|
||||
|
||||
Input getInput();
|
||||
|
||||
String getProjectName();
|
||||
|
||||
void openMap(String mapUid);
|
||||
@@ -39,7 +42,7 @@ public interface Context extends Updatable, Renderable, Disposable {
|
||||
|
||||
boolean togglePause();
|
||||
|
||||
void init(Screen screen, Camera camera);
|
||||
void init(Screen screen, Input input, Camera camera);
|
||||
|
||||
void input(Screen screen);
|
||||
void input(Input input);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.bartlomiejpluta.base.api.game.input;
|
||||
|
||||
public interface Input {
|
||||
boolean isKeyPressed(Key key);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.bartlomiejpluta.base.api.game.map.handler;
|
||||
|
||||
import com.bartlomiejpluta.base.api.game.context.Context;
|
||||
import com.bartlomiejpluta.base.api.game.input.Input;
|
||||
import com.bartlomiejpluta.base.api.game.map.model.GameMap;
|
||||
import com.bartlomiejpluta.base.api.game.screen.Screen;
|
||||
|
||||
@@ -9,7 +10,7 @@ public interface MapHandler {
|
||||
|
||||
void onOpen(Context context, GameMap map);
|
||||
|
||||
void input(Screen screen);
|
||||
void input(Input input);
|
||||
|
||||
void update(Context context, GameMap map, float dt);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.bartlomiejpluta.base.api.game.runner;
|
||||
|
||||
import com.bartlomiejpluta.base.api.game.context.Context;
|
||||
import com.bartlomiejpluta.base.api.game.screen.Screen;
|
||||
import com.bartlomiejpluta.base.api.game.input.Input;
|
||||
import com.bartlomiejpluta.base.api.internal.gc.Disposable;
|
||||
|
||||
public interface GameRunner extends Disposable {
|
||||
void init(Context context);
|
||||
|
||||
void input(Screen screen);
|
||||
void input(Input input);
|
||||
|
||||
void update(float dt);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.bartlomiejpluta.base.api.game.screen;
|
||||
|
||||
import com.bartlomiejpluta.base.api.game.input.Key;
|
||||
import org.joml.Vector2fc;
|
||||
|
||||
public interface Screen {
|
||||
@@ -18,8 +17,6 @@ public interface Screen {
|
||||
|
||||
boolean shouldClose();
|
||||
|
||||
boolean isKeyPressed(Key key);
|
||||
|
||||
void update();
|
||||
|
||||
void clear(float r, float g, float b, float alpha);
|
||||
|
||||
Reference in New Issue
Block a user