Merge pull request #12 from jwangsadinata/fix-sudoku-text-creation

sudoku: optimize text creation of sudoku numbers
This commit is contained in:
Michal Štrba 2019-02-03 14:20:43 +01:00 committed by GitHub
commit 070f96227a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -95,6 +95,9 @@ func run() {
// initialize batch
batch := pixel.NewBatch(&pixel.TrianglesData{}, atlas.Picture())
// initialize text placeholder
num := text.New(pixel.ZV, atlas)
// setup game
for i := 0; i < 9; i++ {
for j := 0; j < 9; j++ {
@ -185,7 +188,7 @@ func run() {
for a, sa := range board {
for b, sb := range sa {
if sb != 0 {
num := text.New(pixel.ZV, atlas)
num.Clear()
num.WriteString(strconv.Itoa(sb))
num.DrawColorMask(batch,
pixel.IM.