Skip to main content

nadir/
window_size.rs

1// Copyright 2026 Joseph Anthony Abbott III
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! [`WindowSize`]: the size the frame is drawn at, in development builds.
16
17use nadir_core::UVec2;
18
19/// The size of the inside of the window, in physical pixels: what the
20/// frame is drawn into, and what the UI's views
21/// ([`RenderFrame::ui`](nadir_render::RenderFrame::ui)) cover. A resource
22/// of development builds (feature `dev`).
23///
24/// [`App::run`](crate::App::run) sets it before each frame, and
25/// [`Offscreen::frame`](crate::Offscreen::frame) to the size of its frames.
26/// [`App::update`](crate::App::update) alone leaves it as it was: zero,
27/// until a test sets it. With [`nadir_input::Input::pointer`] and the
28/// virtual resolution, it maps the pointer to a UI's units
29/// ([`nadir_render::UiSpace::new`]).
30#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
31pub struct WindowSize(pub UVec2);