aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2017-05-04 11:48:08 +0200
committerAlex Auvolat <alex@adnab.me>2017-05-04 11:48:08 +0200
commit9bb1c5371affb2ff0b83256470dec7461b404264 (patch)
tree9db7cd56713864a07f047572bfa2d55a5a9933dd
parent1161e1d8be014945266017cb0ce735537a287677 (diff)
downloadkogata-9bb1c5371affb2ff0b83256470dec7461b404264.tar.gz
kogata-9bb1c5371affb2ff0b83256470dec7461b404264.zip
Beginning of tk.lua
-rwxr-xr-xmake_cdrom.sh2
-rw-r--r--res/fonts/Makefile19
-rw-r--r--res/fonts/muazzam.s2006
-rw-r--r--src/lib/include/kogata/draw.h4
-rw-r--r--src/lib/libkogata/draw.c33
-rw-r--r--src/sysapp/login/main.lua12
-rw-r--r--src/sysbin/lx/lxdrawlib.c6
-rw-r--r--src/sysbin/terminal/main.c6
-rw-r--r--src/syslua/lx/gui.lua6
-rw-r--r--src/syslua/lx/tk.lua97
10 files changed, 151 insertions, 2040 deletions
diff --git a/make_cdrom.sh b/make_cdrom.sh
index cb402af..783c906 100755
--- a/make_cdrom.sh
+++ b/make_cdrom.sh
@@ -40,7 +40,6 @@ done
mkdir -p cdrom/sys/fonts
cp build/fonts/*.bf cdrom/sys/fonts
-cp build/fonts/pcvga.bf cdrom/sys/fonts/default.bf
cp res/fonts/*.ttf cdrom/sys/fonts
mkdir -p cdrom/sys/keymaps
@@ -56,6 +55,7 @@ mkdir -p cdrom/sys/app
cp -r src/sysapp/* cdrom/sys/app
cp README.md cdrom
+cp res/kogata-logo.png cdrom/logo.png
# Setup config files
diff --git a/res/fonts/Makefile b/res/fonts/Makefile
deleted file mode 100644
index 758bbcf..0000000
--- a/res/fonts/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-CC=gcc
-CFLAGS=-I../../src/lib/include/proto -std=c11
-AS=nasm
-ASFLAGS=-fbin
-
-all: pcvga.bf muazzam.bf
-
-%.bf: %.c
- $(CC) $(CFLAGS) -o $<.bin $<
- ./$<.bin > $@
- rm $<.bin
-
-%.bf: %.s
- $(AS) $(ASFLAGS) -o $@ $<
-
-clean:
- rm *.bf || exit 0
-
-rebuild: clean all
diff --git a/res/fonts/muazzam.s b/res/fonts/muazzam.s
deleted file mode 100644
index 43c74a8..0000000
--- a/res/fonts/muazzam.s
+++ /dev/null
@@ -1,2006 +0,0 @@
-;---------------------------------------------------------;
-; Written by: Muazzam Ali Kazmi ;
-; Public domain ;
-;---------------------------------------------------------;
-
-magic:
- dd 0xD184C274
-glyph_geom:
- dw 8, 16
-nchars:
- dd 127
-
-times 512 db 0
-
-.space: ;[space]
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
-.exclamation: ;!
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00000000b
- db 00010000b
- db 00000000b
- db 00000000b
- db 00000000b
-
-.quotation: ;"
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 01101100b
- db 01001000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.hash: ;#
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00100010b
- db 00100010b
- db 01111111b
- db 00100010b
- db 01000100b
- db 01000100b
- db 11111111b
- db 01000100b
- db 01000100b
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.dollor: ;$
- db 00000000b
- db 00000000b
- db 00000000b
- db 00010000b
-
- db 00111100b
- db 01010010b
- db 01010000b
- db 01010000b
- db 00111100b
- db 00010010b
- db 00010010b
- db 01010010b
- db 00111100b
-
- db 00010000b
- db 00000000b
- db 00000000b
-
-
-.percent: ;%
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000010b
- db 00100010b
- db 01010100b
- db 00100100b
- db 00001000b
- db 00001010b
- db 00010101b
- db 00010010b
- db 00100000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.ampersand: ;&
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00110000b
- db 01001000b
- db 00110000b
- db 00110100b
- db 01001000b
- db 01000101b
- db 00111110b
- db 00000001b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.apostrophe: ;'
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00010000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.parenthesis.left: ;(
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00100000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 00100000b
- db 00011000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.parenthesis.right: ;)
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00000100b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000100b
- db 00011000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.astrisk: ;*
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00101010b
- db 00011100b
- db 00011100b
- db 00101010b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.plus: ;+
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 01111111b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.comma: ;,
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00011000b
- db 00011000b
-
- db 00001000b
- db 00010000b
- db 00000000b
-
-
-.minus: ;-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 01111110b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.fullStop: ;.
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00011000b
- db 00011000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.slash: ;/
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000010b
- db 00000010b
- db 00000100b
- db 00000100b
- db 00001000b
- db 00001000b
- db 00010000b
- db 00010000b
- db 00100000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-;Numbers
-;
-
-.zero: ;0
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00100100b
- db 01000010b
- db 01000010b
- db 01011010b
- db 01000010b
- db 01000010b
- db 00100100b
- db 00011000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.one: ;1
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00010000b
- db 00110000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00111000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.two: ;2
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 00000010b
- db 00000100b
- db 00001000b
- db 00010000b
- db 00100000b
- db 01000000b
- db 01111110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.three: ;3
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 00000010b
- db 00000100b
- db 00111000b
- db 00000100b
- db 00000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.four: ;4
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00001100b
- db 00010100b
- db 00100100b
- db 01000100b
- db 01000100b
- db 01111110b
- db 00000100b
- db 00000100b
- db 00000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.five: ;5
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111110b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111100b
- db 00000010b
- db 00000010b
- db 00000010b
- db 01111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.six: ;6
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.seven: ;7
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111110b
- db 00000010b
- db 00000100b
- db 00001000b
- db 00001000b
- db 00010000b
- db 00010000b
- db 00100000b
- db 00100000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.eight: ;8
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.nine: ;9
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111110b
- db 00000010b
- db 00000010b
- db 00000100b
- db 00011000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.colon: ;:
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00011000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00011000b
- db 00011000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.semicolon: ;;
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00011000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00011000b
- db 00011000b
- db 00001000b
- db 00010000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.less: ;<
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000100b
- db 00001000b
- db 00010000b
- db 00100000b
- db 01000000b
- db 00100000b
- db 00010000b
- db 00001000b
- db 00000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.equal: ;=
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 01111110b
- db 00000000b
- db 01111110b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.greater: ;>
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00100000b
- db 00010000b
- db 00001000b
- db 00000100b
- db 00000010b
- db 00000100b
- db 00001000b
- db 00010000b
- db 00100000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.question: ;?
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 00000010b
- db 00000100b
- db 00001000b
- db 00010000b
- db 00010000b
- db 00000000b
- db 00010000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.at: ;@
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 01000010b
- db 01001110b
- db 01010010b
- db 01001110b
- db 01000000b
- db 01000000b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-;Upper case
-;
-
-.A:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00100100b
- db 01000010b
- db 01000010b
- db 01111110b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.B:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.C:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111110b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 00111110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.D:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111000b
- db 01000100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000100b
- db 01111000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.E:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111110b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111110b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.F:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111110b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111110b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.G:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01001110b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.H:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111110b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.I:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00111000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.J:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00001110b
- db 00000100b
- db 00000100b
- db 00000100b
- db 00000100b
- db 00000100b
- db 01000100b
- db 01000100b
- db 00111000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.K:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000010b
- db 01000100b
- db 01001000b
- db 01010000b
- db 01100000b
- db 01010000b
- db 01001000b
- db 01000100b
- db 01000010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.L:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111111b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.M:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01100110b
- db 01100110b
- db 01100110b
- db 01011010b
- db 01011010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.N:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01100010b
- db 01100010b
- db 01100010b
- db 01010010b
- db 01010010b
- db 01001010b
- db 01001010b
- db 01000110b
- db 01000110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.O:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.P:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111100b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.Q:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01001010b
- db 01000110b
- db 00111110b
-
- db 00000001b
- db 00000000b
- db 00000000b
-
-
-.R:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111100b
- db 01100000b
- db 01010000b
- db 01001000b
- db 01000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.S:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111100b
- db 01000010b
- db 01000000b
- db 01000000b
- db 00111100b
- db 00000010b
- db 00000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.T:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111111b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.U:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.V:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00100100b
- db 00100100b
- db 00011000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.W:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01011010b
- db 01011010b
- db 01100110b
- db 01100110b
- db 01100110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.X:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000100b
- db 01000100b
- db 00101000b
- db 00101000b
- db 00010000b
- db 00010000b
- db 00101000b
- db 01000100b
- db 01000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.Y:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000100b
- db 01000100b
- db 00101000b
- db 00101000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.Z:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111110b
- db 00000100b
- db 00001000b
- db 00001000b
- db 00010000b
- db 00010000b
- db 00100000b
- db 01000000b
- db 01111110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.squreBracket.left: ;[
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01111000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01111000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-.backSlash: ; back slash
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000000b
- db 01000000b
- db 00100000b
- db 00100000b
- db 00010000b
- db 00010000b
- db 00001000b
- db 00001000b
- db 00000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-
-.squreBracket.right: ;]
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011110b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00000010b
- db 00011110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.caret: ;^
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00001000b
- db 00010100b
- db 00100010b
- db 01000001b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.underScore: ;_
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 11111111b
- db 00000000b
- db 00000000b
-
-
-.graveAccent: ;`
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011000b
- db 00001000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-
-
-;Lower case
-;
-.a:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01111100b
- db 00000010b
- db 00000010b
- db 00111110b
- db 01000010b
- db 01000010b
- db 00111101b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.b:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000000b
- db 01000000b
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.c:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00111100b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 01000000b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.d:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000100b
- db 00000100b
- db 00111100b
- db 01000100b
- db 01000100b
- db 01000100b
- db 01000100b
- db 01000100b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.e:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00111100b
- db 01000010b
- db 01000010b
- db 01111110b
- db 01000000b
- db 01000000b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.f:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00011100b
- db 00100000b
- db 00100000b
- db 01111100b
- db 00100000b
- db 00100000b
- db 00100000b
- db 00100000b
- db 00100000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.g:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00111110b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111110b
- db 00000010b
- db 00000010b
-
- db 01111100b
- db 00000000b
- db 00000000b
-
-
-.h:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000000b
- db 01000000b
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.i:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00001000b
- db 00000000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.j:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00001000b
- db 00000000b
- db 00011100b
- db 00000100b
- db 00000100b
- db 00000100b
- db 00000100b
- db 00000100b
- db 00000100b
-
- db 00111000b
- db 00000000b
- db 00000000b
-
-
-.k:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 01000000b
- db 01000000b
- db 01000000b
- db 01001000b
- db 01010000b
- db 01100000b
- db 01010000b
- db 01001000b
- db 01000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.l:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00111000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00000110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.m:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 11110110b
- db 00101010b
- db 00101010b
- db 00101010b
- db 00101010b
- db 00101010b
- db 00101010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.n:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01111100b
- db 00100010b
- db 00100010b
- db 00100010b
- db 00100010b
- db 00100010b
- db 00100010b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.o:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.p:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01111100b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01111100b
- db 01000000b
- db 01000000b
-
- db 01000000b
- db 00000000b
- db 00000000b
-
-
-.q:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00111110b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111110b
- db 00000010b
- db 00000010b
-
- db 00000010b
- db 00000000b
- db 00000000b
-
-
-.r:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00101111b
- db 00110000b
- db 00100000b
- db 00100000b
- db 00100000b
- db 00100000b
- db 00100000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.s:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00111100b
- db 01000000b
- db 01000000b
- db 00111100b
- db 00000010b
- db 00000010b
- db 00111100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.t:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00010000b
- db 00010000b
- db 01111100b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00001110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.u:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00111110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.v:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00100100b
- db 00100100b
- db 00011000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.w:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01000010b
- db 01000010b
- db 01000010b
- db 01011010b
- db 01011010b
- db 01100110b
- db 01100110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.x:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01000100b
- db 01000100b
- db 00101000b
- db 00010000b
- db 00101000b
- db 01000100b
- db 01000100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.y:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01000010b
- db 01000010b
- db 01000010b
- db 00100100b
- db 00011000b
- db 00001000b
- db 00010000b
-
- db 01100000b
- db 00000000b
- db 00000000b
-
-
-.z:
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00000000b
- db 00000000b
- db 01111110b
- db 00000100b
- db 00001000b
- db 00010000b
- db 00100000b
- db 01000000b
- db 01111110b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.curlyBracket.left: ;{
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00001100b
- db 00010000b
- db 00010000b
- db 00010000b
- db 01100000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00001100b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.verticalBar: ;|
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
- db 00010000b
-
- db 00010000b
- db 00000000b
- db 00000000b
-
-
-.curlyBracket.right: ;}
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
- db 00110000b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00000110b
- db 00001000b
- db 00001000b
- db 00001000b
- db 00110000b
-
- db 00000000b
- db 00000000b
- db 00000000b
-
-
-.tilde: ;~
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00110010b
- db 01001100b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
- db 00000000b
-
-
diff --git a/src/lib/include/kogata/draw.h b/src/lib/include/kogata/draw.h
index 470ab4c..d96f2ee 100644
--- a/src/lib/include/kogata/draw.h
+++ b/src/lib/include/kogata/draw.h
@@ -63,8 +63,8 @@ font_t *g_load_ttf_font(const char* filename);
void g_incref_font(font_t *f);
void g_decref_font(font_t *f);
-int g_text_width(font_t *f, const char* text);
-int g_text_height(font_t *f, const char* text);
+int g_text_width(font_t *f, const char* text, int size);
+int g_text_height(font_t *f, const char* text, int size);
void g_write(fb_t *fb, int x, int y, const char* text, font_t *font, int size, color_t c);
diff --git a/src/lib/libkogata/draw.c b/src/lib/libkogata/draw.c
index 662b0d5..14f1dcf 100644
--- a/src/lib/libkogata/draw.c
+++ b/src/lib/libkogata/draw.c
@@ -433,16 +433,43 @@ void g_decref_font(font_t *f) {
}
}
-int g_text_width(font_t *font, const char* text) {
+int g_text_width(font_t *font, const char* text, int size) {
if (font->type == FONT_ASCII_BITMAP) {
return font->ascii_bitmap.cw * strlen(text);
+ } else if (font->type == FONT_STBTT) {
+ float scale = stbtt_ScaleForPixelHeight(&font->stbtt.info, size);
+ float xpos = 1;
+ while (*text != 0) {
+ int codepoint = *text; // TODO utf8
+ text++;
+
+ int advance, lsb;
+ stbtt_GetCodepointHMetrics(&font->stbtt.info, codepoint, &advance, &lsb);
+ xpos += scale * advance;
+ if (*(text+1))
+ xpos += scale * stbtt_GetCodepointKernAdvance(&font->stbtt.info, *text, *(text+1));
+ }
+ return ceil(xpos);
+
}
return 0;
}
-int g_text_height(font_t *font, const char* text) {
+int g_text_height(font_t *font, const char* text, int size) {
if (font->type == FONT_ASCII_BITMAP) {
return font->ascii_bitmap.ch;
+ } else if (font->type == FONT_STBTT) {
+ float scale = stbtt_ScaleForPixelHeight(&font->stbtt.info, size);
+ int max_h = 0;
+ while (*text != 0) {
+ int codepoint = *text; // TODO utf8
+ text++;
+
+ int x0, y0, x1, y1;
+ stbtt_GetCodepointBitmapBox(&font->stbtt.info, codepoint, scale, scale, &x0, &y0, &x1, &y1);
+ if (y1 - y0 > max_h) max_h = y1 - y0;
+ }
+ return max_h;
}
return 0;
}
@@ -501,7 +528,7 @@ void g_write(fb_t *fb, int x, int y, const char* text, font_t *font, int size, c
int sx = (fb->geom.memory_model == FB_MM_RGB32 ? 4 : 3);
for (int i = 0; i < h; i++) {
- int yy = y + y0 + i;
+ int yy = y + size + y0 + i;
if (yy < 0) continue;
if (yy >= fb->geom.height) continue;
uint8_t *line = fb->data + yy * fb->geom.pitch;
diff --git a/src/sysapp/login/main.lua b/src/sysapp/login/main.lua
index de258b9..6be064d 100644
--- a/src/sysapp/login/main.lua
+++ b/src/sysapp/login/main.lua
@@ -6,6 +6,8 @@ local draw = require 'lx.draw'
local gui = require 'lx.gui'
local mainloop = require 'lx.mainloop'
+local tk = require 'lx.tk'
+
print("Hello, world!")
gui.open()
@@ -17,8 +19,13 @@ for x = 0, 255, 16 do
end
end
+local f = draw.load_image('root:/logo.png')
+local img = tk.image_widget(f)
+tk.init(gui, img)
+
gui.show_cursor()
+--[[
local fnt = draw.load_ttf_font('sys:/fonts/vera.ttf')
if fnt == nil then
print("Could not load vera.ttf!")
@@ -32,7 +39,7 @@ gui.on_mouse_down = function (lb, rb, mb)
gui.hide_cursor()
gui.surface:write(gui.mouse_x, gui.mouse_y, string.format("Click at %d, %d", gui.mouse_x, gui.mouse_y), fnt, 16, gui.surface:rgb(0, 0, 255))
txt_x = gui.mouse_x
- txt_y = gui.mouse_y + fnt:text_height(" ")
+ txt_y = gui.mouse_y + 16
gui.show_cursor()
end
end
@@ -40,9 +47,10 @@ end
gui.on_text_input = function(chr)
gui.hide_cursor()
gui.surface:write(txt_x, txt_y, chr, fnt, 16, gui.surface:rgb(0, 0, 255))
- txt_x = txt_x + fnt:text_width(chr)
+ txt_x = txt_x + fnt:text_width(chr, 16)
gui.show_cursor()
end
+--]]
mainloop.run()
diff --git a/src/sysbin/lx/lxdrawlib.c b/src/sysbin/lx/lxdrawlib.c
index 22c6a3b..1a24fcb 100644
--- a/src/sysbin/lx/lxdrawlib.c
+++ b/src/sysbin/lx/lxdrawlib.c
@@ -90,16 +90,18 @@ static int font_gc(lua_State *L) {
static int font_text_width(lua_State *L) {
drawlib_font *f = (drawlib_font*)luaL_checkudata(L, 1, FONT);
const char* txt = luaL_checkstring(L, 2);
+ int size = luaL_checkinteger(L, 3);
- lua_pushinteger(L, g_text_width(f->font, txt));
+ lua_pushinteger(L, g_text_width(f->font, txt, size));
return 1;
}
static int font_text_height(lua_State *L) {
drawlib_font *f = (drawlib_font*)luaL_checkudata(L, 1, FONT);
const char* txt = luaL_checkstring(L, 2);
+ int size = luaL_checkinteger(L, 3);
- lua_pushinteger(L, g_text_height(f->font, txt));
+ lua_pushinteger(L, g_text_height(f->font, txt, size));
return 1;
}
diff --git a/src/sysbin/terminal/main.c b/src/sysbin/terminal/main.c
index 4805f9d..77bf141 100644
--- a/src/sysbin/terminal/main.c
+++ b/src/sysbin/terminal/main.c
@@ -101,10 +101,10 @@ int main(int argc, char **argv) {
term.kb = init_keyboard();
ASSERT(term.kb != 0);
- term.font = g_load_ascii_bitmap_font("sys:/fonts/default.bf");
+ term.font = g_load_ascii_bitmap_font("sys:/fonts/pcvga.bf");
ASSERT(term.font != 0);
- term.cw = g_text_width(term.font, "#");
- term.ch = g_text_height(term.font, "#");
+ term.cw = g_text_width(term.font, "#", 8);
+ term.ch = g_text_height(term.font, "#", 8);
gip_handler_t *h = new_gip_handler(&term_gip_cb, &term);
ASSERT(h != 0);
diff --git a/src/syslua/lx/gui.lua b/src/syslua/lx/gui.lua
index 23e6cb6..35e73b8 100644
--- a/src/syslua/lx/gui.lua
+++ b/src/syslua/lx/gui.lua
@@ -121,6 +121,8 @@ end
function gui.on_mouse(dx, dy, dw, lb, rb, mb)
if dx ~= 0 or dy ~= 0 then
+ local prev_x, prev_y = gui.mouse_x, gui.mouse_y
+
local csr = gui.cursor_visible
if csr then gui.hide_cursor() end
@@ -133,7 +135,7 @@ function gui.on_mouse(dx, dy, dw, lb, rb, mb)
if csr then gui.show_cursor() end
- gui.on_mouse_move(gui.mouse_x, gui.mouse_y)
+ gui.on_mouse_move(prev_x, prev_y, gui.mouse_x, gui.mouse_y)
end
if lb == 1 and not gui.mouse_lbtn then
@@ -153,7 +155,7 @@ function gui.on_mouse(dx, dy, dw, lb, rb, mb)
end
end
-function gui.on_mouse_move(x, y)
+function gui.on_mouse_move(prev_x, prev_y, x, y)
-- Nothing, can be replaced :)
end
diff --git a/src/syslua/lx/tk.lua b/src/syslua/lx/tk.lua
new file mode 100644
index 0000000..0b0c69c
--- /dev/null
+++ b/src/syslua/lx/tk.lua
@@ -0,0 +1,97 @@
+local draw = require 'lx.draw'
+local sys = require 'lx.sys'
+
+local tk = {}
+
+function tk.widget(width, height)
+ local w = {
+ width = width,
+ height = height,
+ }
+
+ function w:resize(width, height)
+ w.width = width
+ w.height = height
+ end
+
+ function w:get_draw_buffer(x0, y0, w, h)
+ -- Replaced by parent by a function that returns the buffer for
+ return nil
+ end
+
+ function w:redraw(x0, y0, w, h)
+ -- Replaced by widget code by a function that does the actual drawing
+ end
+
+ function w:on_mouse_down(lb, rb, mb)
+ -- Handler for mouse down event
+ end
+
+ function w:on_mouse_up(lb, rb, mb)
+ -- Handler for mouse up event
+ end
+
+ function w:on_mouse_move(prev_x, prev_y, new_x, new_y)
+ -- Handler for mouse move event
+ end
+
+ function w:on_text_input(char)
+ -- Handler for text input
+ end
+
+ function w:on_key_down(key)
+ -- Handler for key press
+ end
+
+ function w:on_key_up(key)
+ -- Handler for key release
+ end
+
+ return w
+end
+
+function tk.init(gui, root_widget)
+ tk.fonts = {
+ default = draw.load_ttf_font("sys:/fonts/vera.ttf")
+ }
+
+ root_widget:resize(gui.surface:width(), gui.surface:height())
+
+ gui.on_key_down = function(key) root_widget:on_key_down(key) end
+ gui.on_key_up = function(key) root_widget:on_key_up(key) end
+ gui.on_text_input = function(key) root_widget:on_text_input(char) end
+ gui.on_mouse_move = function(ox, oy, nx, ny) root_widget:on_mouse_move(ox, oy, nx, ny) end
+ gui.on_mouse_down = function(lb, rb, mb) root_widget:on_mouse_down(lb, rb, mb) end
+ gui.on_mouse_up = function(lb, rb, mb) root_widget:on_mouse_up(lb, rb, mb) end
+
+ function root_widget:get_draw_buffer(x0, y0, w, h)
+ return gui.surface:sub(x0, y0, w, h)
+ end
+
+ root_widget:redraw(0, 0, root_widget.width, root_widget.height)
+end
+
+function tk.image_widget(img)
+ local image = tk.widget(img:width(), img:height())
+ image.img = img
+
+ function image:redraw(x0, y0, w, h)
+ local buf = self:get_draw_buffer(x0, y0, w, h)
+ if buf == nil then return end
+
+ for x = x0 - (x0 % 32), x0 + w, 32 do
+ for y = y0 - (y0 % 32), y0 + h, 32 do
+ buf:fillrect(x - x0, y - y0, 16, 16, buf:rgb(150, 150, 150))
+ buf:fillrect(x - x0 + 16, y - y0 + 16, 16, 16, buf:rgb(150, 150, 150))
+ buf:fillrect(x - x0 + 16, y - y0, 16, 16, buf:rgb(200, 200, 200))
+ buf:fillrect(x - x0, y - y0 + 16, 16, 16, buf:rgb(200, 200, 200))
+ end
+ end
+ buf:blit(0, 0, self.img:sub(x0, y0, self.img:width(), self.img:height()))
+ end
+
+ return image
+end
+
+
+return tk