diff --git a/assets/createimg.py b/assets/createimg.py deleted file mode 100644 index 8c32678..0000000 --- a/assets/createimg.py +++ /dev/null @@ -1,248 +0,0 @@ -from PIL import Image - -font8x8_ib8x8u = [ - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0000 (uni0000.dup1) - [0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e], # 0001 (uni0001) - [0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e], # 0002 (uni0002) - [0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00], # 0003 (uni0003) - [0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00], # 0004 (uni0004) - [0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c], # 0005 (uni0005) - [0x10, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c], # 0006 (uni0006) - [0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00], # 0007 (uni0007) - [0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff], # 0008 (uni0008) - [0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00], # 0009 (uni0009) - [0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff], # 000a (uni000A) - [0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78], # 000b (uni000B) - [0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18], # 000c (uni000C) - [0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0], # 000d (uni000D) - [0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0], # 000e (uni000E) - [0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99], # 000f (uni000F) - [0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00], # 0010 (uni0010) - [0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00], # 0011 (uni0011) - [0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18], # 0012 (uni0012) - [0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00], # 0013 (uni0013) - [0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00], # 0014 (uni0014) - [0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0xcc, 0x78], # 0015 (uni0015) - [0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00], # 0016 (uni0016) - [0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff], # 0017 (uni0017) - [0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00], # 0018 (uni0018) - [0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00], # 0019 (uni0019) - [0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00], # 001a (uni001A) - [0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00], # 001b (uni001B) - [0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00], # 001c (uni001C) - [0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00], # 001d (uni001D) - [0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00], # 001e (uni001E) - [0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00], # 001f (uni001F) - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0020 (space) - [0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00], # 0021 (exclam) - [0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00], # 0022 (quotedbl) - [0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00], # 0023 (numbersign) - [0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00], # 0024 (dollar) - [0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00], # 0025 (percent) - [0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00], # 0026 (ampersand) - [0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00], # 0027 (quotesingle) - [0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00], # 0028 (parenleft) - [0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00], # 0029 (parenright) - [0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00], # 002a (asterisk) - [0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00], # 002b (plus) - [0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60], # 002c (comma) - [0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00], # 002d (hyphen) - [0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00], # 002e (period) - [0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00], # 002f (slash) - [0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0x7c, 0x00], # 0030 (zero) - [0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00], # 0031 (one) - [0x78, 0xcc, 0x0c, 0x38, 0x60, 0xc4, 0xfc, 0x00], # 0032 (two) - [0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00], # 0033 (three) - [0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00], # 0034 (four) - [0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00], # 0035 (five) - [0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00], # 0036 (six) - [0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00], # 0037 (seven) - [0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00], # 0038 (eight) - [0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00], # 0039 (nine) - [0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00], # 003a (colon) - [0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0x00], # 003b (semicolon) - [0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00], # 003c (less) - [0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00], # 003d (equal) - [0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00], # 003e (greater) - [0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00], # 003f (question) - [0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x78, 0x00], # 0040 (at) - [0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00], # 0041 (A) - [0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00], # 0042 (B) - [0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00], # 0043 (C) - [0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00], # 0044 (D) - [0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00], # 0045 (E) - [0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00], # 0046 (F) - [0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3e, 0x00], # 0047 (G) - [0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00], # 0048 (H) - [0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00], # 0049 (I) - [0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00], # 004a (J) - [0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00], # 004b (K) - [0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00], # 004c (L) - [0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00], # 004d (M) - [0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00], # 004e (N) - [0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00], # 004f (O) - [0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00], # 0050 (P) - [0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x1c, 0x00], # 0051 (Q) - [0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00], # 0052 (R) - [0x78, 0xcc, 0xe0, 0x70, 0x1c, 0xcc, 0x78, 0x00], # 0053 (S) - [0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00], # 0054 (T) - [0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00], # 0055 (U) - [0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00], # 0056 (V) - [0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00], # 0057 (W) - [0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00], # 0058 (X) - [0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00], # 0059 (Y) - [0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00], # 005a (Z) - [0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00], # 005b (bracketleft) - [0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00], # 005c (backslash) - [0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00], # 005d (bracketright) - [0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00], # 005e (asciicircum) - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff], # 005f (underscore) - [0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00], # 0060 (grave) - [0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00], # 0061 (a) - [0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00], # 0062 (b) - [0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00], # 0063 (c) - [0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00], # 0064 (d) - [0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00], # 0065 (e) - [0x38, 0x6c, 0x60, 0xf0, 0x60, 0x60, 0xf0, 0x00], # 0066 (f) - [0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8], # 0067 (g) - [0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00], # 0068 (h) - [0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00], # 0069 (i) - [0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78], # 006a (j) - [0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00], # 006b (k) - [0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00], # 006c (l) - [0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00], # 006d (m) - [0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00], # 006e (n) - [0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00], # 006f (o) - [0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0], # 0070 (p) - [0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e], # 0071 (q) - [0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0xf0, 0x00], # 0072 (r) - [0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00], # 0073 (s) - [0x10, 0x30, 0x7c, 0x30, 0x30, 0x34, 0x18, 0x00], # 0074 (t) - [0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00], # 0075 (u) - [0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00], # 0076 (v) - [0x00, 0x00, 0xc6, 0xd6, 0xfe, 0xfe, 0x6c, 0x00], # 0077 (w) - [0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00], # 0078 (x) - [0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8], # 0079 (y) - [0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00], # 007a (z) - [0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00], # 007b (braceleft) - [0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00], # 007c (bar) - [0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00], # 007d (braceright) - [0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 007e (asciitilde) - [0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00], # 007f (uni007F) - # --------------------------- 160-255 --------------------------- - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 00a0 (uni00A0) - [0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00], # 00a1 (exclamdown) - [0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18], # 00a2 (cent) - [0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00], # 00a3 (sterling) - [0x00, 0xc6, 0x7c, 0xc6, 0xc6, 0x7c, 0xc6, 0x00], # 00a4 (currency) - [0xcc, 0xcc, 0x78, 0xfc, 0x30, 0xfc, 0x30, 0x30], # 00a5 (yen) - [0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00], # 00a6 (brokenbar) - [0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0xcc, 0x78], # 00a7 (section) - [0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 00a8 (dieresis) - [0x7e, 0x81, 0x9d, 0xa1, 0xa1, 0x9d, 0x81, 0x7e], # 00a9 (copyright) - [0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00], # 00aa (ordfeminine) - [0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00], # 00ab (guillemotleft) - [0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00], # 00ac (logicalnot) - [0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00], # 00ad (uni00AD) - [0x7e, 0x81, 0xb9, 0xa5, 0xb9, 0xa5, 0x81, 0x7e], # 00ae (registered) - [0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 00af (macron) - [0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00], # 00b0 (degree) - [0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0xfc, 0x00], # 00b1 (plusminus) - [0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00], # 00b2 (uni00B2) - [0x70, 0x18, 0x30, 0x18, 0x70, 0x00, 0x00, 0x00], # 00b3 (uni00B3) - [0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00], # 00b4 (acute) - [0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0], # 00b5 (mu) - [0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00], # 00b6 (paragraph) - [0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00], # 00b7 (periodcentered) - [0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x38], # 00b8 (cedilla) - [0x30, 0x70, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00], # 00b9 (uni00B9) - [0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00], # 00ba (ordmasculine) - [0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00], # 00bb (guillemotright) - [0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6f, 0xcf, 0x03], # 00bc (onequarter) - [0xc3, 0xc6, 0xcc, 0xde, 0x33, 0x66, 0xcc, 0x0f], # 00bd (onehalf) - [0xe0, 0x33, 0x66, 0x3c, 0xfb, 0x37, 0x6f, 0xc3], # 00be (threequarters) - [0x30, 0x00, 0x30, 0x60, 0xc0, 0xcc, 0x78, 0x00], # 00bf (questiondown) - [0xc0, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00], # 00c0 (Agrave) - [0x06, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00], # 00c1 (Aacute) - [0x7c, 0xc6, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x00], # 00c2 (Acircumflex) - [0x76, 0xdc, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x00], # 00c3 (Atilde) - [0xc6, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00], # 00c4 (Adieresis) - [0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00], # 00c5 (Aring) - [0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00], # 00c6 (AE) - [0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x18, 0x0c, 0x78], # 00c7 (Ccedilla) - [0xe0, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00], # 00c8 (Egrave) - [0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00], # 00c9 (Eacute) - [0x78, 0xcc, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00], # 00ca (Ecircumflex) - [0xcc, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00], # 00cb (Edieresis) - [0xe0, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00], # 00cc (Igrave) - [0x1c, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00], # 00cd (Iacute) - [0x7e, 0xc3, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00], # 00ce (Icircumflex) - [0xcc, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00], # 00cf (Idieresis) - [0xf8, 0x6c, 0x66, 0xf6, 0x66, 0x6c, 0xf8, 0x00], # 00d0 (Eth) - [0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00], # 00d1 (Ntilde) - [0xc0, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x00], # 00d2 (Ograve) - [0x06, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x00], # 00d3 (Oacute) - [0x7c, 0xc6, 0x38, 0x6c, 0xc6, 0x6c, 0x38, 0x00], # 00d4 (Ocircumflex) - [0x76, 0xdc, 0x38, 0x6c, 0xc6, 0x6c, 0x38, 0x00], # 00d5 (Otilde) - [0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00], # 00d6 (Odieresis) - [0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00, 0x00], # 00d7 (multiply) - [0x3a, 0x6c, 0xce, 0xd6, 0xe6, 0x6c, 0xb8, 0x00], # 00d8 (Oslash) - [0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00], # 00d9 (Ugrave) - [0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00], # 00da (Uacute) - [0x7c, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0x7c, 0x00], # 00db (Ucircumflex) - [0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00], # 00dc (Udieresis) - [0x1c, 0x00, 0xcc, 0xcc, 0x78, 0x30, 0x78, 0x00], # 00dd (Yacute) - [0xf0, 0x60, 0x7c, 0x66, 0x7c, 0x60, 0xf0, 0x00], # 00de (Thorn) - [0x78, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xcc, 0x00], # 00df (germandbls) - [0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00], # 00e0 (agrave) - [0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00], # 00e1 (aacute) - [0x7e, 0xc3, 0x3c, 0x06, 0x3e, 0x66, 0x3f, 0x00], # 00e2 (acircumflex) - [0x76, 0xdc, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00], # 00e3 (atilde) - [0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00], # 00e4 (adieresis) - [0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00], # 00e5 (aring) - [0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00], # 00e6 (ae) - [0x00, 0x00, 0x78, 0xc0, 0xc0, 0x78, 0x0c, 0x38], # 00e7 (ccedilla) - [0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00], # 00e8 (egrave) - [0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00], # 00e9 (eacute) - [0x7e, 0xc3, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00], # 00ea (ecircumflex) - [0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00], # 00eb (edieresis) - [0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00], # 00ec (igrave) - [0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00], # 00ed (iacute) - [0x7c, 0xc6, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00], # 00ee (icircumflex) - [0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00], # 00ef (idieresis) - [0x30, 0x7e, 0x0c, 0x7c, 0xcc, 0xcc, 0x78, 0x00], # 00f0 (eth) - [0x00, 0xf8, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0x00], # 00f1 (ntilde) - [0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00], # 00f2 (ograve) - [0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00], # 00f3 (oacute) - [0x78, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00], # 00f4 (ocircumflex) - [0x76, 0xdc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00], # 00f5 (otilde) - [0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00], # 00f6 (odieresis) - [0x30, 0x30, 0x00, 0xfc, 0x00, 0x30, 0x30, 0x00], # 00f7 (divide) - [0x00, 0x02, 0x7c, 0xce, 0xd6, 0xe6, 0x7c, 0x80], # 00f8 (oslash) - [0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00], # 00f9 (ugrave) - [0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00], # 00fa (uacute) - [0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00], # 00fb (ucircumflex) - [0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00], # 00fc (udieresis) - [0x00, 0x1c, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0x78], # 00fd (yacute) - [0xe0, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0xf0], # 00fe (thorn) - [0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8], # 00ff (ydieresis) -] - -def create_tileset(font_data, tile_size=8, tiles_per_row=16): - num_tiles = len(font_data) - rows = (num_tiles + tiles_per_row - 1) // tiles_per_row - img_width = tiles_per_row * tile_size - img_height = rows * tile_size - image = Image.new('1', (img_width, img_height), 0) # Create a new white image - - for index, char_data in enumerate(font_data): - x = (index % tiles_per_row) * tile_size - y = (index // tiles_per_row) * tile_size - for row in range(tile_size): - for col in range(tile_size): - if char_data[row] & (1 << (7 - col)): - image.putpixel((x + col, y + row), 1) # Set pixel to black - - image.save('font_tileset.png') - -create_tileset(font8x8_ib8x8u) diff --git a/assets/textures/8x8.png b/assets/textures/8x8.png deleted file mode 100644 index 20c8e34..0000000 Binary files a/assets/textures/8x8.png and /dev/null differ diff --git a/data/chunks/chunk_0_0.jsonc b/data/chunks/chunk_0_0.jsonc new file mode 100644 index 0000000..d0724c1 --- /dev/null +++ b/data/chunks/chunk_0_0.jsonc @@ -0,0 +1,45 @@ +{ + "chunk": { + "position": [ 0, 0 ], + "baseLayer": [ + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] + ], + "overlayLayer": [ + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + ], + "entities": [ + ], + "triggers": [ + ] + } +} diff --git a/src/dusk/CMakeLists.txt b/src/dusk/CMakeLists.txt index b01cd93..c736552 100644 --- a/src/dusk/CMakeLists.txt +++ b/src/dusk/CMakeLists.txt @@ -26,4 +26,5 @@ target_sources(${DUSK_TARGET_NAME} add_subdirectory(assert) add_subdirectory(display) add_subdirectory(rpg) -add_subdirectory(util) \ No newline at end of file +add_subdirectory(util) +add_subdirectory(ui) \ No newline at end of file diff --git a/src/dusk/main.c b/src/dusk/main.c index 1d602b2..48d0669 100644 --- a/src/dusk/main.c +++ b/src/dusk/main.c @@ -9,18 +9,21 @@ #include "util/random.h" #include "display/render.h" +#include "ui/ui.h" #include "rpg/entity/entity.h" #include "rpg/world/maps/testmap.h" int32_t main(const int32_t argc, const char **argv) { + renderInit(); inputInit(); randomInit(); - renderInit(); - + + uiInit(); mapSet(TEST_MAP); while(1) { inputUpdate(); + uiUpdate(); mapUpdate(); if(!renderUpdate()) break; } diff --git a/src/dusk/rpg/CMakeLists.txt b/src/dusk/rpg/CMakeLists.txt index 5312e04..8cabe87 100644 --- a/src/dusk/rpg/CMakeLists.txt +++ b/src/dusk/rpg/CMakeLists.txt @@ -10,6 +10,7 @@ target_sources(${DUSK_TARGET_NAME} # Subdirs add_subdirectory(entity) +add_subdirectory(event) add_subdirectory(item) add_subdirectory(quest) add_subdirectory(world) \ No newline at end of file diff --git a/src/dusk/rpg/entity/npc.c b/src/dusk/rpg/entity/npc.c index 342faf8..7ddda17 100644 --- a/src/dusk/rpg/entity/npc.c +++ b/src/dusk/rpg/entity/npc.c @@ -8,6 +8,8 @@ #include "entity.h" #include "assert/assert.h" +#include "ui/uitextbox.h" + void npcInit(entity_t *ent) { assertNotNull(ent, "NPC entity is NULL"); assertTrue(ent->type == ENTITY_TYPE_NPC, "Entity is not an NPC"); @@ -26,6 +28,7 @@ bool_t npcInteract(entity_t *self, entity_t *player) { // Look at the player entityTurn(self, entityGetLookDirection(self, player->x, player->y)); + eventStart(self->npc.event); return true; } \ No newline at end of file diff --git a/src/dusk/rpg/entity/npc.h b/src/dusk/rpg/entity/npc.h index a02332f..14310d2 100644 --- a/src/dusk/rpg/entity/npc.h +++ b/src/dusk/rpg/entity/npc.h @@ -6,12 +6,12 @@ */ #pragma once -#include "dusk.h" +#include "rpg/event/event.h" typedef struct _entity_t entity_t; typedef struct { - uint8_t nothing; // Placeholder for NPC-specific data + const event_t *event; } npc_t; /** diff --git a/src/dusk/rpg/event/CMakeLists.txt b/src/dusk/rpg/event/CMakeLists.txt new file mode 100644 index 0000000..fd0702c --- /dev/null +++ b/src/dusk/rpg/event/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2025 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DUSK_TARGET_NAME} + PRIVATE + event.c +) \ No newline at end of file diff --git a/src/dusk/rpg/event/event.c b/src/dusk/rpg/event/event.c new file mode 100644 index 0000000..b850a97 --- /dev/null +++ b/src/dusk/rpg/event/event.c @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "event.h" +#include "assert/assert.h" +#include "ui/uitextbox.h" +#include "util/memory.h" + +event_t eventCreate() { + event_t event; + return event; +} + +void eventStart(const event_t *event) { + assertNotNull(event, "Event cannot be NULL"); + assertTrue(event->count <= EVENT_ITEMS_MAX, "Event count exceeds maximum items"); + assertTrue(event->count > 0, "Event must have at least one item"); + + switch(event->type) { + case EVENT_TYPE_CONVERSATION: { + assertTrue(event->items[0].type == EVENT_ITEM_TYPE_TEXT, "First item in conversation must be text"); + uiTextboxSetText(event->items[0].text.text); + uiTextboxShow(); + break; + } + default: + assertFalse(true, "Unknown event type"); + } +} \ No newline at end of file diff --git a/src/dusk/rpg/event/event.h b/src/dusk/rpg/event/event.h index 33fd85e..048a225 100644 --- a/src/dusk/rpg/event/event.h +++ b/src/dusk/rpg/event/event.h @@ -8,6 +8,40 @@ #pragma once #include "dusk.h" +typedef enum { + EVENT_TYPE_CONVERSATION, +} eventtype_t; + +typedef enum { + EVENT_ITEM_TYPE_TEXT +} eventitemtype_t; + typedef struct { + const char_t *text; +} eventtext_t; + +typedef struct { + eventitemtype_t type; -} event_t; \ No newline at end of file + union { + eventtext_t text; + }; +} eventitem_t; + +#define EVENT_ITEMS_MAX 16 + +typedef struct { + eventtype_t type; + uint8_t count; + eventitem_t items[EVENT_ITEMS_MAX]; +} event_t; + +/** + * Creates a new event. + */ +event_t eventCreate(); + +/** + * Starts a given event. + */ +void eventStart(const event_t *event); \ No newline at end of file diff --git a/src/dusk/rpg/event/eventtext.h b/src/dusk/rpg/event/eventtext.h new file mode 100644 index 0000000..1e6be71 --- /dev/null +++ b/src/dusk/rpg/event/eventtext.h @@ -0,0 +1,9 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dusk.h" \ No newline at end of file diff --git a/src/dusk/rpg/world/maps/testmap.h b/src/dusk/rpg/world/maps/testmap.h index 1f71ad8..59050eb 100644 --- a/src/dusk/rpg/world/maps/testmap.h +++ b/src/dusk/rpg/world/maps/testmap.h @@ -8,10 +8,21 @@ #pragma once #include "rpg/entity/entity.h" #include "rpg/world/map.h" +#include "rpg/event/event.h" + +const event_t TEST_MAP_NPC_TEST = { + .type = EVENT_TYPE_CONVERSATION, + .count = 1, + .items = { + { + .type = EVENT_ITEM_TYPE_TEXT, + .text = { .text = "Hello, player! How can I help you today?" } + } + }, +}; /** * Initializes the test map. - * * This function sets up a test map with predefined dimensions. */ void testMapInit() { @@ -23,6 +34,7 @@ void testMapInit() { ent++; entityInit(ent, ENTITY_TYPE_NPC); entityPositionSet(ent, 5, 5); + ent->npc.event = &TEST_MAP_NPC_TEST; } mapinfo_t TEST_MAP = { diff --git a/src/dusk/ui/CMakeLists.txt b/src/dusk/ui/CMakeLists.txt new file mode 100644 index 0000000..cdd7163 --- /dev/null +++ b/src/dusk/ui/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2025 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DUSK_TARGET_NAME} + PRIVATE + ui.c + uitextbox.c +) + +# Subdirs \ No newline at end of file diff --git a/src/dusk/ui/ui.c b/src/dusk/ui/ui.c new file mode 100644 index 0000000..4d1539d --- /dev/null +++ b/src/dusk/ui/ui.c @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "ui.h" +#include "util/memory.h" +#include "ui/uitextbox.h" + +ui_t UI; + +void uiInit() { + memoryZero(&UI, sizeof(ui_t)); + uiTextboxInit(); +} + +void uiUpdate() { + uiTextboxUpdate(); +} \ No newline at end of file diff --git a/src/dusk/ui/ui.h b/src/dusk/ui/ui.h new file mode 100644 index 0000000..0f38901 --- /dev/null +++ b/src/dusk/ui/ui.h @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dusk.h" + +typedef enum { + UI_FOCUS_TEXTBOX +} uifocus_t; + +typedef struct { + uint8_t nothing; +} ui_t; + +extern ui_t UI; + +/** + * Initializes the UI system. + */ +void uiInit(); + +/** + * Updates the UI system. + * This function should be called every frame to update the UI state. + */ +void uiUpdate(); \ No newline at end of file diff --git a/src/dusk/ui/uitextbox.c b/src/dusk/ui/uitextbox.c new file mode 100644 index 0000000..d31a3ed --- /dev/null +++ b/src/dusk/ui/uitextbox.c @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "uitextbox.h" +#include "assert/assert.h" +#include "util/memory.h" +#include "display/render.h" +#include "input.h" + +uitextbox_t UI_TEXTBOX; + +void uiTextboxInit() { + memoryZero(&UI_TEXTBOX, sizeof(uitextbox_t)); + + UI_TEXTBOX.width = RENDER_WIDTH; + UI_TEXTBOX.height = 58; + UI_TEXTBOX.x = 0; + UI_TEXTBOX.y = RENDER_HEIGHT - UI_TEXTBOX.height; +} + +void uiTextboxUpdate() { + if(!UI_TEXTBOX.visible) return; + + if(inputWasPressed(INPUT_ACTION)) { + UI_TEXTBOX.visible = false; + } +} + +void uiTextboxSetText(const char_t *text) { + sprintf(UI_TEXTBOX.text, "%s", text); +} + +void uiTextboxShow() { + UI_TEXTBOX.visible = true; +} + +void uiTextboxHide() { + UI_TEXTBOX.visible = false; +} \ No newline at end of file diff --git a/src/dusk/ui/uitextbox.h b/src/dusk/ui/uitextbox.h new file mode 100644 index 0000000..6e62e3e --- /dev/null +++ b/src/dusk/ui/uitextbox.h @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dusk.h" + +#define UI_TEXTBOX_TEXT_MAX_LENGTH 1024 + +typedef struct { + bool_t visible; + + char_t text[UI_TEXTBOX_TEXT_MAX_LENGTH]; + + uint16_t width, height; + uint16_t x, y; +} uitextbox_t; + +extern uitextbox_t UI_TEXTBOX; + +/** + * Initializes the UI textbox. + */ +void uiTextboxInit(); + +/** + * Updates the UI textbox. + */ +void uiTextboxUpdate(); + +/** + * Sets the text of the UI textbox. + * + * @param text The text to set in the textbox. + */ +void uiTextboxSetText(const char_t *text); + +/** + * Shows the UI textbox. + */ +void uiTextboxShow(); + +/** + * Hides the UI textbox. + */ +void uiTextboxHide(); \ No newline at end of file diff --git a/src/duskraylib/display/CMakeLists.txt b/src/duskraylib/display/CMakeLists.txt index b354f11..6187a93 100644 --- a/src/duskraylib/display/CMakeLists.txt +++ b/src/duskraylib/display/CMakeLists.txt @@ -6,5 +6,8 @@ # Sources target_sources(${DUSK_TARGET_NAME} PRIVATE - render.c -) \ No newline at end of file + renderraylib.c +) + +# Subdirs +add_subdirectory(draw) \ No newline at end of file diff --git a/src/duskraylib/display/draw/CMakeLists.txt b/src/duskraylib/display/draw/CMakeLists.txt new file mode 100644 index 0000000..a2e73b7 --- /dev/null +++ b/src/duskraylib/display/draw/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2025 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Sources +target_sources(${DUSK_TARGET_NAME} + PRIVATE + drawentity.c + drawui.c +) \ No newline at end of file diff --git a/src/duskraylib/display/render.c b/src/duskraylib/display/draw/drawentity.c similarity index 65% rename from src/duskraylib/display/render.c rename to src/duskraylib/display/draw/drawentity.c index cfd188f..e2fcade 100644 --- a/src/duskraylib/display/render.c +++ b/src/duskraylib/display/draw/drawentity.c @@ -5,31 +5,13 @@ * https://opensource.org/licenses/MIT */ -#include "assert/assert.h" -#include "display/render.h" -#include "raylib.h" +#include "drawentity.h" #include "rpg/world/map.h" -const uint16_t RENDER_WIDTH = 480; -const uint16_t RENDER_HEIGHT = 270; - -void renderInit() { - InitWindow(RENDER_WIDTH, RENDER_HEIGHT, "Dusk"); - SetTargetFPS(60); -} - -bool_t renderUpdate() { +void drawEntities() { uint8_t x, y; - char_t buffer[64]; - - // End rendering? - if(WindowShouldClose()) return false; - - BeginDrawing(); - ClearBackground(RAYWHITE); - DrawText("Hello, Dusk!", 10, 10, 20, BLACK); - entity_t *ent = MAP.entities; + do { if(ent->type == ENTITY_TYPE_NULL) { ent++; @@ -39,12 +21,6 @@ bool_t renderUpdate() { x = ent->x * ENTITY_WIDTH + ent->subX; y = ent->y * ENTITY_HEIGHT + ent->subY; - // DrawRectangle( - // x, y, - // ENTITY_WIDTH, ENTITY_HEIGHT, - // BLUE - // ); - switch(ent->dir) { case ENTITY_DIR_UP: DrawTriangle( @@ -79,17 +55,9 @@ bool_t renderUpdate() { ); break; default: - assertUnreachable("Invalid entity direction"); + break; } ent++; - } while(ent < (MAP.entities + MAP_ENTITY_COUNT)); - - EndDrawing(); - - return true; -} - -void renderDispose() { - CloseWindow(); + } while(ent->type != ENTITY_TYPE_NULL); } \ No newline at end of file diff --git a/src/duskraylib/display/draw/drawentity.h b/src/duskraylib/display/draw/drawentity.h new file mode 100644 index 0000000..0974cac --- /dev/null +++ b/src/duskraylib/display/draw/drawentity.h @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "display/renderraylib.h" + +/** + * Draws all entities on the map. + */ +void drawEntities(); \ No newline at end of file diff --git a/src/duskraylib/display/draw/drawui.c b/src/duskraylib/display/draw/drawui.c new file mode 100644 index 0000000..41f4c48 --- /dev/null +++ b/src/duskraylib/display/draw/drawui.c @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "drawui.h" +#include "ui/ui.h" +#include "ui/uitextbox.h" + +void drawUITextbox() { + if(!UI_TEXTBOX.visible) return; + + DrawRectangle( + UI_TEXTBOX.x, UI_TEXTBOX.y, + UI_TEXTBOX.width, UI_TEXTBOX.height, + Fade(SKYBLUE, 0.5f) + ); + + DrawTextEx( + FONT, + UI_TEXTBOX.text, + (Vector2){ UI_TEXTBOX.x + 2, UI_TEXTBOX.y + 2 }, + FONT.baseSize, 0, BLACK + ); +} \ No newline at end of file diff --git a/src/duskraylib/display/draw/drawui.h b/src/duskraylib/display/draw/drawui.h new file mode 100644 index 0000000..5eedd99 --- /dev/null +++ b/src/duskraylib/display/draw/drawui.h @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "display/renderraylib.h" + +/** + * Draws the UI textbox. + */ +void drawUITextbox(); \ No newline at end of file diff --git a/src/duskraylib/display/renderraylib.c b/src/duskraylib/display/renderraylib.c new file mode 100644 index 0000000..674b78f --- /dev/null +++ b/src/duskraylib/display/renderraylib.c @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "assert/assert.h" +#include "display/render.h" +#include + +#include "display/draw/drawentity.h" +#include "display/draw/drawui.h" + +const uint16_t RENDER_WIDTH = 480; +const uint16_t RENDER_HEIGHT = 270; +Font FONT; + +void renderInit() { + InitWindow(RENDER_WIDTH, RENDER_HEIGHT, "Dusk"); + SetTargetFPS(60); + + FONT = LoadFontEx( + "../assets/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-latin.otf", + 12, NULL, 0 + ); +} + +bool_t renderUpdate() { + uint8_t x, y; + char_t buffer[64]; + + // End rendering? + if(WindowShouldClose()) return false; + + BeginDrawing(); + ClearBackground(RAYWHITE); + + drawEntities(); + drawUITextbox(); + + EndDrawing(); + + return true; +} + +void renderDispose() { + CloseWindow(); +} \ No newline at end of file diff --git a/src/duskraylib/display/renderraylib.h b/src/duskraylib/display/renderraylib.h new file mode 100644 index 0000000..19b06b8 --- /dev/null +++ b/src/duskraylib/display/renderraylib.h @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "display/render.h" +#include + +extern Font FONT; \ No newline at end of file diff --git a/tools/glsltool/CMakeLists.txt b/tools/glsltool/CMakeLists.txt deleted file mode 100644 index 0880050..0000000 --- a/tools/glsltool/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2025 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Path to the CMake script for converting GLSL to header -set(DUSK_GLSL_TOOL_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/glsltool.cmake CACHE INTERNAL ${DUSK_CACHE_TARGET}) - -# GLSL to C-code -function(glsltool GLSL_FILE) - get_filename_component(GLSL_FILE_NAME_WE ${GLSL_FILE} NAME_WE) - set(GLSL_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) - set(GLSL_FILE_ABSOLUTE ${GLSL_SOURCE_DIRECTORY}/${GLSL_FILE}) - set(GLSL_FILE_PATH ${CMAKE_CURRENT_LIST_DIR}/${GLSL_FILE}) - set(GLSL_FILE_HEADER ${DUSK_GENERATED_HEADERS_DIR}/${GLSL_FILE}.h) - set(GLSL_MISSING_FILE ${DUSK_GENERATED_HEADERS_DIR}/missing_${GLSL_FILE}.h) - - # Ensure the generated files are recompiled - add_custom_command( - OUTPUT - ${GLSL_FILE_HEADER} - ${GLSL_MISSING_FILE} - COMMAND ${CMAKE_COMMAND} -E make_directory ${DUSK_GENERATED_HEADERS_DIR} - COMMAND ${CMAKE_COMMAND} - -DGLSL_FILE_ABSOLUTE=${GLSL_FILE_ABSOLUTE} - -DGLSL_FILE_HEADER=${GLSL_FILE_HEADER} - -DGLSL_FILE_NAME_WE=${GLSL_FILE_NAME_WE} - -DGLSL_SOURCE_DIRECTORY=${GLSL_SOURCE_DIRECTORY} - -P ${DUSK_GLSL_TOOL_SCRIPT} - DEPENDS ${GLSL_FILE_PATH} - COMMENT "Converting ${GLSL_FILE} to header" - ) - - # Trick to always run the command - add_custom_target(GLSL_TOOL_ALWAYS_RUN_${GLSL_FILE} - ALL - DEPENDS - ${GLSL_MISSING_FILE} - ${GLSL_FILE_HEADER} - ) - - add_dependencies(${DUSK_TARGET_NAME} - GLSL_TOOL_ALWAYS_RUN_${GLSL_FILE} - ) -endfunction() \ No newline at end of file diff --git a/tools/glsltool/glsltool.cmake b/tools/glsltool/glsltool.cmake deleted file mode 100644 index 603e74e..0000000 --- a/tools/glsltool/glsltool.cmake +++ /dev/null @@ -1,36 +0,0 @@ -file(READ ${GLSL_FILE_ABSOLUTE} GLSL_FILE_CONTENTS) - -set(INCLUDED_FILES) - -function(resolve_includes CONTENTS OUTPUT) - string(REGEX MATCHALL "#include \"([^\"]+)\"" INCLUDES "${CONTENTS}") - - foreach(INCLUDE ${INCLUDES}) - string(REGEX REPLACE "#include \"([^\"]+)\"" "\\1" INCLUDE_FILE ${INCLUDE}) - get_filename_component(INCLUDE_FILE_ABSOLUTE ${GLSL_SOURCE_DIRECTORY}/${INCLUDE_FILE} ABSOLUTE) - list(FIND INCLUDED_FILES ${INCLUDE_FILE_ABSOLUTE} INCLUDE_FILE_INDEX) - - if(INCLUDE_FILE_INDEX EQUAL -1) - list(APPEND INCLUDED_FILES ${INCLUDE_FILE_ABSOLUTE}) - file(READ ${INCLUDE_FILE_ABSOLUTE} INCLUDED_FILE_CONTENTS) - resolve_includes("${INCLUDED_FILE_CONTENTS}" RESOLVED_CONTENTS) - string(REPLACE "${INCLUDE}" "${RESOLVED_CONTENTS}" CONTENTS "${CONTENTS}") - else() - string(REPLACE "${INCLUDE}" "" CONTENTS "${CONTENTS}") - endif() - endforeach() - - set(${OUTPUT} "${CONTENTS}" PARENT_SCOPE) - set(INCLUDED_FILES ${INCLUDED_FILES} PARENT_SCOPE) -endfunction() - -list(APPEND INCLUDED_FILES ${GLSL_FILE_ABSOLUTE}) -resolve_includes("${GLSL_FILE_CONTENTS}" RESOLVED_GLSL_FILE_CONTENTS) - -# Convert to C string -string(REPLACE "\"" "\\\"" RESOLVED_GLSL_FILE_CONTENTS "${RESOLVED_GLSL_FILE_CONTENTS}") -string(REPLACE "\n" "\\n\"\n\"" RESOLVED_GLSL_FILE_CONTENTS "${RESOLVED_GLSL_FILE_CONTENTS}") -set(RESOLVED_GLSL_FILE_CONTENTS "\"${RESOLVED_GLSL_FILE_CONTENTS}\\n\"") - -# Write to header file -file(WRITE ${GLSL_FILE_HEADER} "const char* ${GLSL_FILE_NAME_WE}ShaderSource = ${RESOLVED_GLSL_FILE_CONTENTS};")