tuxanci2-sdk
SDK for tuxanci2
Log | Files | Refs | README | LICENSE
commit e0df527ae2b814b870d52a6c08bc684ee39aea2a
parent f761d9c3a666787f8e96acbfdaa017e14de16c32
Author: Connor Thomson <connor@gnufault.org>
Date: Mon, 2 Nov 2026 16:35:21 -0800
Add support for shapes
Diffstat:
2 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/include/tuxanci2/abi.h b/include/tuxanci2/abi.h
@@ -7,16 +7,20 @@
#define TA_SYS_DISPLAY_WIDTH 3
#define TA_SYS_DISPLAY_HEIGHT 4
#define TA_SYS_DISPLAY_SPRITE_MODE 5
-#define TA_SYS_KEYBOARD_IS_DOWN 10
-#define TA_SYS_IMAGE_INIT 11
-#define TA_SYS_IMAGE_DRAW 12
-#define TA_SYS_IMAGE_GET_SIZE 13
-#define TA_SYS_TEXT_CREATE 14
-#define TA_SYS_TEXT_WIDTH 15
-#define TA_SYS_TEXT_HEIGHT 16
-#define TA_SYS_TEXT_DRAW 17
-#define TA_SYS_TEXT_DESTROY 18
-#define TA_SYS_SCREEN_REGISTER 19
-#define TA_SYS_SCREEN_SWITCH 20
+#define TA_SYS_KEYBOARD_IS_DOWN 6
+#define TA_SYS_IMAGE_INIT 7
+#define TA_SYS_IMAGE_DRAW 8
+#define TA_SYS_IMAGE_GET_SIZE 9
+#define TA_SYS_TEXT_CREATE 10
+#define TA_SYS_TEXT_WIDTH 11
+#define TA_SYS_TEXT_HEIGHT 12
+#define TA_SYS_TEXT_DRAW 13
+#define TA_SYS_TEXT_DESTROY 14
+#define TA_SYS_SCREEN_REGISTER 15
+#define TA_SYS_SCREEN_SWITCH 16
+#define TA_SYS_SHAPES_PIXEL 17
+#define TA_SYS_SHAPES_RECTANGLE 18
+#define TA_SYS_SHAPES_TRIANGLE 19
+#define TA_SYS_SHAPES_OVAL 20
#endif // TA_ABI_H
diff --git a/include/tuxanci2/shapes.h b/include/tuxanci2/shapes.h
@@ -0,0 +1,27 @@
+#ifndef TA_SHAPES_H
+#define TA_SHAPES_H
+
+#include <tuxanci2/syscall.h>
+#include <tuxanci2/abi.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+static inline bool ta_shapes_draw_pixel(uint32_t x, uint32_t y, uint32_t color) {
+ return ta_syscall(TA_SYS_SHAPES_PIXEL, x, y, color, 0, 0, 0) != 0;
+}
+
+static inline bool ta_shapes_draw_rectangle(uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t color) {
+ return ta_syscall(TA_SYS_SHAPES_RECTANGLE, x, y, width, height, color, 0) != 0;
+}
+
+static inline bool ta_shapes_draw_triangle(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t x3, uint32_t y3, uint32_t color) {
+ uint32_t coordinates[6] = {x1, y1, x2, y2, x3, y3};
+ return ta_syscall(TA_SYS_SHAPES_TRIANGLE, (uint32_t)(size_t)coordinates, color, 0, 0, 0, 0) != 0;
+}
+
+static inline bool ta_shapes_draw_oval(uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t color) {
+ return ta_syscall(TA_SYS_SHAPES_OVAL, x, y, width, height, color, 0) != 0;
+}
+
+#endif // TA_SHAPES_H