2022-01-06 20:25:39 -05:00
|
|
|
module PF
|
|
|
|
class Sprite
|
|
|
|
# Draw a single point
|
|
|
|
def draw_point(x : Int32, y : Int32, color : UInt32)
|
|
|
|
if x >= 0 && x < width && y >= 0 && y < height
|
|
|
|
pixel_pointer(x, y).value = color
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# ditto
|
|
|
|
def draw_point(x : Int32, y : Int32, pixel : Pixel = Pixel.new)
|
|
|
|
draw_point(x, y, pixel.format(format))
|
|
|
|
end
|
|
|
|
|
|
|
|
# ditto
|
2022-01-17 14:52:13 -05:00
|
|
|
def draw_point(point : Vector2(Int), pixel : Pixel = Pixel.new)
|
2022-01-06 20:25:39 -05:00
|
|
|
draw_point(point.x, point.y, pixel)
|
|
|
|
end
|
|
|
|
|
|
|
|
# ditto
|
2022-01-17 14:52:13 -05:00
|
|
|
def draw_point(point : Vector2(Float), pixel : Pixel = Pixel.new)
|
2022-01-06 20:25:39 -05:00
|
|
|
draw_point(point.to_i32, pixel)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|