Class: Yeah::Display Abstract
- Inherits:
-
Object
- Object
- Yeah::Display
- Defined in:
- lib/yeah/_platform/display.rb
Overview
Provided by a Platform.
The Display is responsible for drawing to a game display. It provides a procedural drawing API similar to Processing or HTML5 Canvas.
Instance Attribute Summary collapse
-
#fill_color ⇒ Color
Color for fill.
-
#height ⇒ Integer
Height of display in pixels.
-
#size ⇒ Vector
Size of display in pixels.
-
#stroke_color ⇒ Color
Color for stroke.
-
#stroke_width ⇒ Numeric
Width for stroke in pixels.
-
#text_font ⇒ Font
Font for text.
-
#text_size ⇒ Integer
Size for text in pixels.
-
#width ⇒ Integer
Width of display in pixels.
Instance Method Summary collapse
-
#begin_shape ⇒ nil
Begin new shape.
-
#clear ⇒ nil
Clear display with fill color.
-
#color_at(position) ⇒ Color
Color of pixel.
-
#curve2_to(position, control1, control2) ⇒ nil
Trace curve with 2 control points to position as part of shape.
-
#curve_to(position, control) ⇒ nil
Trace curve with a control point to position as part of shape.
-
#end_shape ⇒ nil
End shape.
-
#fill_ellipse(center, radius) ⇒ nil
Fill an ellipse at a center position and 2D radius.
-
#fill_rectangle(position, size) ⇒ nil
Fill a rectangle at a position and size.
-
#fill_shape ⇒ nil
Fill previously made shape.
-
#fill_text(text, position) ⇒ nil
Fill text at a position.
-
#image(image, position) ⇒ nil
Draw an image at a position.
-
#image_cropped(image, position, crop_position, crop_size) ⇒ nil
Draw a cropped image at a position.
-
#initialize(options = {}) ⇒ Display
constructor
A new instance of Display.
-
#line_to(position) ⇒ nil
Trace line to position as part of shape.
-
#move_to(position) ⇒ nil
Move shape cursor to position.
-
#pop ⇒ nil
Pop a transformation off the transformation stack and use it.
-
#push ⇒ nil
Push current transformation to the transformation stack.
-
#rotate(radians) ⇒ nil
Rotate the transformation by vector radians.
-
#rotate_x(radians) ⇒ nil
Rotate the transformation by radians on the X axis.
-
#rotate_y(radians) ⇒ nil
Rotate the transformation by radians on the Y axis.
-
#rotate_z(radians) ⇒ nil
Rotate the transformation by radians on the Z axis.
-
#scale(multiplier) ⇒ nil
Scale the transformation by a vector multiplier.
-
#scale_x(multiplier) ⇒ nil
Scale the transformation by a multiplier on the X axis.
-
#scale_y(multiplier) ⇒ nil
Scale the transformation by a multiplier on the Y axis.
-
#scale_z(multiplier) ⇒ nil
Scale the transformation by a multiplier on the Z axis.
-
#stroke_curve(start_pos, end_pos, control) ⇒ nil
Stroke curve with a control point between two positions.
-
#stroke_curve2(start_pos, end_pos, control1, control2) ⇒ nil
Stroke curve with 2 control points between two positions.
-
#stroke_ellipse(center, radius) ⇒ nil
Stroke an ellipse at a center position and 2D radius.
-
#stroke_line(start_pos, end_pos) ⇒ nil
Stroke a line between two positions.
-
#stroke_rectangle(position, size) ⇒ nil
Stroke a rectangle at a position and size.
-
#stroke_shape ⇒ nil
Stroke previously made shape.
-
#stroke_text(text, position) ⇒ nil
Stroke text at a position.
-
#translate(displacement) ⇒ nil
Move the transformation by a vector displacement.
-
#translate_x(displacement) ⇒ nil
Move the transformation by a displacement on the X axis.
-
#translate_y(displacement) ⇒ nil
Move the transformation by a displacement on the Y axis.
-
#translate_z(displacement) ⇒ nil
Move the transformation by a displacement on the Z axis.
Constructor Details
#initialize(options = {}) ⇒ Display
Returns a new instance of Display.
11 12 13 |
# File 'lib/yeah/_platform/display.rb', line 11 def initialize( = {}) raise NotImplementedError end |
Instance Attribute Details
#height ⇒ Integer
Returns height of display in pixels.
|
|
# File 'lib/yeah/_platform/display.rb', line 23
|
#stroke_width ⇒ Numeric
Returns width for stroke in pixels.
|
|
# File 'lib/yeah/_platform/display.rb', line 35
|
#text_size ⇒ Integer
Returns size for text in pixels.
|
|
# File 'lib/yeah/_platform/display.rb', line 43
|
#width ⇒ Integer
Returns width of display in pixels.
|
|
# File 'lib/yeah/_platform/display.rb', line 19
|
Instance Method Details
#begin_shape ⇒ nil
Begin new shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 182
|
#clear ⇒ nil
Clear display with fill color.
|
|
# File 'lib/yeah/_platform/display.rb', line 178
|
#curve2_to(position, control1, control2) ⇒ nil
Trace curve with 2 control points to position as part of shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 206
|
#curve_to(position, control) ⇒ nil
Trace curve with a control point to position as part of shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 200
|
#end_shape ⇒ nil
End shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 186
|
#fill_ellipse(center, radius) ⇒ nil
‘Web::Display#fill_ellipse` is currently 2D (only X and Y apply).
Fill an ellipse at a center position and 2D radius.
|
|
# File 'lib/yeah/_platform/display.rb', line 171
|
#fill_rectangle(position, size) ⇒ nil
‘Web::Display#fill_rectangle` is currently 2D (only X and Y apply).
Fill a rectangle at a position and size.
|
|
# File 'lib/yeah/_platform/display.rb', line 157
|
#fill_shape ⇒ nil
Fill previously made shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 217
|
#fill_text(text, position) ⇒ nil
Fill text at a position.
|
|
# File 'lib/yeah/_platform/display.rb', line 237
|
#image(image, position) ⇒ nil
Draw an image at a position.
|
|
# File 'lib/yeah/_platform/display.rb', line 221
|
#image_cropped(image, position, crop_position, crop_size) ⇒ nil
Draw a cropped image at a position.
|
|
# File 'lib/yeah/_platform/display.rb', line 229
|
#line_to(position) ⇒ nil
Trace line to position as part of shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 195
|
#move_to(position) ⇒ nil
Move shape cursor to position.
|
|
# File 'lib/yeah/_platform/display.rb', line 190
|
#pop ⇒ nil
Pop a transformation off the transformation stack and use it.
|
|
# File 'lib/yeah/_platform/display.rb', line 122
|
#push ⇒ nil
Push current transformation to the transformation stack.
|
|
# File 'lib/yeah/_platform/display.rb', line 118
|
#rotate(radians) ⇒ nil
‘Web::Display#rotate` is currently 2D (only Z applies).
Rotate the transformation by vector radians.
|
|
# File 'lib/yeah/_platform/display.rb', line 95
|
#rotate_x(radians) ⇒ nil
No-op in Web::Display, which is currently 2D.
Rotate the transformation by radians on the X axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 101
|
#rotate_y(radians) ⇒ nil
No-op in Web::Display, which is currently 2D.
Rotate the transformation by radians on the Y axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 107
|
#rotate_z(radians) ⇒ nil
Rotate the transformation by radians on the Z axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 113
|
#scale(multiplier) ⇒ nil
‘Web::Display#scale` is currently 2D (only X and Y apply).
Scale the transformation by a vector multiplier.
|
|
# File 'lib/yeah/_platform/display.rb', line 73
|
#scale_x(multiplier) ⇒ nil
Scale the transformation by a multiplier on the X axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 79
|
#scale_y(multiplier) ⇒ nil
Scale the transformation by a multiplier on the Y axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 84
|
#scale_z(multiplier) ⇒ nil
No-op in Web::Display, which is currently 2D.
Scale the transformation by a multiplier on the Z axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 89
|
#stroke_curve(start_pos, end_pos, control) ⇒ nil
‘Web::Display#stroke_curve` is currently 2D (only X and Y apply).
Stroke curve with a control point between two positions.
|
|
# File 'lib/yeah/_platform/display.rb', line 133
|
#stroke_curve2(start_pos, end_pos, control1, control2) ⇒ nil
‘Web::Display#stroke_curve2` is currently 2D (only X and Y apply).
Stroke curve with 2 control points between two positions.
|
|
# File 'lib/yeah/_platform/display.rb', line 141
|
#stroke_ellipse(center, radius) ⇒ nil
‘Web::Display#stroke_ellipse` is currently 2D (only X and Y apply).
Stroke an ellipse at a center position and 2D radius.
|
|
# File 'lib/yeah/_platform/display.rb', line 164
|
#stroke_line(start_pos, end_pos) ⇒ nil
‘Web::Display#stroke_line` is currently 2D (only X and Y apply).
Stroke a line between two positions.
|
|
# File 'lib/yeah/_platform/display.rb', line 126
|
#stroke_rectangle(position, size) ⇒ nil
‘Web::Display#stroke_rectangle` is currently 2D (only X and Y apply).
Stroke a rectangle at a position and size.
|
|
# File 'lib/yeah/_platform/display.rb', line 150
|
#stroke_shape ⇒ nil
Stroke previously made shape.
|
|
# File 'lib/yeah/_platform/display.rb', line 213
|
#stroke_text(text, position) ⇒ nil
Stroke text at a position.
|
|
# File 'lib/yeah/_platform/display.rb', line 243
|
#translate(displacement) ⇒ nil
‘Web::Display#translate` is currently 2D (only X and Y apply).
Move the transformation by a vector displacement.
|
|
# File 'lib/yeah/_platform/display.rb', line 51
|
#translate_x(displacement) ⇒ nil
Move the transformation by a displacement on the X axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 57
|
#translate_y(displacement) ⇒ nil
Move the transformation by a displacement on the Y axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 62
|
#translate_z(displacement) ⇒ nil
No-op in Web::Display, which is currently 2D.
Move the transformation by a displacement on the Z axis.
|
|
# File 'lib/yeah/_platform/display.rb', line 67
|