22 lines
602 B
C
22 lines
602 B
C
#include "term.h"
|
|
#include "../includes/tart.h"
|
|
|
|
|
|
// windows only
|
|
#include <Windows.h>
|
|
struct tart_vec2 term_current_size() {
|
|
struct tart_vec2 ret;
|
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
|
unsigned int rows = (csbi.srWindow.Right - csbi.srWindow.Left + 1);
|
|
unsigned int cols = (csbi.srWindow.Bottom - csbi.srWindow.Top + 1);
|
|
|
|
unsigned short max_short = 0XFFFF;
|
|
if(rows < max_short && cols < max_short) {
|
|
|
|
ret = (struct tart_vec2){(unsigned short) rows ,(unsigned short) cols};
|
|
}
|
|
|
|
return ret;
|
|
}
|