2024-03-25 05:34:59 +00:00
|
|
|
#pragma once
|
|
|
|
#include <iso646.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2024-04-03 23:31:47 +00:00
|
|
|
#include <pthread.h>
|
2024-03-25 05:34:59 +00:00
|
|
|
|
|
|
|
#include "fumotris.h"
|
|
|
|
|
2024-04-03 23:31:47 +00:00
|
|
|
struct TChar4 {
|
2024-03-25 05:34:59 +00:00
|
|
|
char ch;
|
|
|
|
u8 bg : 4;
|
|
|
|
u8 fg : 4;
|
|
|
|
};
|
|
|
|
|
2024-04-03 23:31:47 +00:00
|
|
|
struct Terminal {
|
2024-03-25 05:34:59 +00:00
|
|
|
size_t wid;
|
|
|
|
size_t hgt;
|
|
|
|
size_t area;
|
2024-04-09 07:00:48 +00:00
|
|
|
struct TChar4 *blks;
|
|
|
|
|
2024-04-04 19:43:45 +00:00
|
|
|
size_t buf_size;
|
2024-04-09 07:00:48 +00:00
|
|
|
char *buf;
|
2024-04-03 23:31:47 +00:00
|
|
|
|
2024-04-09 07:00:48 +00:00
|
|
|
u16f refresh_rate;
|
2024-03-25 05:34:59 +00:00
|
|
|
};
|
|
|
|
|
2024-04-09 07:00:48 +00:00
|
|
|
bool NewTerm(struct Terminal *term, size_t wid, size_t hgt);
|
2024-04-04 19:43:45 +00:00
|
|
|
|
2024-04-09 07:00:48 +00:00
|
|
|
bool ResizeTerm(struct Terminal *term, size_t wid, size_t hgt);
|
2024-04-04 19:43:45 +00:00
|
|
|
|
2024-04-09 07:00:48 +00:00
|
|
|
void FreeTerm(struct Terminal *term);
|
2024-03-25 05:34:59 +00:00
|
|
|
|
2024-04-09 07:00:48 +00:00
|
|
|
size_t TermOut(struct Terminal *term);
|