From 0ffa9e9484d42a67316dcf6ec4d930869db207be Mon Sep 17 00:00:00 2001 From: mibi88 Date: Mon, 16 Jan 2023 19:41:49 +0100 Subject: [PATCH] Added ext/img.h --- microfx_src/Makefile | 2 +- microfx_src/include/microfx/ext/img.h | 20 +++++++++++++++++ microfx_src/src/img.c | 29 +++++++++++++++++++++++++ template/lib/include/microfx/ext/img.h | 20 +++++++++++++++++ template/lib/libMicrofx.a | Bin 5232 -> 6140 bytes 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 microfx_src/include/microfx/ext/img.h create mode 100644 microfx_src/src/img.c create mode 100644 template/lib/include/microfx/ext/img.h diff --git a/microfx_src/Makefile b/microfx_src/Makefile index 94387ab..482b46c 100644 --- a/microfx_src/Makefile +++ b/microfx_src/Makefile @@ -4,7 +4,7 @@ AR = sh-elf-ar OUT = libMicrofx.a OUT_DIR = lib -SRC = src/start.c src/syscall.S src/microfx.c +SRC = src/start.c src/syscall.S src/microfx.c src/img.c OBJ = $(SRC:src/%=build/%.o) BUILD = build diff --git a/microfx_src/include/microfx/ext/img.h b/microfx_src/include/microfx/ext/img.h new file mode 100644 index 0000000..32be80d --- /dev/null +++ b/microfx_src/include/microfx/ext/img.h @@ -0,0 +1,20 @@ +#ifndef IMG_H +#define IMG_H + +enum {SNORMAL = 0, SINVERTED, STRANSP, SNOWHITE, SNOBLACK}; + +/* void simage(int sx, int sy, int w, int h, unsigned char *img, int mode); + +Draws an image from a Sprite Coder string that is in img, +where the top left corner is at (sx, sy). +w is the width and h the height of the image. +mode can be : +SNORMAL : Draws the image normally. +SINVERTED : Draws the image with inverted colors. +STRANSP : Black is white and white is not drawn. Useful for +transparency in sprites. +*/ + +void simage(int sx, int sy, int w, int h, unsigned char *img, int mode); + +#endif diff --git a/microfx_src/src/img.c b/microfx_src/src/img.c new file mode 100644 index 0000000..befb6f2 --- /dev/null +++ b/microfx_src/src/img.c @@ -0,0 +1,29 @@ +#include "../include/microfx/ext/img.h" +#include + +void simage(int sx, int sy, int w, int h, unsigned char *img, int mode) { + /* Draws an image from a sprite coder string */ + int x, y, rpos, gpos, bpos, color; + for(y=0;yiA5!P$$I(v5CJ!EzA#N w^0RSp8i2Ji03{39)LH)kc@2{VM1UG=fK2hpD|nQ|7#9GURzM5`AO|r307EvTaR2}S delta 261 zcmeyP|3PDdT)ly%g^_}SfdU91lL`uEhCm50NZ?{%U{GRUU|PYz!1jlFnCAh5B?FKk z5yuyoBo>uy_U8&`oNUNcEd}Q4CF|wuL!4`9W^Qa@3G&$Hb4&p&EFjk8b4=o!E!j`9 KB6zaA@$3MKaX(W4