VERSIÓ 1.4.4
- [NEW] Nou sistema de fonts funcionant ja internament
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require "ia.other"
|
||||
--require "ia.other"
|
||||
|
||||
x=0
|
||||
|
||||
@@ -41,5 +41,5 @@ function mini.update()
|
||||
local mx, my = mouse.pos()
|
||||
draw.rectf(mx, my, 4, 4, 8)
|
||||
draw.text(mx .. " " .. my, 1, 8, 8)
|
||||
draw.text(other.peiv(),1,100,4)
|
||||
--draw.text(other.peiv(),1,100,4)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
bitmap=font.gif
|
||||
bitmap=default_font
|
||||
32: 0 0 3 5 0 #
|
||||
33: 4 0 3 5 0 # !
|
||||
34: 8 0 3 5 0 # "
|
||||
|
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
223
default_font_fnt.h
Normal file
223
default_font_fnt.h
Normal file
@@ -0,0 +1,223 @@
|
||||
unsigned char default_font_fnt[] = {
|
||||
0x62, 0x69, 0x74, 0x6d, 0x61, 0x70, 0x3d, 0x64, 0x65, 0x66, 0x61, 0x75,
|
||||
0x6c, 0x74, 0x5f, 0x66, 0x6f, 0x6e, 0x74, 0x0a, 0x33, 0x32, 0x3a, 0x20,
|
||||
0x30, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x20,
|
||||
0x23, 0x20, 0x20, 0x0a, 0x33, 0x33, 0x3a, 0x20, 0x34, 0x20, 0x30, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x20, 0x23, 0x20, 0x21, 0x0a,
|
||||
0x33, 0x34, 0x3a, 0x20, 0x38, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20,
|
||||
0x30, 0x20, 0x20, 0x20, 0x23, 0x20, 0x22, 0x0a, 0x33, 0x35, 0x3a, 0x20,
|
||||
0x31, 0x32, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x23, 0x20, 0x23, 0x0a, 0x33, 0x36, 0x3a, 0x20, 0x31, 0x36, 0x20, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x24, 0x0a,
|
||||
0x33, 0x37, 0x3a, 0x20, 0x32, 0x30, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x25, 0x0a, 0x33, 0x38, 0x3a, 0x20,
|
||||
0x32, 0x34, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x23, 0x20, 0x26, 0x0a, 0x33, 0x39, 0x3a, 0x20, 0x32, 0x38, 0x20, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x27, 0x0a,
|
||||
0x34, 0x30, 0x3a, 0x20, 0x33, 0x32, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x28, 0x0a, 0x34, 0x31, 0x3a, 0x20,
|
||||
0x33, 0x36, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x23, 0x20, 0x29, 0x0a, 0x34, 0x32, 0x3a, 0x20, 0x34, 0x30, 0x20, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x2a, 0x0a,
|
||||
0x34, 0x33, 0x3a, 0x20, 0x34, 0x34, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x2b, 0x0a, 0x34, 0x34, 0x3a, 0x20,
|
||||
0x34, 0x38, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x23, 0x20, 0x2c, 0x0a, 0x34, 0x35, 0x3a, 0x20, 0x35, 0x32, 0x20, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x2d, 0x0a,
|
||||
0x34, 0x36, 0x3a, 0x20, 0x35, 0x36, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x2e, 0x0a, 0x34, 0x37, 0x3a, 0x20,
|
||||
0x36, 0x30, 0x20, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x23, 0x20, 0x2f, 0x0a, 0x0a, 0x34, 0x38, 0x3a, 0x20, 0x30, 0x20, 0x36,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x20, 0x23, 0x20, 0x30,
|
||||
0x0a, 0x34, 0x39, 0x3a, 0x20, 0x34, 0x20, 0x36, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x20, 0x23, 0x20, 0x31, 0x0a, 0x35, 0x30, 0x3a,
|
||||
0x20, 0x38, 0x20, 0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x20, 0x23, 0x20, 0x32, 0x0a, 0x35, 0x31, 0x3a, 0x20, 0x31, 0x32, 0x20,
|
||||
0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x33,
|
||||
0x0a, 0x35, 0x32, 0x3a, 0x20, 0x31, 0x36, 0x20, 0x36, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x34, 0x0a, 0x35, 0x33, 0x3a,
|
||||
0x20, 0x32, 0x30, 0x20, 0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x20, 0x23, 0x20, 0x35, 0x0a, 0x35, 0x34, 0x3a, 0x20, 0x32, 0x34, 0x20,
|
||||
0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x36,
|
||||
0x0a, 0x35, 0x35, 0x3a, 0x20, 0x32, 0x38, 0x20, 0x36, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x37, 0x0a, 0x35, 0x36, 0x3a,
|
||||
0x20, 0x33, 0x32, 0x20, 0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x20, 0x23, 0x20, 0x38, 0x0a, 0x35, 0x37, 0x3a, 0x20, 0x33, 0x36, 0x20,
|
||||
0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x39,
|
||||
0x0a, 0x35, 0x38, 0x3a, 0x20, 0x34, 0x30, 0x20, 0x36, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x3a, 0x0a, 0x35, 0x39, 0x3a,
|
||||
0x20, 0x34, 0x34, 0x20, 0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x20, 0x23, 0x20, 0x3b, 0x0a, 0x36, 0x30, 0x3a, 0x20, 0x34, 0x38, 0x20,
|
||||
0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x3c,
|
||||
0x0a, 0x36, 0x31, 0x3a, 0x20, 0x35, 0x32, 0x20, 0x36, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x3d, 0x0a, 0x36, 0x32, 0x3a,
|
||||
0x20, 0x35, 0x36, 0x20, 0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x20, 0x23, 0x20, 0x3e, 0x0a, 0x36, 0x33, 0x3a, 0x20, 0x36, 0x30, 0x20,
|
||||
0x36, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x3f,
|
||||
0x0a, 0x0a, 0x36, 0x34, 0x3a, 0x20, 0x30, 0x20, 0x31, 0x32, 0x20, 0x33,
|
||||
0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x40, 0x0a, 0x36, 0x35,
|
||||
0x3a, 0x20, 0x34, 0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30,
|
||||
0x20, 0x20, 0x23, 0x20, 0x41, 0x0a, 0x36, 0x36, 0x3a, 0x20, 0x38, 0x20,
|
||||
0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20,
|
||||
0x42, 0x0a, 0x36, 0x37, 0x3a, 0x20, 0x31, 0x32, 0x20, 0x31, 0x32, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x43, 0x0a, 0x36, 0x38,
|
||||
0x3a, 0x20, 0x31, 0x36, 0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20,
|
||||
0x30, 0x20, 0x23, 0x20, 0x44, 0x0a, 0x36, 0x39, 0x3a, 0x20, 0x32, 0x30,
|
||||
0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x45, 0x0a, 0x37, 0x30, 0x3a, 0x20, 0x32, 0x34, 0x20, 0x31, 0x32, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x46, 0x0a, 0x37, 0x31,
|
||||
0x3a, 0x20, 0x32, 0x38, 0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20,
|
||||
0x30, 0x20, 0x23, 0x20, 0x47, 0x0a, 0x37, 0x32, 0x3a, 0x20, 0x33, 0x32,
|
||||
0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x48, 0x0a, 0x37, 0x33, 0x3a, 0x20, 0x33, 0x36, 0x20, 0x31, 0x32, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x49, 0x0a, 0x37, 0x34,
|
||||
0x3a, 0x20, 0x34, 0x30, 0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20,
|
||||
0x30, 0x20, 0x23, 0x20, 0x4a, 0x0a, 0x37, 0x35, 0x3a, 0x20, 0x34, 0x34,
|
||||
0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x4b, 0x0a, 0x37, 0x36, 0x3a, 0x20, 0x34, 0x38, 0x20, 0x31, 0x32, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x4c, 0x0a, 0x37, 0x37,
|
||||
0x3a, 0x20, 0x35, 0x32, 0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20,
|
||||
0x30, 0x20, 0x23, 0x20, 0x4d, 0x0a, 0x37, 0x38, 0x3a, 0x20, 0x35, 0x36,
|
||||
0x20, 0x31, 0x32, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x4e, 0x0a, 0x37, 0x39, 0x3a, 0x20, 0x36, 0x30, 0x20, 0x31, 0x32, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x4f, 0x0a, 0x0a, 0x38,
|
||||
0x30, 0x3a, 0x20, 0x30, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35, 0x20,
|
||||
0x30, 0x20, 0x20, 0x23, 0x20, 0x50, 0x0a, 0x38, 0x31, 0x3a, 0x20, 0x34,
|
||||
0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23,
|
||||
0x20, 0x51, 0x0a, 0x38, 0x32, 0x3a, 0x20, 0x38, 0x20, 0x31, 0x38, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x52, 0x0a, 0x38,
|
||||
0x33, 0x3a, 0x20, 0x31, 0x32, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x53, 0x0a, 0x38, 0x34, 0x3a, 0x20, 0x31,
|
||||
0x36, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23,
|
||||
0x20, 0x54, 0x0a, 0x38, 0x35, 0x3a, 0x20, 0x32, 0x30, 0x20, 0x31, 0x38,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x55, 0x0a, 0x38,
|
||||
0x36, 0x3a, 0x20, 0x32, 0x34, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x56, 0x0a, 0x38, 0x37, 0x3a, 0x20, 0x32,
|
||||
0x38, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23,
|
||||
0x20, 0x57, 0x0a, 0x38, 0x38, 0x3a, 0x20, 0x33, 0x32, 0x20, 0x31, 0x38,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x58, 0x0a, 0x38,
|
||||
0x39, 0x3a, 0x20, 0x33, 0x36, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x59, 0x0a, 0x39, 0x30, 0x3a, 0x20, 0x34,
|
||||
0x30, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23,
|
||||
0x20, 0x5a, 0x0a, 0x39, 0x31, 0x3a, 0x20, 0x34, 0x34, 0x20, 0x31, 0x38,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x5b, 0x0a, 0x39,
|
||||
0x32, 0x3a, 0x20, 0x34, 0x38, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x5c, 0x0a, 0x39, 0x33, 0x3a, 0x20, 0x35,
|
||||
0x32, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23,
|
||||
0x20, 0x5d, 0x0a, 0x39, 0x34, 0x3a, 0x20, 0x35, 0x36, 0x20, 0x31, 0x38,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x5e, 0x0a, 0x39,
|
||||
0x35, 0x3a, 0x20, 0x36, 0x30, 0x20, 0x31, 0x38, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x5f, 0x0a, 0x0a, 0x39, 0x36, 0x3a, 0x20,
|
||||
0x30, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20,
|
||||
0x23, 0x20, 0x60, 0x0a, 0x39, 0x37, 0x3a, 0x20, 0x34, 0x20, 0x32, 0x34,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x61, 0x0a,
|
||||
0x39, 0x38, 0x3a, 0x20, 0x38, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x62, 0x0a, 0x39, 0x39, 0x3a, 0x20,
|
||||
0x31, 0x32, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x23, 0x20, 0x63, 0x0a, 0x31, 0x30, 0x30, 0x3a, 0x20, 0x31, 0x36, 0x20,
|
||||
0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x64,
|
||||
0x0a, 0x31, 0x30, 0x31, 0x3a, 0x20, 0x32, 0x30, 0x20, 0x32, 0x34, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x65, 0x0a, 0x31, 0x30,
|
||||
0x32, 0x3a, 0x20, 0x32, 0x34, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x66, 0x0a, 0x31, 0x30, 0x33, 0x3a, 0x20,
|
||||
0x32, 0x38, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x23, 0x20, 0x67, 0x0a, 0x31, 0x30, 0x34, 0x3a, 0x20, 0x33, 0x32, 0x20,
|
||||
0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x68,
|
||||
0x0a, 0x31, 0x30, 0x35, 0x3a, 0x20, 0x33, 0x36, 0x20, 0x32, 0x34, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x69, 0x0a, 0x31, 0x30,
|
||||
0x36, 0x3a, 0x20, 0x34, 0x30, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x6a, 0x0a, 0x31, 0x30, 0x37, 0x3a, 0x20,
|
||||
0x34, 0x34, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x23, 0x20, 0x6b, 0x0a, 0x31, 0x30, 0x38, 0x3a, 0x20, 0x34, 0x38, 0x20,
|
||||
0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x6c,
|
||||
0x0a, 0x31, 0x30, 0x39, 0x3a, 0x20, 0x35, 0x32, 0x20, 0x32, 0x34, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x6d, 0x0a, 0x31, 0x31,
|
||||
0x30, 0x3a, 0x20, 0x35, 0x36, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x23, 0x20, 0x6e, 0x0a, 0x31, 0x31, 0x31, 0x3a, 0x20,
|
||||
0x36, 0x30, 0x20, 0x32, 0x34, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20,
|
||||
0x23, 0x20, 0x6f, 0x0a, 0x0a, 0x31, 0x31, 0x32, 0x3a, 0x20, 0x30, 0x20,
|
||||
0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20,
|
||||
0x70, 0x0a, 0x31, 0x31, 0x33, 0x3a, 0x20, 0x34, 0x20, 0x33, 0x30, 0x20,
|
||||
0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x71, 0x0a, 0x31,
|
||||
0x31, 0x34, 0x3a, 0x20, 0x38, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35,
|
||||
0x20, 0x30, 0x20, 0x20, 0x23, 0x20, 0x72, 0x0a, 0x31, 0x31, 0x35, 0x3a,
|
||||
0x20, 0x31, 0x32, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30,
|
||||
0x20, 0x23, 0x20, 0x73, 0x0a, 0x31, 0x31, 0x36, 0x3a, 0x20, 0x31, 0x36,
|
||||
0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x74, 0x0a, 0x31, 0x31, 0x37, 0x3a, 0x20, 0x32, 0x30, 0x20, 0x33, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x75, 0x0a, 0x31,
|
||||
0x31, 0x38, 0x3a, 0x20, 0x32, 0x34, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x76, 0x0a, 0x31, 0x31, 0x39, 0x3a,
|
||||
0x20, 0x32, 0x38, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30,
|
||||
0x20, 0x23, 0x20, 0x77, 0x0a, 0x31, 0x32, 0x30, 0x3a, 0x20, 0x33, 0x32,
|
||||
0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x78, 0x0a, 0x31, 0x32, 0x31, 0x3a, 0x20, 0x33, 0x36, 0x20, 0x33, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x79, 0x0a, 0x31,
|
||||
0x32, 0x32, 0x3a, 0x20, 0x34, 0x30, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x7a, 0x0a, 0x31, 0x32, 0x33, 0x3a,
|
||||
0x20, 0x34, 0x34, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30,
|
||||
0x20, 0x23, 0x20, 0x7b, 0x0a, 0x31, 0x32, 0x34, 0x3a, 0x20, 0x34, 0x38,
|
||||
0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20,
|
||||
0x7c, 0x0a, 0x31, 0x32, 0x35, 0x3a, 0x20, 0x35, 0x32, 0x20, 0x33, 0x30,
|
||||
0x20, 0x33, 0x20, 0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x7d, 0x0a, 0x31,
|
||||
0x32, 0x36, 0x3a, 0x20, 0x35, 0x36, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x23, 0x20, 0x7e, 0x0a, 0x31, 0x32, 0x37, 0x3a,
|
||||
0x20, 0x36, 0x30, 0x20, 0x33, 0x30, 0x20, 0x33, 0x20, 0x35, 0x20, 0x30,
|
||||
0x20, 0x23, 0x20, 0xe2, 0x8c, 0x82, 0x20, 0x28, 0x44, 0x45, 0x4c, 0x20,
|
||||
0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x29,
|
||||
0x0a, 0x0a, 0x23, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64,
|
||||
0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x73, 0x0a,
|
||||
0x31, 0x36, 0x31, 0x3a, 0x20, 0x30, 0x20, 0x33, 0x36, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc2, 0xa1, 0x0a,
|
||||
0x31, 0x39, 0x31, 0x3a, 0x20, 0x34, 0x20, 0x33, 0x36, 0x20, 0x33, 0x20,
|
||||
0x35, 0x20, 0x30, 0x20, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc2, 0xbf, 0x0a,
|
||||
0x31, 0x39, 0x32, 0x3a, 0x20, 0x38, 0x20, 0x33, 0x36, 0x20, 0x33, 0x20,
|
||||
0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x80, 0x0a,
|
||||
0x31, 0x39, 0x33, 0x3a, 0x20, 0x31, 0x32, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x81, 0x0a,
|
||||
0x32, 0x30, 0x30, 0x3a, 0x20, 0x31, 0x36, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x88, 0x0a,
|
||||
0x32, 0x30, 0x31, 0x3a, 0x20, 0x32, 0x30, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x89, 0x0a,
|
||||
0x32, 0x30, 0x34, 0x3a, 0x20, 0x32, 0x34, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x8c, 0x0a,
|
||||
0x32, 0x30, 0x35, 0x3a, 0x20, 0x32, 0x38, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x8d, 0x0a,
|
||||
0x32, 0x31, 0x30, 0x3a, 0x20, 0x33, 0x32, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x92, 0x0a,
|
||||
0x32, 0x31, 0x31, 0x3a, 0x20, 0x33, 0x36, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x93, 0x0a,
|
||||
0x32, 0x31, 0x37, 0x3a, 0x20, 0x34, 0x30, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x99, 0x0a,
|
||||
0x32, 0x31, 0x38, 0x3a, 0x20, 0x34, 0x34, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x38, 0x20, 0x33, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x9a, 0x0a,
|
||||
0x32, 0x30, 0x39, 0x3a, 0x20, 0x34, 0x38, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x37, 0x20, 0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x91, 0x0a,
|
||||
0x32, 0x34, 0x31, 0x3a, 0x20, 0x35, 0x32, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x36, 0x20, 0x31, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xb1, 0x0a,
|
||||
0x31, 0x39, 0x39, 0x3a, 0x20, 0x35, 0x36, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0x87, 0x0a,
|
||||
0x32, 0x33, 0x31, 0x3a, 0x20, 0x36, 0x30, 0x20, 0x33, 0x36, 0x20, 0x33,
|
||||
0x20, 0x35, 0x20, 0x30, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xa7, 0x0a,
|
||||
0x32, 0x32, 0x34, 0x3a, 0x20, 0x30, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20,
|
||||
0x37, 0x20, 0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xa0, 0x0a, 0x32,
|
||||
0x32, 0x35, 0x3a, 0x20, 0x34, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37,
|
||||
0x20, 0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xa1, 0x0a, 0x32, 0x33,
|
||||
0x32, 0x3a, 0x20, 0x38, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xa8, 0x0a, 0x32, 0x33, 0x33,
|
||||
0x3a, 0x20, 0x31, 0x32, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xa9, 0x0a, 0x32, 0x33, 0x36,
|
||||
0x3a, 0x20, 0x31, 0x36, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xac, 0x0a, 0x32, 0x33, 0x37,
|
||||
0x3a, 0x20, 0x32, 0x30, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xad, 0x0a, 0x32, 0x34, 0x32,
|
||||
0x3a, 0x20, 0x32, 0x34, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xb2, 0x0a, 0x32, 0x34, 0x33,
|
||||
0x3a, 0x20, 0x32, 0x38, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xb3, 0x0a, 0x32, 0x34, 0x39,
|
||||
0x3a, 0x20, 0x33, 0x32, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xb9, 0x0a, 0x32, 0x35, 0x30,
|
||||
0x3a, 0x20, 0x33, 0x36, 0x20, 0x34, 0x35, 0x20, 0x33, 0x20, 0x37, 0x20,
|
||||
0x32, 0x20, 0x20, 0x23, 0x20, 0xc3, 0xba, 0x0a, 0x00
|
||||
};
|
||||
unsigned int default_font_fnt_len = 2637;
|
||||
42
default_font_gif.h
Normal file
42
default_font_gif.h
Normal file
@@ -0,0 +1,42 @@
|
||||
unsigned char default_font_gif[] = {
|
||||
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x40, 0x00, 0x36, 0x00, 0x80, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x21, 0xf9, 0x04, 0x08, 0x01,
|
||||
0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x36, 0x00,
|
||||
0x00, 0x02, 0xff, 0x84, 0x1d, 0x08, 0xc9, 0x1b, 0xcd, 0x92, 0x9a, 0x4b,
|
||||
0xc9, 0x83, 0x73, 0xbe, 0x47, 0xc2, 0xe7, 0x60, 0x11, 0xc5, 0x55, 0xe6,
|
||||
0xa9, 0x69, 0x25, 0xd5, 0x99, 0xa0, 0xbb, 0x96, 0xd1, 0xbc, 0xbd, 0x62,
|
||||
0x9a, 0x3e, 0xf4, 0xd5, 0xdc, 0x3e, 0xdf, 0xc2, 0xb1, 0x82, 0x37, 0x8f,
|
||||
0xc5, 0x11, 0x0b, 0xf6, 0x88, 0x9b, 0xa1, 0xf0, 0x09, 0x8d, 0x4a, 0x73,
|
||||
0xa0, 0x97, 0x0e, 0x59, 0xd9, 0x75, 0xaa, 0xdc, 0x55, 0xd3, 0x87, 0xed,
|
||||
0x71, 0x80, 0x10, 0x66, 0xf6, 0x6c, 0x24, 0x21, 0xac, 0x45, 0xd7, 0xda,
|
||||
0xb3, 0xeb, 0xb6, 0xae, 0x57, 0x9c, 0x77, 0x52, 0x75, 0xa3, 0x4e, 0x64,
|
||||
0xfe, 0x19, 0x4f, 0x04, 0x97, 0x26, 0x22, 0x47, 0x67, 0x13, 0x47, 0x76,
|
||||
0xf8, 0x65, 0x36, 0x36, 0xe5, 0xf8, 0x08, 0xf9, 0x65, 0x08, 0x17, 0x12,
|
||||
0x66, 0x55, 0x36, 0x89, 0xb6, 0x35, 0xb2, 0xa6, 0x89, 0x39, 0xe7, 0xa7,
|
||||
0x36, 0x68, 0xb4, 0x44, 0xe7, 0x99, 0xc5, 0x25, 0x5a, 0xc9, 0xf6, 0xa6,
|
||||
0xb6, 0x0a, 0xfa, 0xd9, 0x57, 0x76, 0x04, 0x44, 0xab, 0xe7, 0x56, 0x7a,
|
||||
0x4a, 0xf9, 0xb1, 0x5b, 0xb8, 0x89, 0x96, 0x0a, 0x1c, 0x5b, 0x19, 0x59,
|
||||
0x6c, 0x4c, 0x95, 0x56, 0xe7, 0x3b, 0x1c, 0x1b, 0x3c, 0x36, 0x08, 0x7b,
|
||||
0xaa, 0xa4, 0x2b, 0xfd, 0xc7, 0x32, 0xfb, 0xfb, 0xd1, 0x8a, 0x2b, 0x2d,
|
||||
0x08, 0xc8, 0x74, 0xc7, 0x47, 0x3a, 0x2d, 0x1c, 0xe6, 0x57, 0x7b, 0x2d,
|
||||
0xf4, 0x0c, 0x1c, 0x98, 0x9c, 0x87, 0x48, 0x0c, 0x53, 0x13, 0x7e, 0x5c,
|
||||
0x3f, 0x45, 0x6f, 0x9f, 0x9f, 0x63, 0xd9, 0x7a, 0x09, 0xcf, 0x6b, 0xae,
|
||||
0x54, 0xb0, 0x78, 0xec, 0xce, 0xad, 0x1a, 0x75, 0x8b, 0x92, 0xb8, 0x61,
|
||||
0x84, 0x3e, 0xd9, 0x52, 0xa5, 0x6c, 0x5a, 0x2e, 0x86, 0xb0, 0x0a, 0x79,
|
||||
0xe3, 0xf1, 0x8e, 0x5f, 0xb9, 0x66, 0xa0, 0xfa, 0x3a, 0x7a, 0xfc, 0x58,
|
||||
0x03, 0x0f, 0xbd, 0x88, 0x58, 0x42, 0x98, 0x62, 0xe6, 0x89, 0x55, 0xa8,
|
||||
0x6f, 0x28, 0x1b, 0x51, 0x73, 0x97, 0xa8, 0x5d, 0x40, 0x8d, 0x36, 0xf4,
|
||||
0x00, 0x3c, 0x09, 0x2a, 0x10, 0x39, 0x4d, 0x5b, 0x0a, 0x8a, 0x13, 0x89,
|
||||
0x49, 0xce, 0x2b, 0x82, 0x25, 0x41, 0x1a, 0x5d, 0x04, 0xcd, 0xda, 0x91,
|
||||
0x36, 0x4c, 0xe7, 0x08, 0xad, 0xf9, 0x04, 0x9d, 0x54, 0x9d, 0xae, 0xf6,
|
||||
0x20, 0x65, 0x05, 0xf5, 0xa8, 0x0a, 0x85, 0xe8, 0x12, 0x5a, 0xfc, 0x77,
|
||||
0xa9, 0x53, 0x4b, 0x6b, 0x2e, 0x71, 0x62, 0x73, 0xc9, 0x6d, 0xec, 0x2c,
|
||||
0xa1, 0xc8, 0x68, 0x4e, 0x7d, 0x09, 0x77, 0xe5, 0x3e, 0x87, 0x28, 0x6a,
|
||||
0xa9, 0x55, 0x0a, 0xa9, 0x19, 0x58, 0x4e, 0x87, 0x14, 0x6a, 0xfd, 0x7b,
|
||||
0xaf, 0x89, 0x8c, 0x3d, 0x4b, 0x96, 0x9a, 0x39, 0xf6, 0x76, 0x65, 0xe2,
|
||||
0xae, 0x80, 0x1b, 0xe7, 0xfd, 0x6a, 0x89, 0xc6, 0xc1, 0x6a, 0xf5, 0x38,
|
||||
0x12, 0xb3, 0x0b, 0x17, 0xdf, 0x3d, 0x5f, 0xe9, 0x00, 0x8d, 0xcd, 0xa7,
|
||||
0x37, 0xb2, 0xdb, 0x9e, 0x44, 0x1d, 0x9b, 0x3e, 0xed, 0xb8, 0x00, 0x00,
|
||||
0x3b
|
||||
};
|
||||
unsigned int default_font_gif_len = 457;
|
||||
6
lua.cpp
6
lua.cpp
@@ -310,15 +310,13 @@ extern "C" {
|
||||
break;
|
||||
case 1:
|
||||
index = luaL_checkinteger(L, 1);
|
||||
const uint8_t old = subpal(index,index);
|
||||
lua_pushinteger(L, old);
|
||||
lua_pushinteger(L, subpal(index,index));
|
||||
return 1;
|
||||
break;
|
||||
case 2:
|
||||
index = luaL_checkinteger(L, 1);
|
||||
color = luaL_checkinteger(L, 2);
|
||||
const uint8_t old = subpal(index, color);
|
||||
lua_pushinteger(L, old);
|
||||
lua_pushinteger(L, subpal(index, color));
|
||||
return 1;
|
||||
break;
|
||||
case 3:
|
||||
|
||||
199
mini.cpp
199
mini.cpp
@@ -9,6 +9,9 @@
|
||||
//#include <vector>
|
||||
#include "log.h"
|
||||
|
||||
#include "default_font_gif.h"
|
||||
#include "default_font_fnt.h"
|
||||
|
||||
#define MAX_SURFACES 100
|
||||
#define MAX_FONTS 5
|
||||
|
||||
@@ -290,6 +293,8 @@ uint8_t loadsurf(uint8_t* buffer, const char* name) {
|
||||
surfaces[i].name = (char*)malloc(strlen(name)+1);
|
||||
strcpy(surfaces[i].name, name);
|
||||
|
||||
log_msg(LOG_INFO, "Buffer '%s' carregat en surface: %i.\n", name, i);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -411,6 +416,84 @@ void shader_init(const char* vshader, const char* fshader)
|
||||
void shader_enable() { shader::enable(); }
|
||||
void shader_disable() { shader::disable(); }
|
||||
|
||||
uint8_t loadfont_from_buffer(const char* buffer, uint8_t index) {
|
||||
if (!buffer) return false;
|
||||
|
||||
const char* ptr = buffer;
|
||||
char line[256];
|
||||
|
||||
// --- Read first line ---
|
||||
{
|
||||
// Extract line
|
||||
int len = 0;
|
||||
while (ptr[len] && ptr[len] != '\n' && len < 255) len++;
|
||||
|
||||
memcpy(line, ptr, len);
|
||||
line[len] = '\0';
|
||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||
|
||||
if (strncmp(line, "bitmap=", 7) != 0) return false; // Parse first line
|
||||
|
||||
fonts[index].surface = loadsurf(line + 7);
|
||||
}
|
||||
|
||||
// --- Read character lines ---
|
||||
while (*ptr) {
|
||||
// Extract next line
|
||||
int len = 0;
|
||||
while (ptr[len] && ptr[len] != '\n' && len < 255) len++;
|
||||
|
||||
memcpy(line, ptr, len);
|
||||
line[len] = '\0';
|
||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||
|
||||
// Remove comments
|
||||
char* hash = strchr(line, '#');
|
||||
if (hash) *hash = '\0';
|
||||
|
||||
// Parse
|
||||
int code, x, y, w, h, base;
|
||||
if (sscanf(line, "%d: %d %d %d %d %d", &code, &x, &y, &w, &h, &base) == 6) {
|
||||
if (code >= 0 && code < 256) {
|
||||
fonts[index].chars[code] = { (uint8_t)x, (uint8_t)y, (uint8_t)w, (uint8_t)h, (uint8_t)base };
|
||||
}
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
uint8_t loadfont(const char *filename) {
|
||||
// Si la font ja s'ha carregat, tornem eixa font
|
||||
for (unsigned int i=0; i<MAX_FONTS; ++i)
|
||||
if (fonts[i].name && strcmp(fonts[i].name, filename)==0) {
|
||||
log_msg(LOG_INFO, "Carrega de '%s' abortada: Reusant: %i.\n", filename, i);
|
||||
return i;
|
||||
}
|
||||
|
||||
// Agafar la pròxima textura lliure
|
||||
unsigned int i = 0;
|
||||
while (i<MAX_FONTS && surfaces[i].p != NULL) ++i;
|
||||
if (i==MAX_FONTS) return 255;
|
||||
|
||||
// Carregar l'arxiu de disc
|
||||
int size;
|
||||
char *buffer;
|
||||
buffer = file_getfilebuffer(filename, size);
|
||||
|
||||
// Si no s'ha pogut, petar
|
||||
if (!buffer) {
|
||||
log_msg(LOG_FAIL, "Error al intentar obrir l'arxiu '%s'\n", filename);
|
||||
exit(-1);
|
||||
return 255;
|
||||
}
|
||||
|
||||
loadfont_from_buffer(buffer, i);
|
||||
free(buffer);
|
||||
|
||||
log_msg(LOG_INFO, "Arxiu '%s' carregat en font: %i.\n", filename, i);
|
||||
return i;
|
||||
}
|
||||
|
||||
void createDisplay() {
|
||||
if (screen_zoom <= 0) screen_zoom = 1;
|
||||
while (screen_width*screen_zoom > desktop_width || screen_height*screen_zoom > desktop_height) screen_zoom--;
|
||||
@@ -508,6 +591,7 @@ int main(int argc,char*argv[]){
|
||||
should_exit=false;
|
||||
|
||||
// initfont()
|
||||
|
||||
int bi = 0;
|
||||
for (int ci=0; ci<96; ci+=2) {
|
||||
font[ci] = base64font[bi] - 48 + ( ( base64font[bi+1] - 48 ) << 6) + ( ( ( base64font[bi+2] - 48 ) & 7 ) << 12 );
|
||||
@@ -556,6 +640,9 @@ int main(int argc,char*argv[]){
|
||||
reinit();
|
||||
initaudio();
|
||||
|
||||
loadsurf(default_font_gif, "default_font");
|
||||
loadfont_from_buffer((const char*)default_font_fnt, 0);
|
||||
|
||||
lua_init(main_lua_file);
|
||||
lua_call_init();
|
||||
|
||||
@@ -677,86 +764,6 @@ int main(int argc,char*argv[]){
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool loadfont_from_buffer(const char* buffer, font_t& font) {
|
||||
if (!buffer) return false;
|
||||
|
||||
const char* ptr = buffer;
|
||||
char line[256];
|
||||
|
||||
// --- Read first line ---
|
||||
{
|
||||
// Extract line
|
||||
int len = 0;
|
||||
while (ptr[len] && ptr[len] != '\n' && len < 255) len++;
|
||||
|
||||
memcpy(line, ptr, len);
|
||||
line[len] = '\0';
|
||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||
|
||||
if (strncmp(line, "bitmap=", 7) != 0) return false; // Parse first line
|
||||
|
||||
font.surface = loadsurf(line + 7);
|
||||
}
|
||||
|
||||
// --- Read character lines ---
|
||||
while (*ptr) {
|
||||
// Extract next line
|
||||
int len = 0;
|
||||
while (ptr[len] && ptr[len] != '\n' && len < 255) len++;
|
||||
|
||||
memcpy(line, ptr, len);
|
||||
line[len] = '\0';
|
||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||
|
||||
// Remove comments
|
||||
char* hash = strchr(line, '#');
|
||||
if (hash) *hash = '\0';
|
||||
|
||||
// Parse
|
||||
int code, x, y, w, h, base;
|
||||
if (sscanf(line, "%d: %d %d %d %d %d", &code, &x, &y, &w, &h, &base) == 6) {
|
||||
if (code >= 0 && code < 256) {
|
||||
font.chars[code] = { (uint8_t)x, (uint8_t)y, (uint8_t)w, (uint8_t)h, (uint8_t)base };
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint32_t utf8_decode(const char* s, int& advance) {
|
||||
const unsigned char* p = (const unsigned char*)s;
|
||||
uint32_t cp;
|
||||
|
||||
if (p[0] < 0x80) {
|
||||
cp = p[0];
|
||||
advance = 1;
|
||||
}
|
||||
else if ((p[0] & 0xE0) == 0xC0) {
|
||||
cp = ((p[0] & 0x1F) << 6) |
|
||||
(p[1] & 0x3F);
|
||||
advance = 2;
|
||||
}
|
||||
else if ((p[0] & 0xF0) == 0xE0) {
|
||||
cp = ((p[0] & 0x0F) << 12) |
|
||||
((p[1] & 0x3F) << 6) |
|
||||
(p[2] & 0x3F);
|
||||
advance = 3;
|
||||
}
|
||||
else if ((p[0] & 0xF8) == 0xF0) {
|
||||
cp = ((p[0] & 0x07) << 18) |
|
||||
((p[1] & 0x3F) << 12) |
|
||||
((p[2] & 0x3F) << 6) |
|
||||
(p[3] & 0x3F);
|
||||
advance = 4;
|
||||
}
|
||||
else {
|
||||
cp = 0xFFFD; // carácter inválido
|
||||
advance = 1;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
void simple_pset(int x, int y, uint8_t color) {
|
||||
x += ds::origin[0]; y += ds::origin[1];
|
||||
if (x < ds::clip[0] || x > ds::clip[2] || y < ds::clip[1] || y > ds::clip[3]) return;
|
||||
@@ -1028,11 +1035,41 @@ void print(const char *str, int x, int y) {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
void print(const char *str, int x, int y, uint8_t color) {
|
||||
void old_print(const char *str, int x, int y, uint8_t color) {
|
||||
ds::pen_color=color;
|
||||
print(str, x, y);
|
||||
}
|
||||
|
||||
const uint8_t printchar(uint8_t c, int x, int y) {
|
||||
char_t &chr = fonts[0].chars[c];
|
||||
blit(chr.x, chr.y, chr.w, chr.h, x, y-chr.base);
|
||||
return chr.w;
|
||||
}
|
||||
|
||||
void print(const char* str, int x, int y, uint8_t color) {
|
||||
|
||||
const unsigned char* p = (const unsigned char*)str;
|
||||
uint8_t cp;
|
||||
uint8_t xpos = x;
|
||||
|
||||
uint8_t old_source = getsource();
|
||||
setsource(fonts[0].surface);
|
||||
uint8_t old_color = ds::draw_palette[1];
|
||||
ds::draw_palette[1] = color;
|
||||
while (p[0]!=0) {
|
||||
if (p[0] < 0x80) {
|
||||
cp = p[0];
|
||||
p+=1;
|
||||
} else if ((p[0] & 0xE0) == 0xC0) {
|
||||
cp = (p[0] << 6) | (p[1] & 0x3F);
|
||||
p+=2;
|
||||
}
|
||||
xpos += printchar(cp, xpos, y) + 1;
|
||||
}
|
||||
ds::draw_palette[1] = old_color;
|
||||
setsource(old_source);
|
||||
}
|
||||
|
||||
void clip(int x, int y, int w, int h) {
|
||||
ds::clp[0] = x; ds::clp[1] = y; ds::clp[2] = w; ds::clp[3] = h;
|
||||
recalculate_clip();
|
||||
|
||||
Reference in New Issue
Block a user