class Scar::Objects::Camera
- Scar::Objects::Camera
- Scar::Object
- Scar::Entity
- SF::Transformable
- Reference
- Object
Overview
A camera takes care of calling render() functions and drawing drawables.
A camera is essentially a wrapper around and SF::View
.
Its instance methods are delegated, so you can use them as normal instance methods.
When drawing Entity
s or Object
s, their transforms are applied automatically.
Each space has a default camera, so there is no need to use this class explicitly in your application, except if you need custom views. See the CrSFML documentation for that.
Defined in:
scar/objects/camera.crConstructors
Instance Method Summary
-
#enabled : Bool
Can be used to turn a camera off
-
#enabled=(enabled : Bool)
Can be used to turn a camera off
-
#render_view(app, space, dt)
This method is called by the render method of
Space
s -
#sf : SF::View
The underlying
SF::View
-
#sf=(sf : SF::View)
The underlying
SF::View
Instance methods inherited from class Scar::Object
init(app : App, space : Space)
init,
initialized : Bool
initialized,
initialized=(initialized : Bool)
initialized=,
render(app : App, space : Space, dt)
render,
update(app : App, space : Space, dt)
update
Instance methods inherited from class Scar::Entity
<<(c : Component)<<(*cs : Component) <<, [](comp_type : T.class) : T forall T [], []?(comp_type : T.class) : T | Nil forall T []?, alive? : Bool alive?, components : Array(Scar::Component) components, components=(components : Array(Scar::Component)) components=, destroy destroy, has?(c : Component.class) : Bool
has?(cs : Array(Component.class)) : Bool
has?(*cs : Component.class) : Bool has?, id : String id, z : Int32 z, z=(z : Int32) z=
Constructor methods inherited from class Scar::Entity
new(id : String, components : Array(Component), *, position : Vec | Nil = nil, scale : Vec | Nil = nil, rotation : Float32 | Nil = nil, z : Int32 = 0)new(id : String, *comps : Component, position : Vec | Nil = nil, scale : Vec | Nil = nil, rotation : Float32 | Nil = nil, z : Int32 = 0)
new(id : String, *, position : Vec | Nil = nil, scale : Vec | Nil = nil, rotation : Float32 | Nil = nil, z : Int32 = 0) new