You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
484 B
24 lines
484 B
package main
|
|
|
|
import "github.com/veandco/go-sdl2/sdl"
|
|
|
|
func drawNumber(pos pos, color sdl.Color, size, num int, pixels []byte) {
|
|
startX := int(pos.x) - (size * 3) / 2
|
|
startY := int(pos.y) - (size * 5) / 2
|
|
|
|
for i, v := range nums[num] {
|
|
if v == 1 {
|
|
for y := startY; y < startY + size; y++ {
|
|
for x := startX; x < startX + size; x++ {
|
|
setPixel(x, y, color, pixels)
|
|
}
|
|
}
|
|
}
|
|
startX += size
|
|
if (i + 1) % 3 == 0 {
|
|
startY += size
|
|
startX -= size * 3
|
|
}
|
|
}
|
|
}
|