moved tim.h to include/

This commit is contained in:
2026-01-09 02:35:38 +05:00
parent f7b4809db8
commit 025cede850
12 changed files with 26 additions and 28 deletions

1
.vscode/.gitignore vendored Executable file
View File

@@ -0,0 +1 @@
settings.json

15
.vscode/c_cpp_properties.json vendored Executable file
View File

@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "all",
"defines": [],
"includePath": [
"src",
"include",
"${default}"
],
"cStandard": "c99"
}
],
"version": 4
}

View File

@@ -1,7 +1,7 @@
// Display a yes/no dialog with a message. Returns with 0 when yes was clicked.
// syntax: ./ask "message"
#include "../tim.h"
#include "tim.h"
// colors
#define CTXT 0xf // text black, white
@@ -47,4 +47,3 @@ int main(int argc, char** argv) {
}
}
}

View File

@@ -1,4 +1,4 @@
#include "../tim.h"
#include "tim.h"
int main(void) {
while (tim_run(0)) { // event loop
@@ -13,4 +13,3 @@ int main(void) {
}
} //TODO: remove atexit cleanup
}

View File

@@ -1,6 +1,6 @@
// Simple game of snake to show how to do animation and draw cells.
#include "../tim.h"
#include "tim.h"
#define FG 0x10
#define BG 0xdd
@@ -127,4 +127,3 @@ int main(void) {
}
}
}

View File

@@ -1,6 +1,5 @@
#pragma once
// libc
#include <limits.h>
#include <signal.h>
#include <stdint.h>

View File

@@ -1,3 +1,5 @@
CFLAGS+=-Iinclude -Isrc -g
all: bin/test bin/string bin/color bin/hello bin/ask bin/snek
bin/test: test/test.c bin

View File

@@ -5,20 +5,7 @@ Demo video: https://asciinema.org/a/zn3p0dsVCOQOzwY1S9gDfyaxQ
## quick start
#include "tim.h" // one header, no lib
int main(void) { //
while (tim_run(0)) { // event loop
scope (A, A, 24, 8) { // centered 24x8 scope
uint64_t c = 0x0a060f; // three colors
frame(0, 0, ~0, ~0, c); // draw frame for scope
label("Greetings!", A, 2, A, A, c); // label in top center
if (button("OK", A, ~1, 8, A, c)) // button in bottom center
return 0; // exit on button click
if (is_key_press('q')) // ctrl-c is masked
return 0; // exit on 'q' press
} //
} // atexit cleanup
} //
See [example/hello.c](./example/hello.c)
## layout

View File

@@ -1,6 +1,6 @@
// Shows xterm-256 color palette.
#include "../tim.h"
#include "tim.h"
static void foo(int x, int y, int c) {
char buf[16] = {0};
@@ -27,4 +27,3 @@ int main(void) {
}
}
}

View File

@@ -1,6 +1,6 @@
// Test string functions.
#include "../tim.h"
#include "tim.h"
#define U(s) (uint8_t*)(""s), (sizeof(s) - 1)
#define TEST(t) printf("\33[3%s\33[0m %s\n", (t) ? "2mpass" : "1mfail", #t)
@@ -68,4 +68,3 @@ int main(void) {
TEST(is_wide_perhaps(U("")) == true);
TEST(is_wide_perhaps(U("𐍈")) == true);
}

View File

@@ -1,4 +1,4 @@
#include "../tim.h"
#include "tim.h"
static inline void test_screen(TimEvent_t* e) {
static TimEvent_t me;
@@ -118,4 +118,3 @@ int main(void) {
}
}
}

View File

@@ -1,7 +1,7 @@
// Test character width.
#include <assert.h>
#include "../tim.h"
#include "tim.h"
static int cp_to_utf8(int32_t cp, char* s) {
assert(cp > 0 && cp < 0x110000);