fixed the TART_CELL_DATA_SIZE and used malloc in the test
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
#include <tart.h>
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
struct tart_window window = tart_create_window();
|
||||
struct tart_buffer mainbuff = tart_create_buffer(109, {20,20},{20,20});
|
||||
struct tart_cell cells[20*20];
|
||||
for(int i = 1; i < 20*20; i += 2) {
|
||||
cells[i] = tart_create_cell('^', TART_STYLE_BOLD, TART_COLOR_BLACK_FOREGROUND, TART_COLOR_WHITE_BACKGROUND);
|
||||
struct tart_buffer mainbuff = tart_create_buffer(109, {100,50},{20,20});
|
||||
struct tart_cell* cells = (struct tart_cell*)malloc(mainbuff.cell_count * sizeof(struct tart_cell));
|
||||
for(int i = 1; i < mainbuff.cell_count; i += 2) {
|
||||
cells[i] = tart_create_cell('^', TART_STYLE_BLINKING, TART_COLOR_BLACK_FOREGROUND, TART_COLOR_WHITE_BACKGROUND);
|
||||
}
|
||||
for(int i = 0; i < + 20*20; i += 2) {
|
||||
cells[i] = tart_create_cell('^', TART_STYLE_BOLD, TART_COLOR_WHITE_BACKGROUND, TART_COLOR_BLACK_BACKGROUND);
|
||||
for(int i = 0; i < + mainbuff.cell_count; i += 2) {
|
||||
cells[i] = tart_create_cell('^', TART_STYLE_BLINKING, TART_COLOR_RED_FOREGROUND, TART_COLOR_BLACK_BACKGROUND);
|
||||
}
|
||||
tart_add_cells_to_buffer(&mainbuff, cells);
|
||||
|
||||
char* t;
|
||||
char t[1] = {'0'};
|
||||
tart_add_buffer(&window, mainbuff);
|
||||
tart_draw_window(&window, t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user