class PF::Sprite
- PF::Sprite
- Reference
- Object
Defined in:
sprite.crsprite/draw_circle.cr
sprite/draw_curve.cr
sprite/draw_line.cr
sprite/draw_point.cr
sprite/draw_rect.cr
sprite/draw_shape.cr
sprite/draw_string.cr
sprite/draw_triangle.cr
sprite/fill_circle.cr
sprite/fill_rect.cr
sprite/fill_shape.cr
sprite/fill_triangle.cr
Constant Summary
-
CHAR_HEIGHT =
8
-
CHAR_WIDTH =
7
-
CHARS =
{'A' => 31826619531338240_u64, 'B' => 67855430391512064_u64, 'C' => 31826480892812288_u64, 'D' => 67855416432868352_u64, 'E' => 67837698610576384_u64, 'F' => 67837700758052864_u64, 'G' => 31826618356931584_u64, 'H' => 38582033887339008_u64, 'I' => 31596120220376064_u64, 'J' => 33812458620721152_u64, 'K' => 40851830712968192_u64, 'L' => 36312488334081024_u64, 'M' => 38758490471211520_u64, 'N' => 38723308246606336_u64, 'O' => 31826619413896192_u64, 'P' => 67855430383050752_u64, 'Q' => 31826619447582208_u64, 'R' => 67855430416736768_u64, 'S' => 31826478619499520_u64, 'T' => 69876717053020160_u64, 'U' => 38582018854951936_u64, 'V' => 38582018854488064_u64, 'W' => 73830671248859648_u64, 'X' => 38581042764915200_u64, 'Y' => 38581042713724928_u64, 'Z' => 69823665651334656_u64, 'a' => 1651533552640_u64, 'b' => 36314139765913600_u64, 'c' => 1668730198016_u64, 'd' => 4540727624342528_u64, 'e' => 1668830731264_u64, 'f' => 27340486336323584_u64, 'g' => 1668746708080_u64, 'h' => 36314139765908480_u64, 'i' => 70373072963584_u64, 'j' => 35186536485904_u64, 'k' => 36312767574320128_u64, 'l' => 141845657552896_u64, 'm' => 3596138652160_u64, 'n' => 2502004188160_u64, 'o' => 1668746975232_u64, 'p' => 1668747632704_u64, 'q' => 1943624614920_u64, 'r' => 1668730068992_u64, 's' => 1941426026496_u64, 't' => 18158992946104320_u64, 'u' => 2354859547648_u64, 'v' => 2354859083776_u64, 'w' => 2354893362176_u64, 'x' => 2347233845760_u64, 'y' => 2354859409976_u64, 'z' => 4262789135872_u64, '0' => 31826898653879296_u64, '1' => 27092520593005568_u64, '2' => 31824408503926272_u64, '3' => 31824408445262848_u64, '4' => 38582016572195328_u64, '5' => 70089500445973504_u64, '6' => 31826495933586432_u64, '7' => 69823665650798592_u64, '8' => 31826616192670720_u64, '9' => 31826617132194816_u64, '!' => 9078122083256320_u64, '?' => 31826607492564992_u64, '(' => 9149044912293888_u64, ')' => 18085321338261504_u64, '.' => 2048_u64, ',' => 1040_u64, '/' => 4574526785462272_u64, '\\' => 36170638347600896_u64, '[' => 54326886843559936_u64, ']' => 54185041186009088_u64, '{' => 27163452011714560_u64, '}' => 54185036891041792_u64, '$' => 9273845900773376_u64, '#' => 22698191602979840_u64, '+' => 70951819804672_u64, '-' => 33285996544_u64, '“' => 18333810932318208_u64, '”' => 9325241583009792_u64, '‘' => 18298072509448192_u64, '’' => 36170634018947072_u64, '\'' => 18156235509465088_u64, '"' => 45390588773662720_u64, '@' => 31827448392850944_u64, '=' => 4260867604480_u64, '>' => 18085043222351872_u64, '<' => 2287542565208576_u64, '_' => 15872_u64}
Constructors
Class Method Summary
Instance Method Summary
-
#convert(other : SDL::Surface)
Convert the color mode of this sprite to another for optimization
-
#convert(other : Sprite)
ditto
-
#draw_circle(cx : Int, cy : Int, r : Int, pixel : Pixel = Pixel.new)
Draw a circle using Bresenham’s Algorithm
- #draw_circle(c : Vector2(Int), r : Int, pixel : Pixel = Pixel.new)
- #draw_curve(curve : Bezier::Cubic | Bezier::Quad, samples : Int = 100, pixel : Pixel = Pixel.new)
- #draw_curve(curve : Bezier::Cubic | Bezier::Quad, pixel : Pixel)
-
#draw_line(x1 : Int, y1 : Int, x2 : Int, y2 : Int, pixel : Pixel = Pixel.new)
Draw a line using Bresenham’s Algorithm
-
#draw_line(x1 : Number, y1 : Number, x2 : Number, y2 : Number, pixel : Pixel = Pixel.new)
ditto
-
#draw_line(p1 : Vector2(Int), p2 : Vector2(Int), pixel : Pixel = Pixel.new)
ditto
-
#draw_line(p1 : Vector2(Number), p2 : Vector2(Number), pixel : Pixel = Pixel.new)
ditto
-
#draw_line(line : Line, pixel : Pixel = Pixel.new)
ditto
-
#draw_point(x : Int32, y : Int32, color : UInt32)
Draw a single point
-
#draw_point(x : Int32, y : Int32, pixel : Pixel = Pixel.new)
ditto
-
#draw_point(point : Vector2(Int), pixel : Pixel = Pixel.new)
ditto
-
#draw_point(point : Vector2(Float), pixel : Pixel = Pixel.new)
ditto
-
#draw_rect(x1 : Int, y1 : Int, x2 : Int, y2 : Int, pixel : Pixel = Pixel.new)
Draw the outline of a square rect
-
#draw_rect(p1 : PF::Vector2(Int), p2 : PF::Vector2(Int), pixel : Pixel = Pixel.new)
ditto
-
#draw_rect(size : PF::Vector2(Int), pixel : Pixel = Pixel.new)
ditto
-
#draw_shape(points : Enumerable(Vector2), pixel : Pixel = Pixel.new)
Draw lines enclosing a shape
-
#draw_shape(*points : Vector2, color : Pixel = Pixel.new)
Ditto
- #draw_string(msg : String, x : Int, y : Int, color : Pixel = Pixel.new, bg : Pixel | Nil = nil, leading : Int = 2)
- #draw_string(msg : String, pos : Vector2(Int), color : Pixel = Pixel.black)
-
#draw_to(sprite : Sprite, source : Vector2(Int), size : Vector2(Int), dest : Vector2(Int))
Draw this sprite to another given a source rect and destination
-
#draw_to(surface : SDL::Surface, x : Int = 0, y : Int = 0)
Draw this sprite to another
-
#draw_to(sprite : Sprite, x : Int = 0, y : Int = 0)
ditto
-
#draw_to(dest : SDL::Surface | Sprite, at : Vector2(Int))
ditto
-
#draw_triangle(p1 : Vector2, p2 : Vector2, p3 : Vector2, pixel : Pixel = Pixel.new)
Draws 3 lines
- #fill(*args, **options)
- #fill(*args, **options, &)
-
#fill_circle(cx : Int, cy : Int, r : Int, pixel : Pixel = Pixel.new)
Fill a circle using Bresenham’s Algorithm
- #fill_circle(c : Vector2(Int), r : Int, pixel : Pixel = Pixel.new)
-
#fill_rect(x1 : Int, y1 : Int, x2 : Int, y2 : Int, pixel : Pixel = Pixel.new)
Fill a rect
-
#fill_rect(p1 : PF::Vector2(Int), p2 : PF::Vector2(Int), pixel : Pixel = Pixel.new)
ditto
-
#fill_shape(points : Enumerable(Vector2), color : Pixel = Pixel.new)
Fill an abitrary polygon.
- #fill_shape(*points : Vector2, color : Pixel = Pixel.new)
- #fill_triangle(p1 : Vector2, p2 : Vector2, p3 : Vector2, pixel : Pixel = Pixel.new)
- #fill_triangle(points : Enumerable(Vector2), pixel : Pixel = Pixel.new)
- #format(*args, **options)
- #format(*args, **options, &)
- #height
- #lock(*args, **options)
- #lock(*args, **options, &)
-
#peak(x : Int, y : Int)
Peak at a raw pixel value at (x, y)
-
#peak(point : Vector2(Int))
ditto
-
#pixel_pointer(x : Int32, y : Int32)
Get the pointer to a pixel
-
#pixels
Raw access to the pixels as a Slice
-
#sample(x : Int, y : Int, alpha : Boolean)
Sample a color with alhpa
-
#sample(x : Int, y : Int)
Sample a color at an x and y position
-
#sample(point : Vector2(Int), alpha : Boolean)
ditto
-
#sample(point : Vector2(Int))
ditto
-
#scan_line(x : Int, y : Int, width : Int, pixel : Pixel = Pixel.new)
Draw a horizontal line to a certain width
- #size
- #surface : SDL::Surface
- #surface=(surface : SDL::Surface)
- #width
Constructor Detail
Class Method Detail
Instance Method Detail
Convert the color mode of this sprite to another for optimization
Draw a circle using Bresenham’s Algorithm
Draw a line using Bresenham’s Algorithm
ditto
ditto
ditto
Draw the outline of a square rect
ditto
Draw lines enclosing a shape
Draw this sprite to another given a source rect and destination
Draw this sprite to another
Draws 3 lines
Fill a circle using Bresenham’s Algorithm
Fill a rect
ditto
Fill an abitrary polygon. Expects a clockwise winding of points
Draw a horizontal line to a certain width