Skip to content

Commit

Permalink
rename output_rect
Browse files Browse the repository at this point in the history
  • Loading branch information
redthing1 committed Jul 16, 2024
1 parent f533f1d commit 7729aa3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions demo/multiscene/source/play.d
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ class PlayScene : Scene2D {
// cam following the first box
auto cam1_nt = create_entity("cam1");
auto cam1 = cam1_nt.add_component(new SceneCamera2D());
auto left_half_output_rect = Rectangle(
auto left_half_output_bounds = Rectangle(
0, 0,
Core.window.screen_width / 2,
Core.window.screen_height
);
auto vp1 = add_viewport(cam1, left_half_output_rect, half_vp_resolution);
auto vp1 = add_viewport(cam1, left_half_output_bounds, half_vp_resolution);
auto follow1 = cam1_nt.add_component(new CameraFollow2D(vp1, box1, 0.05));

// cam following the second box
auto cam2_nt = create_entity("cam2");
auto cam2 = cam2_nt.add_component(new SceneCamera2D());
auto right_half_output_rect = Rectangle(
auto right_half_output_bounds = Rectangle(
Core.window.screen_width / 2, 0,
Core.window.screen_width / 2,
Core.window.screen_height
);
auto vp2 = add_viewport(cam2, right_half_output_rect, half_vp_resolution);
auto vp2 = add_viewport(cam2, right_half_output_bounds, half_vp_resolution);
auto follow2 = cam2_nt.add_component(new CameraFollow2D(vp2, box2, 0.05));
follow2.follow_rotation = true;
}
Expand Down
2 changes: 1 addition & 1 deletion source/re/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ abstract class Core {

foreach (viewport; scene.viewports) {
RenderExt.draw_render_target(
viewport.render_target, viewport.output_rect, scene.composite_mode.color
viewport.render_target, viewport.output_bounds, scene.composite_mode.color
);
}

Expand Down
4 changes: 2 additions & 2 deletions source/re/ng/scene.d
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ abstract class Scene {

if (viewport.sync_maximized) {
// copy output rect from screen bounds
viewport.output_rect = Core.window.screen_bounds;
viewport.output_bounds = Core.window.screen_bounds;
viewport.resolution = resolution; // copy resolution
Core.log.info(format("synced viewport to screen bounds: %s", viewport.output_rect));
Core.log.info(format("synced viewport to screen bounds: %s", viewport.output_bounds));
}

// create render target
Expand Down
4 changes: 2 additions & 2 deletions source/re/ng/scene2d.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ abstract class Scene2D : Scene {
add_viewport(cam, Core.window.screen_bounds, resolution);
}

Viewport2D add_viewport(SceneCamera2D cam, Rectangle output_rect, Vector2 resolution) {
Viewport2D add_viewport(SceneCamera2D cam, Rectangle output_bounds, Vector2 resolution) {
auto vp = new Viewport2D();
vp.cam = cam;
vp.output_rect = output_rect;
vp.output_bounds = output_bounds;
vp.resolution = resolution;
vp.render_target = RenderExt.create_render_target(
cast(int) vp.resolution.x, cast(int) vp.resolution.y
Expand Down
4 changes: 2 additions & 2 deletions source/re/ng/scene3d.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ abstract class Scene3D : Scene {
add_viewport(cam, Core.window.screen_bounds, resolution);
}

Viewport3D add_viewport(SceneCamera3D cam, Rectangle output_rect, Vector2 resolution) {
Viewport3D add_viewport(SceneCamera3D cam, Rectangle output_bounds, Vector2 resolution) {
auto vp = new Viewport3D();
vp.cam = cam;
vp.output_rect = output_rect;
vp.output_bounds = output_bounds;
vp.resolution = resolution;
vp.render_target = RenderExt.create_render_target(
cast(int) vp.resolution.x, cast(int) vp.resolution.y
Expand Down
4 changes: 2 additions & 2 deletions source/re/ng/viewport.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import re.ng.camera.cam3d;
abstract class Viewport {
/// the render target's texture
public RenderTarget render_target;
/// the render target's output rectangle
public Rectangle output_rect;
/// the render target's output bounds: the area of the screen it renders to
public Rectangle output_bounds;
/// the render target's resolution
public Vector2 resolution;

Expand Down

0 comments on commit 7729aa3

Please sign in to comment.