aboutsummaryrefslogtreecommitdiff
path: root/pacc/pacc.h
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-09-08 23:25:51 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-09-08 23:25:51 +0900
commit50c75c12597b230cec4d7a29559cde263025eeb2 (patch)
tree9fa8afe8bcf6e1219186e5c567930831a3b5eab5 /pacc/pacc.h
parent4cfeddd04dcbbf658195bd837d7daff7f08b37bc (diff)
pacc: initial
Diffstat (limited to 'pacc/pacc.h')
-rw-r--r--pacc/pacc.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/pacc/pacc.h b/pacc/pacc.h
new file mode 100644
index 0000000..b3387ac
--- /dev/null
+++ b/pacc/pacc.h
@@ -0,0 +1,53 @@
+#ifndef MYON_PACC_H_INCLUDED
+#define MYON_PACC_H_INCLUDED
+
+#include <stdint.h>
+#include <stdarg.h>
+
+enum pacc_mode {
+ pacc_mode_copy,
+ pacc_mode_color,
+ pacc_mode_color_trans,
+ pacc_mode_count,
+};
+
+enum pacc_buf_mode {
+ pacc_buf_mode_static,
+ pacc_buf_mode_stream,
+};
+
+struct pacc_ctx;
+struct pacc_tex;
+struct pacc_buf;
+
+struct pacc_vtable {
+ void (*pacc_delete)(struct pacc_ctx *pc);
+ struct pacc_buf *(*gen_buf)(
+ struct pacc_ctx *pc, struct pacc_tex *pt, enum pacc_buf_mode mode);
+ struct pacc_tex *(*gen_tex)(struct pacc_ctx *pc, int w, int h);
+ void (*buf_delete)(struct pacc_buf *buf);
+ uint8_t *(*tex_lock)(struct pacc_tex *tex);
+ void (*tex_unlock)(struct pacc_tex *tex);
+ void (*tex_delete)(struct pacc_tex *tex);
+ void (*buf_rect)(
+ const struct pacc_ctx *ctx, struct pacc_buf *buf,
+ int x, int y, int w, int h);
+ void (*buf_rect_off)(
+ const struct pacc_ctx *ctx, struct pacc_buf *buf,
+ int x, int y, int w, int h, int xoff, int yoff);
+ void (*buf_vprintf)(
+ const struct pacc_ctx *ctx, struct pacc_buf *buf,
+ int x, int y, const char *fmt, va_list ap);
+ void (*buf_printf)(
+ const struct pacc_ctx *ctx, struct pacc_buf *buf,
+ int x, int y, const char *fmt, ...);
+ void (*buf_clear)(struct pacc_buf *buf);
+ void (*palette)(struct pacc_ctx *ctx, const uint8_t *rgb, int colors);
+ void (*color)(struct pacc_ctx *ctx, uint8_t pal);
+ void (*begin_clear)(struct pacc_ctx *ctx);
+ void (*draw)(struct pacc_ctx *ctx, struct pacc_buf *buf, enum pacc_mode mode);
+};
+
+struct pacc_ctx *pacc_init_gl(int w, int h, struct pacc_vtable *vt);
+
+#endif // MYON_PACC_H_INCLUDED