I've been wanting to make more complicated games, but it requires better and faster graphics to accomplish this. I've made a function which does what I want, draws a sprite to the screen. However, it is awfully slow. Does anyone have a solution to this problem?
void sprite_draw(unsigned char x, unsigned char y, unsigned char *src) { /* Example: const unsigned char enemy2[] = { 10, //how big the image is, 10 = 10x10, 8 = 8x8 ect // This is the actual image, one = pixel on and 0 = pixel off 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,1,0,0, 0,0,0,1,0,0,1,0,0,0, 0,0,1,1,1,1,1,1,0,0, 0,1,1,0,1,1,0,1,1,0, 1,1,1,1,1,1,1,1,1,1, 1,0,1,1,1,1,1,1,0,1, 1,0,1,0,0,0,0,1,0,1, 0,0,0,1,0,0,1,0,0,0 }; */ unsigned char a,b; unsigned short i; a = b = 0; for (i = 1; i <= src[0]*src[0]; i++) { if (a >= src[0]) { b++; a = 0; } if (src[i]) Bdisp_SetPoint_VRAM(x+a,y+b,1); a++; } }
Edited by SopaXorzTaker, 27 August 2018 - 10:23 AM.
Reformatted the code