added dependency: tim
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -10,3 +10,6 @@
|
|||||||
[submodule "dependencies/tsqlite"]
|
[submodule "dependencies/tsqlite"]
|
||||||
path = dependencies/tsqlite
|
path = dependencies/tsqlite
|
||||||
url = https://timerix.ddns.net/git/Timerix/tsqlite.git
|
url = https://timerix.ddns.net/git/Timerix/tsqlite.git
|
||||||
|
[submodule "dependencies/tim"]
|
||||||
|
path = dependencies/tim
|
||||||
|
url = https://timerix.ddns.net/git/Timerix/tim.git
|
||||||
|
|||||||
1
.vscode/c_cpp_properties.json
vendored
1
.vscode/c_cpp_properties.json
vendored
@@ -10,6 +10,7 @@
|
|||||||
"dependencies/tlibc/include",
|
"dependencies/tlibc/include",
|
||||||
"dependencies/tlibtoml/include",
|
"dependencies/tlibtoml/include",
|
||||||
"dependencies/tsqlite/include",
|
"dependencies/tsqlite/include",
|
||||||
|
"dependencies/tim/include",
|
||||||
"${default}"
|
"${default}"
|
||||||
],
|
],
|
||||||
"cStandard": "c99"
|
"cStandard": "c99"
|
||||||
|
|||||||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}/bin",
|
"cwd": "${workspaceFolder}/bin",
|
||||||
"externalConsole": false,
|
"externalConsole": true,
|
||||||
"internalConsoleOptions": "neverOpen",
|
"internalConsoleOptions": "neverOpen",
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
"miDebuggerPath": "gdb"
|
"miDebuggerPath": "gdb"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}/bin",
|
"cwd": "${workspaceFolder}/bin",
|
||||||
"externalConsole": false,
|
"externalConsole": true,
|
||||||
"internalConsoleOptions": "neverOpen",
|
"internalConsoleOptions": "neverOpen",
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
"miDebuggerPath": "gdb"
|
"miDebuggerPath": "gdb"
|
||||||
|
|||||||
1
dependencies/tim
vendored
Submodule
1
dependencies/tim
vendored
Submodule
Submodule dependencies/tim added at 161f655492
19
dependencies/tim.config
vendored
Normal file
19
dependencies/tim.config
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This is a dependency config.
|
||||||
|
# You can copy it to another cbuild project to add this lib as dependency.
|
||||||
|
|
||||||
|
DEP_WORKING_DIR="$DEPENDENCIES_DIR/tim"
|
||||||
|
if [[ "$TASK" = *_dbg ]]; then
|
||||||
|
dep_build_target="build_static_lib_dbg"
|
||||||
|
else
|
||||||
|
dep_build_target="build_static_lib"
|
||||||
|
fi
|
||||||
|
DEP_PRE_BUILD_COMMAND=""
|
||||||
|
DEP_BUILD_COMMAND="cbuild $dep_build_target"
|
||||||
|
DEP_POST_BUILD_COMMAND=""
|
||||||
|
DEP_CLEAN_COMMAND="cbuild clean"
|
||||||
|
DEP_DYNAMIC_OUT_FILES=""
|
||||||
|
DEP_STATIC_OUT_FILES="bin/tim.a"
|
||||||
|
DEP_OTHER_OUT_FILES=""
|
||||||
|
PRESERVE_OUT_DIRECTORY_STRUCTURE=false
|
||||||
2
dependencies/tlibc
vendored
2
dependencies/tlibc
vendored
Submodule dependencies/tlibc updated: de88e9ff16...4cfed24ec3
@@ -24,7 +24,7 @@ SRC_CPP="$(find src -name '*.cpp')"
|
|||||||
# See cbuild/example_dependency_configs
|
# See cbuild/example_dependency_configs
|
||||||
DEPENDENCY_CONFIGS_DIR='dependencies'
|
DEPENDENCY_CONFIGS_DIR='dependencies'
|
||||||
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
||||||
ENABLED_DEPENDENCIES='bearssl tlibc tlibtoml tsqlite'
|
ENABLED_DEPENDENCIES='bearssl tlibc tlibtoml tsqlite tim'
|
||||||
|
|
||||||
# OBJDIR structure:
|
# OBJDIR structure:
|
||||||
# ├── objects/ - Compiled object files. Cleans on each call of build task
|
# ├── objects/ - Compiled object files. Cleans on each call of build task
|
||||||
@@ -39,7 +39,8 @@ INCLUDE="-Isrc -Iinclude
|
|||||||
-I$DEPENDENCIES_DIR/BearSSL/inc
|
-I$DEPENDENCIES_DIR/BearSSL/inc
|
||||||
-I$DEPENDENCIES_DIR/tlibc/include
|
-I$DEPENDENCIES_DIR/tlibc/include
|
||||||
-I$DEPENDENCIES_DIR/tlibtoml/include
|
-I$DEPENDENCIES_DIR/tlibtoml/include
|
||||||
-I$DEPENDENCIES_DIR/tsqlite/include"
|
-I$DEPENDENCIES_DIR/tsqlite/include
|
||||||
|
-I$DEPENDENCIES_DIR/tim/include"
|
||||||
|
|
||||||
# OS-specific options
|
# OS-specific options
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "tlibc/filesystem.h"
|
#include "tlibc/filesystem.h"
|
||||||
#include "tlibc/term.h"
|
#include "tlibc/term.h"
|
||||||
#include "network/tcp-chat-protocol/v1.h"
|
#include "network/tcp-chat-protocol/v1.h"
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
static const str greeting_art = STR(
|
static const str greeting_art = STR(
|
||||||
" ^,,^ ╱|\n"
|
" ^,,^ ╱|\n"
|
||||||
@@ -48,7 +49,33 @@ void ClientCLI_construct(ClientCLI* self){
|
|||||||
Result(void) ClientCLI_run(ClientCLI* self) {
|
Result(void) ClientCLI_run(ClientCLI* self) {
|
||||||
Deferral(16);
|
Deferral(16);
|
||||||
|
|
||||||
try_void(term_init());
|
TimEditState e;
|
||||||
|
TimEditState_init(&e, 32, "Greetings!");
|
||||||
|
bool edit_enabled = false;
|
||||||
|
while(tim_run(0)){
|
||||||
|
uint64_t c = 0x0f040f;
|
||||||
|
tim_frame(0, 0, ~0, ~0, c);
|
||||||
|
|
||||||
|
tim_label(e.s, A, 2, A, A, c);
|
||||||
|
|
||||||
|
if(edit_enabled){
|
||||||
|
TimKey key = tim_edit(&e, A, 5, tim->scopes[tim->scope].w - 4, c);
|
||||||
|
|
||||||
|
if(key == TimKey_Escape || key == TimKey_Enter)
|
||||||
|
edit_enabled = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(tim_button("[Enter] Edit text", A, 5, tim->scopes[tim->scope].w - 4, A, c) || tim_is_key_press(TimKey_Enter)){
|
||||||
|
edit_enabled = true;
|
||||||
|
tim->focus = &e;
|
||||||
|
tim->event.type = TimEvent_Void; // consume key event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tim_button("[Q] Quit", A, ~1, 10, A, c) || tim_is_key_press('q'))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
term_clear();
|
term_clear();
|
||||||
printf(FMT_str"\n", greeting_art.len, greeting_art.data);
|
printf(FMT_str"\n", greeting_art.len, greeting_art.data);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user