Merge pull request #12 from jwangsadinata/fix-sudoku-text-creation
sudoku: optimize text creation of sudoku numbers
This commit is contained in:
commit
070f96227a
|
@ -95,6 +95,9 @@ func run() {
|
||||||
// initialize batch
|
// initialize batch
|
||||||
batch := pixel.NewBatch(&pixel.TrianglesData{}, atlas.Picture())
|
batch := pixel.NewBatch(&pixel.TrianglesData{}, atlas.Picture())
|
||||||
|
|
||||||
|
// initialize text placeholder
|
||||||
|
num := text.New(pixel.ZV, atlas)
|
||||||
|
|
||||||
// setup game
|
// setup game
|
||||||
for i := 0; i < 9; i++ {
|
for i := 0; i < 9; i++ {
|
||||||
for j := 0; j < 9; j++ {
|
for j := 0; j < 9; j++ {
|
||||||
|
@ -185,7 +188,7 @@ func run() {
|
||||||
for a, sa := range board {
|
for a, sa := range board {
|
||||||
for b, sb := range sa {
|
for b, sb := range sa {
|
||||||
if sb != 0 {
|
if sb != 0 {
|
||||||
num := text.New(pixel.ZV, atlas)
|
num.Clear()
|
||||||
num.WriteString(strconv.Itoa(sb))
|
num.WriteString(strconv.Itoa(sb))
|
||||||
num.DrawColorMask(batch,
|
num.DrawColorMask(batch,
|
||||||
pixel.IM.
|
pixel.IM.
|
||||||
|
|
Loading…
Reference in New Issue