Class: SFML::View
- Inherits:
-
Object
- Object
- SFML::View
- Defined in:
- ext/graphics/view.c,
ext/graphics/view.c
Overview
A 2D camera: the region of the scene visible on a render target, and where on that target it is shown.
Instance Attribute Summary collapse
-
#center ⇒ Vector2
Returns the view's center.
-
#rotation ⇒ Float
Returns the object's rotation, in degrees.
-
#scissor ⇒ Rect
Returns the target's scissor rectangle, or
nilif none is set. -
#size ⇒ Vector2
Returns the object's size.
-
#viewport ⇒ Rect
Returns the target's viewport rectangle, or
nilif none is set.
Class Method Summary collapse
-
.from_rect(rect) ⇒ View
Creates a view covering the given rectangle.
Instance Method Summary collapse
-
#copy ⇒ View
Returns a deep copy of the object.
-
#new ⇒ View
constructor
Creates a default view covering the (0, 0) - (1000, 1000) region.
-
#move(offset) ⇒ self
Moves the object by
offset. -
#rotate(angle) ⇒ self
Rotates the object by
angledegrees. -
#zoom(factor) ⇒ self
Multiplies the view's size by
factor.
Constructor Details
#new ⇒ View
Creates a default view covering the (0, 0) - (1000, 1000) region.
76 77 78 |
# File 'ext/graphics/view.c', line 76 static VALUE View_init(VALUE self) { return self; } |
Instance Attribute Details
#center ⇒ Vector2
Returns the view's center.
243 244 245 |
# File 'ext/graphics/view.c', line 243 static VALUE View_get_center(VALUE self) { return vec2f_to_rb(sfView_getCenter(Get_View_Struct(self))); } |
#rotation ⇒ Float
Returns the object's rotation, in degrees.
243 244 245 |
# File 'ext/graphics/view.c', line 243 static VALUE View_get_rotation(VALUE self) { return DBL2NUM(sfView_getRotation(Get_View_Struct(self))); } |
#scissor ⇒ Rect
Returns the target's scissor rectangle, or nil if none is set.
243 244 245 |
# File 'ext/graphics/view.c', line 243 static VALUE View_get_scissor(VALUE self) { return RECT_C2RB(sfView_getScissor(Get_View_Struct(self))); } |
#size ⇒ Vector2
Returns the object's size.
243 244 245 |
# File 'ext/graphics/view.c', line 243 static VALUE View_get_size(VALUE self) { return vec2f_to_rb(sfView_getSize(Get_View_Struct(self))); } |
#viewport ⇒ Rect
Returns the target's viewport rectangle, or nil if none is set.
243 244 245 |
# File 'ext/graphics/view.c', line 243 static VALUE View_get_viewport(VALUE self) { return RECT_C2RB(sfView_getViewport(Get_View_Struct(self))); } |
Class Method Details
.from_rect(rect) ⇒ View
Creates a view covering the given rectangle.
65 66 67 |
# File 'ext/graphics/view.c', line 65
static VALUE View_s_from_rect(VALUE klass, VALUE rb_rect) {
return View_new_from(klass, sfView_createFromRect(rect_from_rb(rb_rect)));
}
|
Instance Method Details
#copy ⇒ View
Returns a deep copy of the object.
239 240 241 |
# File 'ext/graphics/view.c', line 239 static VALUE View_copy(VALUE self) { return Get_Casting_View(sfView_copy(Get_View_Struct(self))); } |
#move(offset) ⇒ self
Moves the object by offset.
202 203 204 205 |
# File 'ext/graphics/view.c', line 202
static VALUE View_move(VALUE self, VALUE rb_move) {
sfView_move(Get_View_Struct(self), vec2f_from_rb(rb_move));
return self;
}
|
#rotate(angle) ⇒ self
Rotates the object by angle degrees.
214 215 216 217 218 |
# File 'ext/graphics/view.c', line 214
static VALUE View_rotate(VALUE self, VALUE rb_angle) {
sfView_rotate(Get_View_Struct(self), NUM2DBL(rb_angle));
return self;
}
|
#zoom(factor) ⇒ self
Multiplies the view's size by factor.
227 228 229 230 231 |
# File 'ext/graphics/view.c', line 227
static VALUE View_zoom(VALUE self, VALUE rb_zoom) {
sfView_zoom(Get_View_Struct(self), NUM2DBL(rb_zoom));
return self;
}
|