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;y