pub struct SceneCameraScreen { /* private fields */ }Expand description
Shows a picture through a window: the cursor actions pan (held),
Confirm steps the zoom 1× to MAX_ZOOM and round again, Cancel
closes.
Implementations§
Source§impl SceneCameraScreen
impl SceneCameraScreen
Sourcepub const NAME: &'static str = "scene_camera"
pub const NAME: &'static str = "scene_camera"
Name reported by Screen::name.
Sourcepub fn new(
console: ConsoleSpec,
picture: Option<Rc<GlyphBuffer>>,
layout: CameraLayout,
missing: String,
) -> Self
pub fn new( console: ConsoleSpec, picture: Option<Rc<GlyphBuffer>>, layout: CameraLayout, missing: String, ) -> Self
The camera at 1× over the middle of picture, with layout on a
console of console’s cells; missing is what it says without a
picture.
Sourcepub fn picture(&self) -> Option<&Rc<GlyphBuffer>>
pub fn picture(&self) -> Option<&Rc<GlyphBuffer>>
The picture shown, if there is one.
Sourcepub fn origin_px(&self) -> (f32, f32)
pub fn origin_px(&self) -> (f32, f32)
The scene pixel at the window’s top-left (cinema::view).
Sourcepub fn view<G: GameData>(&self, ctx: &Ctx<G>) -> SceneCameraView
pub fn view<G: GameData>(&self, ctx: &Ctx<G>) -> SceneCameraView
What the camera shows, naming the keys of the device used last.
Trait Implementations§
Source§impl Clone for SceneCameraScreen
impl Clone for SceneCameraScreen
Source§fn clone(&self) -> SceneCameraScreen
fn clone(&self) -> SceneCameraScreen
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SceneCameraScreen
impl Debug for SceneCameraScreen
Source§impl<G: GameData> Screen<G> for SceneCameraScreen
impl<G: GameData> Screen<G> for SceneCameraScreen
Source§fn actions(&self) -> Option<Vec<G::Action>>
fn actions(&self) -> Option<Vec<G::Action>>
Confirm zooms, Cancel closes, the held directions pan.
Source§fn update(
&mut self,
ctx: &mut Ctx<G>,
input: &FrameInput<G::Action>,
) -> Transition<G>
fn update( &mut self, ctx: &mut Ctx<G>, input: &FrameInput<G::Action>, ) -> Transition<G>
Handles one frame:
input holds this frame’s actions (often none)
and elapsed time. Called only while this screen is on top.Source§fn draw(&self, ctx: &Ctx<G>, buf: &mut GlyphBuffer)
fn draw(&self, ctx: &Ctx<G>, buf: &mut GlyphBuffer)
Paints the screen. An opaque screen must cover the whole buffer.
Source§fn as_any(&self) -> Option<&dyn Any>
fn as_any(&self) -> Option<&dyn Any>
This screen as
Any, for tests that look inside a screen on the
stack (ScreenStack::find). None unless the screen opts in.Source§fn debug_draw(&self, ctx: &Ctx<G>, out: &mut Gizmos)
fn debug_draw(&self, ctx: &Ctx<G>, out: &mut Gizmos)
Hands in what the debug view shows of this screen (ADR-0085): its
gizmos, each in its channel, in console pixels, built from
self
and ctx alone, so looking changes nothing. A channel’s helper
(the grid kit’s layout_gizmos)
does the work. Called after draw on every screen
drawn, bottom up, only while debug tools are on
(Ctx::debug_tools). Does nothing unless the screen has
something to show.Source§fn is_overlay(&self) -> bool
fn is_overlay(&self) -> bool
Whether the screen below shows through (drawn first, then this one).
Source§fn state_hash(&self) -> Option<StateHash>
fn state_hash(&self) -> Option<StateHash>
The hash of the game’s state this screen holds, which goes in each
frame’s hash in a session record (
Game::state_hash), most simply
shuyi_core::state_hash(&self.rules).ok(): so a playback that plays
differently is found at the frame the state moved. None unless the
screen opts in.Source§fn as_any_mut(&mut self) -> Option<&mut dyn Any>
fn as_any_mut(&mut self) -> Option<&mut dyn Any>
as_any, mutable (ScreenStack::find_mut).Source§fn covered(&mut self, _ctx: &mut Ctx<G>)
fn covered(&mut self, _ctx: &mut Ctx<G>)
Called when a screen is pushed on top of this one
(
Transition::Push): it is no longer updated until it is
uncovered. Not called when the screen above
swaps itself for another (Transition::Replace). Does nothing
unless the screen needs it.Source§fn uncovered(
&mut self,
ctx: &mut Ctx<G>,
result: Option<ScreenResult>,
) -> Transition<G>
fn uncovered( &mut self, ctx: &mut Ctx<G>, result: Option<ScreenResult>, ) -> Transition<G>
Called when the screen above pops and this one is on top again:
result is what it popped with (Transition::PopWith), None
after a plain Transition::Pop. The transition returned is
applied at once, as if from update, so a screen
can act on the answer in the same frame: push the next screen, or
pop with an answer of its own. By default, nothing happens. Read moreAuto Trait Implementations§
impl !Send for SceneCameraScreen
impl !Sync for SceneCameraScreen
impl Freeze for SceneCameraScreen
impl RefUnwindSafe for SceneCameraScreen
impl Unpin for SceneCameraScreen
impl UnsafeUnpin for SceneCameraScreen
impl UnwindSafe for SceneCameraScreen
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more