-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtgtest.c
42 lines (31 loc) · 910 Bytes
/
tgtest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "tg.h"
#include "tgsys.h"
#include <stdio.h>
#include <stdlib.h>
int main() {
TGContext *context = TG();
wchar_t *str = L"Hello world";
TGSetCursorVisible(false);
TGTitle(L"TG Test 😀");
TGColor yellowForeground = TGColorCreate(TG_GREEN, TGDefaultColor.background);
TGBuffer textBuf = TGBufCreate(15, 1);
textBuf.currentAttributes.color = yellowForeground.id;
TGCalculateAttrs(&textBuf.currentAttributes);
TGBufClear(&textBuf);
TGBufAddString(&textBuf, str);
bool running = true;
while (running) {
TGBufClear(&context->drawBuffer);
TGBufBlit(&textBuf, &context->drawBuffer, (TGPoint) {5, 5});
TGBufAddString(&context->drawBuffer, str);
TGInput input = TGGetInput();
if (!(input.empty || input.eventType != TG_EVENT_KEY) && !input.event.keyEvent.special){
if(input.event.keyEvent.key == L'q'){
running = false;
}
}
TGUpdate();
}
TGEnd();
return 0;
}