aboutsummaryrefslogtreecommitdiff
path: root/include/ubox_vga.h
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-08-28 15:16:12 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-08-28 15:30:25 +0100
commite35cff6d299a07d9b34f303717083a9299a37e82 (patch)
tree7204099ad4978dfc67e04bc11df29d0f366af851 /include/ubox_vga.h
downloaduboxlib-dos-e35cff6d299a07d9b34f303717083a9299a37e82.tar.gz
uboxlib-dos-e35cff6d299a07d9b34f303717083a9299a37e82.zip
Initial import
Diffstat (limited to 'include/ubox_vga.h')
-rw-r--r--include/ubox_vga.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/ubox_vga.h b/include/ubox_vga.h
new file mode 100644
index 0000000..7aee782
--- /dev/null
+++ b/include/ubox_vga.h
@@ -0,0 +1,44 @@
+#ifndef _UBOX_VGA_H
+#define _UBOX_VGA_H
+
+/* palette index to be used as transparent color */
+#ifndef UBOX_TRANSPARENT
+#define UBOX_TRANSPARENT 255
+#endif
+
+typedef struct {
+ uint16_t x;
+ uint16_t y;
+ uint16_t w;
+ uint16_t h;
+} ubox_rect;
+
+uint8_t ubox_open_framebuffer();
+void ubox_close_framebuffer();
+
+uint8_t ubox_set_mode(uint8_t mode);
+void ubox_wait_vsync();
+void ubox_wait_frames(uint16_t frames);
+
+/* the palette is expected to be 8 bit per color, and will be converted to VGA's 6 bit per color */
+void ubox_set_palette(const uint8_t *palette);
+
+#define TARGET_SCREEN 0
+#define TARGET_BUFFER 1
+
+void ubox_blit_target(uint8_t t);
+
+void ubox_blit(const uint8_t *sprite, const ubox_rect *dst);
+/* used for text: skip transparent, ignore 0, replace any other color by c */
+void ubox_blit_c(const uint8_t *sprite, const ubox_rect *dst, uint8_t c);
+/* in src w is sprite width, h is sprite height */
+void ubox_blitrc(const uint8_t *sprite, const ubox_rect *src, const ubox_rect *dst);
+void ubox_blit_erase(uint8_t c);
+
+/* copy from back buffer to screen */
+void ubox_blit_copy_all();
+void ubox_blit_copy(const ubox_rect *dst);
+/* only for 16 width, w is ignored */
+void ubox_blit_copy16(const ubox_rect *dst);
+
+#endif /* _UBOX_VGA_H */