AndroidSurfaceView class final
A view that draws a World into an Android Surface for Flutter to
show. package:fynkel_flutter's FynkelView makes one and hands
address to its Kotlin plugin, which gives it a surface (and with it
the size) through JNI; resize changes nothing here. A game never uses
it directly. It must be disposed: an Android view left for the garbage
collector stays allocated, with its render worker.
Constructors
- AndroidSurfaceView(World world, {required int width, required int height})
- Throws a FynkelException with FynkelStatus.unsupported off Android.
Properties
- address → int
-
The native view, for the platform plugins' calls. A plugin must stop
using it before dispose.
no setterinherited
- camera ↔ Camera?
-
The camera the view draws from: its own, or the world's main one
(World.camera) when null. Read at each frame. While its object
isn't a live, shown object of the world (not added yet, destroyed,
inactive), the view draws black, not the main camera's picture.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
The height the frames from the next frame on are drawn at, in
pixels.
no setterinherited
- isDisposed → bool
-
Whether dispose was called; then frame, resize, stats and
the rest of its calls throw a StateError.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stats → ViewStats
-
What the view did since it was made, and the GPU memory it holds
now. Subtract an earlier one for the counts in between.
no setterinherited
- width → int
-
The width the frames from the next frame on are drawn at, in pixels.
no setterinherited
Methods
-
dispose(
) → void -
Stops the render worker (after the frame it's drawing) and frees the
view. Calling it again does nothing.
inherited
-
frame(
) → int -
Copies the world and hands it to the render worker, without waiting
for the GPU. Returns the frame's number (1, 2, …).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
releaseImages(
) → void -
Lets go of the images the view draws through (its shadow maps and the
pictures its effects work on), for when memory is short and the view
isn't drawing. The render thread does it soon after, with no frame
needed. The next frame makes them again, for the same picture, so
doing this while drawing only costs a slow frame.
inherited
-
resize(
int width, int height) → void -
Draws the frames from the next frame on at
width×heightpixels. Frames already on their way finish at the old size and are never shown.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited