Fiext tart.h from some errors. Added all functions from tart.h and added testing.

This commit is contained in:
2025-01-26 16:45:23 -08:00
parent f4176f2b85
commit 6beb98a2c1
7 changed files with 88 additions and 38 deletions

View File

@@ -1,3 +1,5 @@
#ifndef TART_H
#define TART_H
// #========================================================================#
// | PreacherDHM:TART
// |
@@ -19,15 +21,20 @@ struct tart_vec2 {
short x,y;
};
struct tart_rgb {
tart_byte r,g,b;
};
/* Tart Cell
*
* This holds a rgb for the foreground and the background.
* Includeing the display character.
*
*/
struct tart_cell {
tart_byte fr,fg,fb;
tart_byte br,bg,bb;
struct tart_rgb foreground;
struct tart_rgb background;
tart_byte style;
char display;
};
@@ -38,44 +45,41 @@ struct tart_cell {
* Allso containes the size of the buffer.
*
* ........................width...............
* ..........<-------------------------------->
*
* ........^ @################################@
*
* ........| #................................#
*
* ........| #................................#
*
* height--| #..........buffer................#
*
* ........| #................................#
*
* ........| #................................#
*
* ........V @################################@
* ..........<-------------------------------->.
* ........^ @################################@.
* ........| #................................#.
* ........| #................................#.
* height--| #.............Buffer.............#.
* ........| #................................#.
* ........| #................................#.
* ........V @################################@.
*/
struct tart_buffer {
int cell_count;
unsigned int cell_count;
tart_byte layer;
tart_vec2 size;
tart_vec2 position;
tart_id id;
struct cell* cells;
struct tart_vec2 size;
struct tart_vec2 position;
struct tart_cell* cells;
};
struct tart_render_manager {
struct tart_buffer buffers[sizeof(tart_byte)];
/* Tart Window
*
* The tart window will have the window size and all of the buffers.
**/
struct tart_window {
struct tart_buffer buffers[0xFF+1];
tart_byte buffer_count;
};
tart_buffer tart_create_buffer(tart_id, struct tart_vec2, struct tart_vect2);
tart_cell tart_create_cell(char, tart_byte, tart_byte, tart_byte, tart_byte, tart_byte, tart_byte);
tart_byte tart_add_buffer(struct tart_render_manager*, struct tart_buffer);
tart_byte tart_set_buffer(struct tart_render_manager*, struct tart_buffer, tart_byte);
struct tart_buffer tart_create_buffer(tart_id, struct tart_vec2, struct tart_vec2);
struct tart_cell tart_create_cell(char, tart_byte, struct tart_rgb, struct tart_rgb);
tart_byte tart_add_buffer(struct tart_window*, struct tart_buffer);
tart_byte tart_set_buffer(struct tart_window*, struct tart_buffer, tart_byte);
tart_buffer& tart_get_buffer(struct tart_render_manager*, tart_byte);
tart_cell& tart_get_cell(struct tart_buffer*, int);
tart_cell tart_set_cell(struct tart_buffer*, tart_cell,int);
struct tart_buffer* tart_get_buffer(struct tart_window*, tart_byte);
struct tart_cell* tart_get_cell(struct tart_buffer*, int);
struct tart_cell* tart_set_cell(struct tart_buffer*, struct tart_cell*,int);
#endif