Refactor camera access in Context interface
This commit is contained in:
@@ -1,14 +1,12 @@
|
|||||||
package com.bartlomiejpluta.base.api.game.context;
|
package com.bartlomiejpluta.base.api.game.context;
|
||||||
|
|
||||||
|
import com.bartlomiejpluta.base.api.game.camera.Camera;
|
||||||
import com.bartlomiejpluta.base.api.game.entity.Entity;
|
import com.bartlomiejpluta.base.api.game.entity.Entity;
|
||||||
import org.joml.Vector2f;
|
|
||||||
|
|
||||||
public interface Context {
|
public interface Context {
|
||||||
void openMap(String mapUid);
|
void openMap(String mapUid);
|
||||||
|
|
||||||
Entity createEntity(String entitySetUid);
|
Entity createEntity(String entitySetUid);
|
||||||
|
|
||||||
void setCameraPosition(Vector2f position);
|
Camera getCamera();
|
||||||
|
|
||||||
void setCameraPosition(float x, float y);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import com.bartlomiejpluta.base.engine.world.map.model.DefaultGameMap;
|
|||||||
import com.bartlomiejpluta.base.engine.world.tileset.manager.TileSetManager;
|
import com.bartlomiejpluta.base.engine.world.tileset.manager.TileSetManager;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.joml.Vector2f;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -59,13 +58,8 @@ public class RenderableContext implements Context, Updatable, Renderable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCameraPosition(Vector2f position) {
|
public Camera getCamera() {
|
||||||
camera.setPosition(position);
|
return camera;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCameraPosition(float x, float y) {
|
|
||||||
camera.setPosition(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void input(Window window) {
|
public void input(Window window) {
|
||||||
|
|||||||
Reference in New Issue
Block a user