@@ -5,25 +5,27 @@ import (
5
5
"fmt"
6
6
"time"
7
7
"os"
8
- "strconv"
9
8
"strings"
10
9
11
10
"github.com/veandco/go-sdl2/sdl"
12
11
"github.com/yuin/gopher-lua"
13
12
"github.com/muesli/gamut"
13
+ "github.com/PinwheelSystem/bitmap"
14
14
)
15
15
16
- const version = "v0.0.2 "
16
+ const version = "v0.0.3 "
17
17
const res int = 128 // Resolution of the *screen* ("internal") . Might change later in development. (res x res, 128 x 128)
18
18
const scale = 4 // Resolution scale (contributes to the size of the *window*)
19
19
var palette [][]uint8 = make ([][]uint8 , 64 ) // Array of array of RGB values ([[R, G, B], [R, G, B], ...])
20
20
var pixelbuf []byte = make ([]byte , res * res * 4 ) // Pixel backbuffer (basically our VRAM)
21
21
var start time.Time
22
- var font [ ][]uint16 = make ([][] uint16 , 36 )
22
+ var font map [ string ][]string
23
23
24
24
func main () {
25
25
colors , _ := gamut .Generate (64 , gamut.PastelGenerator {})
26
- font = [][]uint16 {{0xf , 0x9 , 0x9 , 0xf , 0x9 , 0x9 }}
26
+ bm := bitmap .New ()
27
+ font = bm .Load ("font.png" )
28
+
27
29
for i := uint8 (0 ); i < 64 ; i ++ {
28
30
r , g , b , _ := colors [i ].RGBA ()
29
31
palette [i ] = []uint8 {uint8 (r >> 8 ), uint8 (g >> 8 ), uint8 (b >> 8 )}
@@ -164,21 +166,18 @@ func PWpchar(L *lua.LState) int {
164
166
x := L .ToInt (2 )
165
167
y := L .ToInt (3 )
166
168
167
- switch char {
168
- case "A" :
169
- xx := x
170
- yy := y
171
- for i := 0 ; i < 6 ; i ++ {
172
- bin := strconv .FormatInt (int64 (font [0 ][i ]), 2 )
173
- binarr := strings .Split (bin , "" )
174
-
175
- for _ , pix := range binarr {
176
- if pix == "1" { setpixel (xx , yy , 69 , 153 , 77 ) }
177
- xx += 1
178
- }
179
- yy += 1
180
- xx = x
181
- }
169
+ xx := x
170
+ yy := y
171
+ for i := 0 ; i < 8 ; i ++ {
172
+ bin := font [char ][i ]
173
+ binarr := strings .Split (bin , "" )
174
+
175
+ for _ , pix := range binarr {
176
+ if pix == "1" { setpixel (xx , yy , 69 , 153 , 77 ) }
177
+ xx += 1
178
+ }
179
+ yy += 1
180
+ xx = x
182
181
}
183
182
184
183
return 1
0 commit comments