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-03 23:31:47 +00:00
|
|
|
u16f refresh_rate;
|
|
|
|
struct TChar4 *blks;
|
|
|
|
|
|
|
|
pthread_mutex_t mutex;
|
|
|
|
pthread_cond_t is_initialized;
|
|
|
|
pthread_cond_t draw_ready;
|
2024-03-25 05:34:59 +00:00
|
|
|
};
|
|
|
|
|
2024-04-03 23:31:47 +00:00
|
|
|
struct Terminal NewTerm(struct TChar4 *blks, size_t wid, size_t hgt);
|
2024-03-25 05:34:59 +00:00
|
|
|
|
2024-04-03 23:31:47 +00:00
|
|
|
size_t TermBufSize(struct Terminal *term);
|
2024-03-25 05:34:59 +00:00
|
|
|
|
2024-04-03 23:31:47 +00:00
|
|
|
size_t TermOut(struct Terminal *term, char *buf, size_t max_chars);
|