Explorar o código

Document textbox's tokens and small format

Eiyeron Fulmincendii %!s(int64=9) %!d(string=hai) anos
pai
achega
9c0ed9d5b9
Modificáronse 2 ficheiros con 21 adicións e 2 borrados
  1. 20 0
      info/textbox_tokens.md
  2. 1 2
      src/textbox/Textbox.cpp

+ 20 - 0
info/textbox_tokens.md

@@ -0,0 +1,20 @@
+# Textbox token list
+## Structure and explanation
+Here's how a token is constructed
+```
+/!\ Big endian.
+0xff[AA][BB][CC][DD]
+AA : Command ID
+BB : Argument 1
+CC : Argument 2
+DD : Argument 3
+```
+The command can read its arguments separated or combine them to make bigger values (like 16-bit integers).
+
+# Command list
+- `0x01` Changes text cursor's color. Further text will be drawn in red.
+    - Arguments : A1-2 (read as big-endian unsigned 16-bit integer)
+    - Default value : 0xFFFF (pure white)
+- `0x81` Changes textbox's delay between letters.
+    - Arguments : A1-2 (read as big-endian unsigned 16-bit integer)
+    - Default value : 0x000A (10)

+ 1 - 2
src/textbox/Textbox.cpp

@@ -41,8 +41,7 @@ Textbox::Textbox(Rect dimensions, Font fnt)
 {
 }
 
-Textbox::Textbox(Font fnt)
-    : Textbox({4, 4, 220, 32}, fnt)
+Textbox::Textbox(Font fnt) : Textbox({4, 4, 220, 32}, fnt)
 {
 }