27 lines
610 B
C
27 lines
610 B
C
#ifndef TERMBOX_RENDER_H
|
|
#define TERMBOX_RENDER_H
|
|
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <lua5.3/lualib.h>
|
|
#include <lua5.3/lauxlib.h>
|
|
#include "termbox.h"
|
|
#include "oct_termbox_sprite.h"
|
|
#define OCT_MAX_SPRITE_SIZE 101
|
|
#define OCT_NUM_SPRITES 100
|
|
|
|
void oct_render_termbox_sprite(struct oct_tb_sprite* ots) {
|
|
char shape_copy[OCT_MAX_SPRITE_SIZE];
|
|
strncpy(shape_copy, ots->shape, OCT_MAX_SPRITE_SIZE-1);
|
|
char* line = NULL;
|
|
line = strtok(shape_copy, "\n\r");
|
|
int x = ots->x;
|
|
int y = ots->y;
|
|
|
|
while (line) {
|
|
tb_print(x, y++, ots->fg, ots->bg, line);
|
|
line = strtok(NULL, "\n\r");
|
|
}
|
|
}
|
|
#endif
|