Skip to content

Expose common window resolutions #14153

Closed as not planned
Closed as not planned
@janhohenheim

Description

@janhohenheim

What problem does this solve or what need does it fill?

Users often need to set specific window resolutions. For example, a player will probably want a dropdown menu for a 3D game to tweak the resolution. A game designer might want to use a specific resolution for stylistic reasons. This is also relevant for 2D camera setups, see this chapter of the cheatbook.
As a result, lots of Bevy users will need to define their own resolution constants, resulting in unnecessary boilerplate.

What solution would you like?

Add resolution constants somewhere. My suggestion is adding constructors to WindowResolution like this:

let lowres = WindowResolution::from_360p();
let highres = WindowResolution::from_2k();
// etc.

But other options like associated constants would also work

What alternative(s) have you considered?

Leave it as is. Users can copy-paste their own resolution constants or create a third-party crate.

Additional context

We don't need to add all resolutions, that would be way too much. But something like the 10 most common ones should be feasible.

This issue was originally raised by @Sapein on Discord

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-FeatureA new feature, making something new possibleD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-ControversialThere is active debate or serious implications around merging this PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions