Skip to content

Conversation

@kfc35
Copy link
Contributor

@kfc35 kfc35 commented Dec 6, 2025

Objective

Solution

  • Copies the setup contained in spawn_with_viewport_coords from viewport_debug into its own scene in the ui testbed. The testbed spawns a 1280 x 720 resolution window by default, so it looks the same.
  • Removes the viewport_debug example (Although, tbh, I’m wondering if it’s actually worth keeping around since it might be useful for debugging for whatever reason. Second opinions welcome on the deletion of viewport_debug)

Testing

Ran cargo run --example testbed_ui and compared the new ViewportCoords scene via screenshot to the viewport_debug example (cargo run --example viewport_debug). They look the same.


Showcase

To see the scene, checkout the branch and run cargo run --example testbed_ui. Hit the Spacebar 12x to see the new scene.

Screenshot 2025-12-06 at 5 03 42 PM

mod viewport_coords {
use bevy::{color::palettes::css::*, prelude::*};

const PALETTE: [Srgba; 9] = [RED, WHITE, BEIGE, AQUA, CRIMSON, NAVY, AZURE, LIME, BLACK];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only differences between this function and spawn_with_viewport_coords from viewport_debug should be that:

  • I removed the unused Palette color YELLOW (it’s only used in spawn_with_pixel_coords so the palette indices are shifted less by 1 for the children
  • I added spawning the 2d Camera
  • I added the DespawnOnExit component for the Camera and the parent node

@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets C-Testing A change that impacts how we test Bevy or how users test their apps S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Examples An addition or correction to our examples C-Testing A change that impacts how we test Bevy or how users test their apps S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a responsive coords scene to testbed_ui

2 participants