use of com.badlogic.gdx.graphics.Camera in project libgdx by libgdx.
the class Stage method draw.
public void draw() {
Camera camera = viewport.getCamera();
camera.update();
if (!root.isVisible())
return;
Batch batch = this.batch;
batch.setProjectionMatrix(camera.combined);
batch.begin();
root.draw(batch, 1);
batch.end();
if (debug)
drawDebug();
}
use of com.badlogic.gdx.graphics.Camera in project Entitas-Java by Rubentxu.
the class MatchOneState method initialize.
@Override
public void initialize() {
entitas = new Entitas();
EntityIndexExtension.addEntityIndices(entitas);
// Input
World physics = engine.getManager(BasePhysicsManager.class).getPhysics();
BodyBuilder bodyBuilder = engine.getManager(BasePhysicsManager.class).getBodyBuilder();
Camera camera = engine.getManager(BaseSceneManager.class).getDefaultCamera();
Batch batch = engine.getManager(BaseSceneManager.class).getBatch();
EmitInputSystem emitInputSystem = new EmitInputSystem(entitas.input, physics, camera);
systems.add(new ProcessInputSystem(entitas)).add(new GameBoardSystem(entitas.game)).add(new FallSystem(entitas.game)).add(new FillSystem(entitas.game)).add(new ScoreSystem(entitas)).add(new RemoveViewSystem(entitas.game, physics)).add(new AddViewSystem(entitas.game, assetsManager, bodyBuilder)).add(new AnimatePositionSystem(entitas.game)).add(new DestroySystem(entitas.game)).add(new RendererSystem(entitas, camera, batch, physics));
}
use of com.badlogic.gdx.graphics.Camera in project nhglib by VoidZombie.
the class GraphicsSystem method rebuildCache.
private void rebuildCache(RenderableProvider... renderableProviders) {
Array<ModelCache> previousModelCaches = new Array<>(staticCaches);
for (int i = 0; i < cameras.size; i++) {
ModelCache previousModelCache = previousModelCaches.get(i);
ModelCache staticCache = staticCaches.get(i);
Camera camera = cameras.get(i);
previousModelCache.begin(camera);
previousModelCache.add(staticCache);
previousModelCache.end();
staticCache.begin(camera);
staticCache.add(previousModelCache);
for (RenderableProvider provider : renderableProviders) {
staticCache.add(provider);
}
staticCache.end();
}
}
use of com.badlogic.gdx.graphics.Camera in project nhglib by VoidZombie.
the class GraphicsSystem method end.
@Override
protected void end() {
super.end();
for (int i = 0; i < cameras.size; i++) {
Camera camera = cameras.get(i);
ModelBatch modelBatch = modelBatches.get(i);
ModelCache dynamicCache = dynamicCaches.get(i);
ModelCache staticCache = staticCaches.get(i);
dynamicCache.end();
GLUtils.clearScreen(clearColor);
modelBatch.begin(camera);
modelBatch.render(staticCache, environment);
modelBatch.render(dynamicCache, environment);
modelBatch.end();
if (Nhg.debugDrawPhysics && debugDrawer != null) {
debugDrawer.begin(camera);
physicsSystem.debugDraw();
debugDrawer.end();
}
}
}
use of com.badlogic.gdx.graphics.Camera in project nhglib by VoidZombie.
the class CameraComponentJson method parse.
@Override
public void parse(JsonValue jsonValue) {
CameraComponent cameraComponent = entities.createComponent(entity, CameraComponent.class);
Camera camera;
float nearPlane = jsonValue.getFloat("nearPlane");
float farPlane = jsonValue.getFloat("farPlane");
CameraComponent.Type type = CameraComponent.Type.fromString(jsonValue.getString("cameraType"));
switch(type) {
default:
case PERSPECTIVE:
float fieldOfView = jsonValue.getFloat("fieldOfView");
camera = new PerspectiveCamera(fieldOfView, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
break;
case ORTHOGRAPHIC:
camera = new OrthographicCamera();
break;
}
camera.near = nearPlane;
camera.far = farPlane;
cameraComponent.camera = camera;
cameraComponent.type = type;
output = cameraComponent;
}
Aggregations