text editor target, refactor build_file.c
This commit is contained in:
236
build_file.c
236
build_file.c
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* need a way to specify build targets from cmd line
|
||||
|
||||
*/
|
||||
|
||||
// don't ever include stuff that build_file will generate code for!
|
||||
#define DONT_INCLUDE_GENERATED_MATH
|
||||
#include "src/core/core.h"
|
||||
@@ -15,14 +20,135 @@
|
||||
#include "src/ui/ui.meta.c"
|
||||
#include "src/render/render.meta.c"
|
||||
#include "src/wasm_app/wasm_app.meta.c"
|
||||
#include "src/text_editor/text_editor.meta.c"
|
||||
#include "src/testing/testing.meta.c"
|
||||
|
||||
void build_testing_target(void) {
|
||||
if (!cache_code_modified(s8_lit("../src/testing/testing_main.c"), s8_lit("testing.exe"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PLATFORM_WINDOWS) {
|
||||
os_delete_file(s8_lit("testing.pdb"));
|
||||
int ok = os_systemf(
|
||||
"cl ../src/testing/testing_main.c -Fe:testing.exe -Fd:testing.pdb"
|
||||
" -I ../src"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL"
|
||||
);
|
||||
if (ok != 0) exit(ok);
|
||||
|
||||
ok = os_systemf("testing.exe");
|
||||
if (ok != 0) exit(ok);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int ok = os_systemf(
|
||||
"clang ../src/testing/testing_main.c -o testing.exe -g -I ../src"
|
||||
" -fdiagnostics-absolute-paths -Wno-unsequenced -Wno-single-bit-bitfield-constant-conversion"
|
||||
" -lm -ldl"
|
||||
);
|
||||
if (ok != 0) exit(ok);
|
||||
|
||||
ok = os_systemf("./testing.exe");
|
||||
if (ok != 0) exit(ok);
|
||||
}
|
||||
|
||||
void build_win32_app_base_target(void) {
|
||||
if (!cache_code_modified(s8_lit("../src/app/app_win32_exe.c"), s8_lit("app_win32.exe"))) {
|
||||
return;
|
||||
}
|
||||
int ok = os_systemf(
|
||||
"cl ../src/app/app_win32_exe.c -Fe:app_win32.exe -Fd:app_win32.pdb"
|
||||
" -I ../src"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL"
|
||||
);
|
||||
if (ok != 0) exit(ok);
|
||||
}
|
||||
|
||||
void build_text_editor_dll_target(void) {
|
||||
if (!cache_code_modified(s8_lit("../src/text_editor/text_editor_main.c"), s8_lit("app.dll"))) {
|
||||
return;
|
||||
}
|
||||
int ok = os_systemf(
|
||||
"cl ../src/text_editor/text_editor_main.c -Fe:app.dll -Fd:app.pdb"
|
||||
" -I ../src /DAPP_IS_DLL"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL /DLL"
|
||||
);
|
||||
if (ok != 0) exit(ok);
|
||||
}
|
||||
|
||||
void build_prototype_dll_target(void) {
|
||||
if (!cache_code_modified(s8_lit("../src/wasm_app/main.c"), s8_lit("app.dll"))) {
|
||||
return;
|
||||
}
|
||||
int ok = os_systemf(
|
||||
"cl ../src/wasm_app/main.c -Fe:app.dll -Fd:app.pdb"
|
||||
" -I ../src /DAPP_IS_DLL"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL /DLL"
|
||||
);
|
||||
if (ok != 0) exit(ok);
|
||||
}
|
||||
|
||||
void build_prototype_wasm_target(void) {
|
||||
b32 html_code_modified = cache_code_modified(s8_lit("../src/app/app_wasm.html"), s8_lit("../package/index.html"));
|
||||
b32 wasm_code_modified = cache_code_modified(s8_lit("../src/wasm_app/main.c"), s8_lit("main.wasm"));
|
||||
if (html_code_modified) {
|
||||
os_copy("../src/app/app_wasm.html", "../package/index.html", os_copy_overwrite);
|
||||
}
|
||||
if (wasm_code_modified) {
|
||||
int ok = os_systemf(
|
||||
"clang ../src/wasm_app/main.c -o main.wasm"
|
||||
" -Oz -g -I../src"
|
||||
" -Wall -Wno-missing-braces -Wno-single-bit-bitfield-constant-conversion -Wno-unsequenced -Wno-initializer-overrides"
|
||||
" -fdiagnostics-absolute-paths -fdiagnostics-format=msvc"
|
||||
" --target=wasm32 -nostdlib -mbulk-memory -msimd128"
|
||||
" -Wl,-export-dynamic,--allow-undefined,--import-memory,--no-entry,--initial-memory=131072000,--max-memory=4294967296"
|
||||
);
|
||||
os_copy("main.wasm", "../package/main.wasm", os_copy_overwrite);
|
||||
if (ok != 0) exit(ok);
|
||||
}
|
||||
}
|
||||
|
||||
void build_prototype_standalone_target(void) {
|
||||
if (!cache_code_modified(s8_lit("../src/wasm_app/main.c"), s8_lit("standalone_app.exe"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
int ok = os_systemf(
|
||||
"cl ../src/wasm_app/main.c -Fe:standalone_app.exe -Fd:standalone_app.pdb"
|
||||
" -I ../src"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL"
|
||||
);
|
||||
if (ok != 0) exit(ok);
|
||||
}
|
||||
|
||||
void generate_math_code(ma_arena_t *arena) {
|
||||
if (!cache_code_modified(s8_lit("../src/core/core_math_gen.py"), s8_null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#define py "py "
|
||||
#else
|
||||
#define py "python3 "
|
||||
#endif
|
||||
|
||||
os_set_working_dir("../src/core");
|
||||
os_systemf(py "core_math_gen.py");
|
||||
os_set_working_dir("../../build");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
core_init();
|
||||
int ok = 0;
|
||||
@@ -31,106 +157,48 @@ int main(int argc, char **argv) {
|
||||
SRC_SearchPaths.include_path_count = 1;
|
||||
cache_init(&Perm, s8_lit("cache_build_file"));
|
||||
|
||||
b32 generate_math = true;
|
||||
if (generate_math && cache_code_modified(s8_lit("../src/core/core_math_gen.py"), s8_null)) {
|
||||
os_set_working_dir("../src/core");
|
||||
os_systemf(py "core_math_gen.py");
|
||||
os_set_working_dir("../../build");
|
||||
}
|
||||
mt_ui(tcx->temp);
|
||||
mt_app(tcx->temp);
|
||||
mt_wasm_app(tcx->temp);
|
||||
mt_render(tcx->temp);
|
||||
mt_testing(tcx->temp);
|
||||
generate_math_code(tcx->temp);
|
||||
generate_ui_code(tcx->temp);
|
||||
generate_app_code(tcx->temp);
|
||||
generate_wasm_app_code(tcx->temp);
|
||||
generate_render_code(tcx->temp);
|
||||
generate_testing_code(tcx->temp);
|
||||
generate_text_editor_code(tcx->temp);
|
||||
|
||||
b32 run_server = false;
|
||||
b32 core_test_target = true;
|
||||
b32 win32_target = false;
|
||||
b32 standalone_w32_target = false;
|
||||
b32 wasm_target = false;
|
||||
b32 run_win32_app_base_target = true;
|
||||
b32 run_testing_target = true;
|
||||
b32 run_text_editor_dll_target = false;
|
||||
b32 run_prototype_dll_target = false;
|
||||
b32 run_prototype_wasm_target = false;
|
||||
b32 run_prototype_standalone_target = false;
|
||||
|
||||
if (run_server) {
|
||||
os_systemf("start /D ..\\package ..\\package\\run_server.bat");
|
||||
}
|
||||
|
||||
if (standalone_w32_target && cache_code_modified(s8_lit("../src/wasm_app/main.c"), s8_lit("standalone_app.exe"))) {
|
||||
ok = os_systemf(
|
||||
"cl ../src/wasm_app/main.c -Fe:standalone_app.exe -Fd:standalone_app.pdb"
|
||||
" -I ../src"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL"
|
||||
);
|
||||
if (ok != 0) return ok;
|
||||
if (run_prototype_standalone_target) {
|
||||
build_prototype_standalone_target();
|
||||
}
|
||||
|
||||
if (win32_target && cache_code_modified(s8_lit("../src/wasm_app/main.c"), s8_lit("app.dll"))) {
|
||||
ok = os_systemf(
|
||||
"cl ../src/wasm_app/main.c -Fe:app.dll -Fd:app.pdb"
|
||||
" -I ../src /DAPP_IS_DLL"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL /DLL"
|
||||
);
|
||||
if (ok != 0) return ok;
|
||||
if (run_prototype_dll_target) {
|
||||
build_prototype_dll_target();
|
||||
}
|
||||
|
||||
if (win32_target && cache_code_modified(s8_lit("../src/app/app_win32_exe.c"), s8_lit("app_win32.exe"))) {
|
||||
ok = os_systemf(
|
||||
"cl ../src/app/app_win32_exe.c -Fe:app_win32.exe -Fd:app_win32.pdb"
|
||||
" -I ../src"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL"
|
||||
);
|
||||
if (run_win32_app_base_target) {
|
||||
build_win32_app_base_target();
|
||||
}
|
||||
|
||||
if (core_test_target && cache_code_modified(s8_lit("../src/testing/testing_main.c"), s8_lit("testing.exe"))) {
|
||||
if (PLATFORM_WINDOWS) {
|
||||
os_delete_file(s8_lit("testing.pdb"));
|
||||
ok = os_systemf(
|
||||
"cl ../src/testing/testing_main.c -Fe:testing.exe -Fd:testing.pdb"
|
||||
" -I ../src"
|
||||
" /Zi /FC /nologo /Oi"
|
||||
" /WX /W3 /wd4200 /diagnostics:column"
|
||||
" /link /incremental:no /DEBUG:FULL"
|
||||
);
|
||||
if (ok != 0) return ok;
|
||||
|
||||
ok = os_systemf("testing.exe");
|
||||
if (ok != 0) return ok;
|
||||
} else {
|
||||
ok = os_systemf(
|
||||
"clang ../src/testing/testing_main.c -o testing.exe -g -I ../src"
|
||||
" -fdiagnostics-absolute-paths -Wno-unsequenced -Wno-single-bit-bitfield-constant-conversion"
|
||||
" -lm -ldl"
|
||||
);
|
||||
if (ok != 0) return ok;
|
||||
|
||||
ok = os_systemf("./testing.exe");
|
||||
if (ok != 0) return ok;
|
||||
}
|
||||
if (run_text_editor_dll_target) {
|
||||
build_text_editor_dll_target();
|
||||
}
|
||||
|
||||
if (run_testing_target) {
|
||||
build_testing_target();
|
||||
}
|
||||
|
||||
if (wasm_target) {
|
||||
b32 html_code_modified = cache_code_modified(s8_lit("../src/app/app_wasm.html"), s8_lit("../package/index.html"));
|
||||
b32 wasm_code_modified = cache_code_modified(s8_lit("../src/wasm_app/main.c"), s8_lit("main.wasm"));
|
||||
if (html_code_modified) {
|
||||
os_copy("../src/app/app_wasm.html", "../package/index.html", os_copy_overwrite);
|
||||
}
|
||||
if (wasm_code_modified) {
|
||||
ok = os_systemf(
|
||||
"clang ../src/wasm_app/main.c -o main.wasm"
|
||||
" -Oz -g -I../src"
|
||||
" -Wall -Wno-missing-braces -Wno-single-bit-bitfield-constant-conversion -Wno-unsequenced -Wno-initializer-overrides"
|
||||
" -fdiagnostics-absolute-paths -fdiagnostics-format=msvc"
|
||||
" --target=wasm32 -nostdlib -mbulk-memory -msimd128"
|
||||
" -Wl,-export-dynamic,--allow-undefined,--import-memory,--no-entry,--initial-memory=131072000,--max-memory=4294967296"
|
||||
);
|
||||
os_copy("main.wasm", "../package/main.wasm", os_copy_overwrite);
|
||||
if (ok != 0) return ok;
|
||||
}
|
||||
if (run_prototype_wasm_target) {
|
||||
build_prototype_wasm_target();
|
||||
}
|
||||
|
||||
cache_save();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
void mt_app(ma_arena_t *arena) {
|
||||
void generate_app_code(ma_arena_t *arena) {
|
||||
sb8_t *h = sb8_serial_begin(arena);
|
||||
sb8_t *c = sb8_serial_begin(arena);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @todo: if window has focus, half screen, if window doesn,t/is not visible make miniature
|
||||
|
||||
#include "app_win32_opengl.c"
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#include "stb_sprintf.h"
|
||||
#include "core_string.c"
|
||||
#include "core_string16.c"
|
||||
#include "core_log.c"
|
||||
#include "core_lexer.c"
|
||||
#include "core_type_info.c"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "core_unicode.h"
|
||||
#include "core_arena.h"
|
||||
#include "core_string.h"
|
||||
#include "core_string16.h"
|
||||
#include "core_math.h"
|
||||
#include "core_type_info.h"
|
||||
#include "core_lexer.h"
|
||||
|
||||
0
src/core/core_string16.c
Normal file
0
src/core/core_string16.c
Normal file
0
src/core/core_string16.h
Normal file
0
src/core/core_string16.h
Normal file
@@ -5020,7 +5020,9 @@ SRC_CacheEntry *cache_hash_file(S8_String file, char *parent_file) {
|
||||
if (entry) return entry;
|
||||
|
||||
S8_String filecontent = OS_ReadFile(&Perm, S8_MakeFromChar(resolved_file));
|
||||
IO_Assert(filecontent.str);
|
||||
if (filecontent.str == NULL) {
|
||||
filecontent = S8_Lit("Null file");
|
||||
}
|
||||
|
||||
uint64_t file_hash = HashBytes(filecontent.str, filecontent.len);
|
||||
uint64_t includes_hash = 13;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
void mt_render(ma_arena_t *arena) {
|
||||
void generate_render_code(ma_arena_t *arena) {
|
||||
sb8_t *sb = sb8_serial_begin(arena);
|
||||
sb8_printf(sb, "// automatically generated using: " __FILE__ "\n");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
void mt_testing(ma_arena_t *arena) {
|
||||
void generate_testing_code(ma_arena_t *arena) {
|
||||
mt_files_t files = mt_lex_files(arena, mt_main_path(arena), mt_get_include_paths(arena));
|
||||
sb8_t *tests = sb8_serial_begin(arena);
|
||||
|
||||
|
||||
13
src/text_editor/text_editor.gen.c
Normal file
13
src/text_editor/text_editor.gen.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// automatically generated using: C:\dev\wasm\src/text_editor/text_editor.meta.c
|
||||
gb f32 font_size = 30;
|
||||
gb f32 _font_size = 30;
|
||||
gb_read_only mt_tweak_t tweak_table[] = {
|
||||
{type(f32), s8_const_lit("font_size"), &font_size, 4, 200},
|
||||
{type(f32), s8_const_lit("_font_size"), &_font_size, 30, 30},
|
||||
|
||||
};
|
||||
void run_all_tests(void) {
|
||||
test_hash_table();
|
||||
test_intern_table();
|
||||
ui_test_text_replace();
|
||||
}// run_all_tests()
|
||||
122
src/text_editor/text_editor.meta.c
Normal file
122
src/text_editor/text_editor.meta.c
Normal file
@@ -0,0 +1,122 @@
|
||||
void generate_text_editor_code(ma_arena_t *arena) {
|
||||
sb8_t *include_paths = sb8(arena);
|
||||
sb8_append(include_paths, OS_GetAbsolutePath(&Perm, s8_lit("../src")));
|
||||
mt_files_t files = mt_lex_files(arena, s8_lit("../src/text_editor/text_editor_main.c"), include_paths);
|
||||
|
||||
typedef struct cg_tweak_t cg_tweak_t;
|
||||
struct cg_tweak_t {
|
||||
cg_tweak_t *next;
|
||||
type_t *type;
|
||||
s8_t name;
|
||||
s8_t value;
|
||||
s8_t min, max;
|
||||
};
|
||||
|
||||
cg_tweak_t *first_tweak = NULL;
|
||||
cg_tweak_t *last_tweak = NULL;
|
||||
|
||||
sb8_t *tests = sb8_serial_begin(arena);
|
||||
|
||||
sb8_t *sb_embeds = sb8_serial_begin(arena);
|
||||
sb8_printf(sb_embeds, "// automatically generated using: " __FILE__ "\n");
|
||||
for (mt_file_t *it = files.first; it; it = it->next) {
|
||||
parser_t *par = parser_make(arena, it->tokens.data);
|
||||
for (;par->at->kind != lex_kind_eof;) {
|
||||
b32 matched = false;
|
||||
|
||||
if (par->at->inside_macro == false && parser_matchi(par, s8_lit("fn_test"))) {
|
||||
parser_expecti(par, s8_lit("void"));
|
||||
lex_t *ident = parser_match(par, lex_kind_ident);
|
||||
sb8_append(tests, ident->string);
|
||||
matched = true;
|
||||
}
|
||||
|
||||
if (par->at->inside_macro == false && parser_matchi(par, s8_lit("mt_embed_file"))) {
|
||||
parser_expect(par, lex_kind_open_paren);
|
||||
lex_t *var_name = parser_expect(par, lex_kind_ident);
|
||||
parser_expect(par, lex_kind_comma);
|
||||
lex_t *path = parser_expect(par, lex_kind_string);
|
||||
parser_expect(par, lex_kind_close_paren);
|
||||
s8_t relpath = s8_printf(arena, "../%S", path->string);
|
||||
s8_t content = OS_ReadFile(&Perm, relpath);
|
||||
|
||||
sb8_printf(sb_embeds, "gb_read_only ");
|
||||
mt_serial_to_cbyte_array_ex(sb_embeds, content, s8_printf(arena, "%S_data", var_name->string));
|
||||
sb8_printf(sb_embeds, "gb_read_only s8_t %S = s8_array_lit(%S_data);\n", var_name->string, var_name->string);
|
||||
matched = true;
|
||||
}
|
||||
|
||||
if (par->at->inside_macro == false && parser_matchi(par, s8_lit("mt_tweak_b32"))) {
|
||||
cg_tweak_t *tweak = ma_push_type(arena, cg_tweak_t);
|
||||
tweak->type = type(b32);
|
||||
tweak->min = tweak->max = s8_lit("0");
|
||||
parser_expect(par, lex_kind_open_paren);
|
||||
tweak->name = parser_expect(par, lex_kind_ident)->string;
|
||||
parser_expect(par, lex_kind_comma);
|
||||
tweak->value = parser_next(par)->string;
|
||||
parser_expect(par, lex_kind_close_paren);
|
||||
SLLQ_APPEND(first_tweak, last_tweak, tweak);
|
||||
matched = true;
|
||||
}
|
||||
|
||||
if (par->at->inside_macro == false && parser_matchi(par, s8_lit("mt_tweak_f32"))) {
|
||||
cg_tweak_t *tweak = ma_push_type(arena, cg_tweak_t);
|
||||
tweak->type = type(f32);
|
||||
parser_expect(par, lex_kind_open_paren);
|
||||
tweak->name = parser_expect(par, lex_kind_ident)->string;
|
||||
parser_expect(par, lex_kind_comma);
|
||||
tweak->value = parser_next(par)->string;
|
||||
parser_expect(par, lex_kind_comma);
|
||||
tweak->min = parser_next(par)->string;
|
||||
parser_expect(par, lex_kind_comma);
|
||||
tweak->max = parser_next(par)->string;
|
||||
parser_expect(par, lex_kind_close_paren);
|
||||
SLLQ_APPEND(first_tweak, last_tweak, tweak);
|
||||
matched = true;
|
||||
}
|
||||
|
||||
if (par->at->inside_macro == false && parser_matchi(par, s8_lit("mt_tweak_color"))) {
|
||||
cg_tweak_t *tweak = ma_push_type(arena, cg_tweak_t);
|
||||
tweak->type = type(v4f32_t);
|
||||
tweak->min = s8_lit("0.0f");
|
||||
tweak->max = s8_lit("1.0f");
|
||||
parser_expect(par, lex_kind_open_paren);
|
||||
tweak->name = parser_expect(par, lex_kind_ident)->string;
|
||||
parser_expect(par, lex_kind_comma);
|
||||
tweak->value = parser_next(par)->string;
|
||||
while (par->at->kind != lex_kind_close_paren && par->at->kind != lex_kind_eof) parser_next(par);
|
||||
lex_t *end = parser_expect(par, lex_kind_close_paren);
|
||||
tweak->value.len = (i64)(end->str - tweak->value.str);
|
||||
SLLQ_APPEND(first_tweak, last_tweak, tweak);
|
||||
matched = true;
|
||||
}
|
||||
|
||||
if (!matched) {
|
||||
parser_next(par);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (first_tweak != NULL) {
|
||||
for (cg_tweak_t *it = first_tweak; it; it = it->next) {
|
||||
sb8_printf(sb_embeds, "gb %S %S = %S;\n", it->type->name, it->name, it->value);
|
||||
}
|
||||
sb8_printf(sb_embeds, "gb_read_only mt_tweak_t tweak_table[] = {\n");
|
||||
for (cg_tweak_t *it = first_tweak; it; it = it->next) {
|
||||
sb8_printf(sb_embeds, " {type(%S), s8_const_lit(\"%S\"), &%S, %S, %S},\n", it->type->name, it->name, it->name, it->min, it->max);
|
||||
}
|
||||
sb8_printf(sb_embeds, "\n};\n");
|
||||
}
|
||||
|
||||
sb8_printf(sb_embeds, "void run_all_tests(void) {\n");
|
||||
for (sb8_node_t *it = tests->first; it; it = it->next) {
|
||||
sb8_printf(sb_embeds, " %S();\n", it->string);
|
||||
}
|
||||
sb8_printf(sb_embeds, "}// run_all_tests()\n");
|
||||
|
||||
|
||||
s8_t embeds = sb8_serial_end(arena, sb_embeds);
|
||||
os_write_file(mt_cpath(arena), embeds);
|
||||
}
|
||||
45
src/text_editor/text_editor_main.c
Normal file
45
src/text_editor/text_editor_main.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "core/core.h"
|
||||
#include "os/os.h"
|
||||
#include "app/app.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "core/core.c"
|
||||
#include "os/os.c"
|
||||
#include "app/app.c"
|
||||
#include "render/render.c"
|
||||
#include "ui/ui.c"
|
||||
|
||||
#include "text_editor.gen.c"
|
||||
|
||||
// @todo:
|
||||
// Create a complete string16 library
|
||||
// Win32 SDL_GetPrefPath, create configuration directory, get path
|
||||
// Win32 set screen saver
|
||||
// Win32 upload icon
|
||||
|
||||
fn_export b32 app_update(thread_ctx_t *thread_ctx, app_frame_t *frame) {
|
||||
tcx = thread_ctx;
|
||||
if (frame->first_event->kind == app_event_kind_init) {
|
||||
run_all_tests();
|
||||
|
||||
mt_tweak_f32(font_size, 30, 4, 200);
|
||||
mt_tweak_f32(_font_size, 30, 30, 30);
|
||||
|
||||
rn_init(&tcx->perm, font_size, frame->dpr);
|
||||
return true;
|
||||
} else if (frame->first_event->kind == app_event_kind_reload) {
|
||||
rn_reload();
|
||||
|
||||
return true;
|
||||
} else if (frame->first_event->kind == app_event_kind_unload) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!f32_are_equal(font_size, _font_size)) {
|
||||
_font_size = font_size;
|
||||
rn_reload_font(font_size, frame->dpr);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ fn void mt_ui_stacks(ma_arena_t *arena, sb8_t *c, sb8_t *h) {
|
||||
|
||||
}
|
||||
|
||||
fn void mt_ui(ma_arena_t *arena) {
|
||||
fn void generate_ui_code(ma_arena_t *arena) {
|
||||
sb8_t *h = sb8_serial_begin(arena);
|
||||
sb8_t *c = sb8_serial_begin(arena);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
void mt_wasm_app(ma_arena_t *arena) {
|
||||
void generate_wasm_app_code(ma_arena_t *arena) {
|
||||
sb8_t *include_paths = sb8(arena);
|
||||
sb8_append(include_paths, OS_GetAbsolutePath(&Perm, s8_lit("../src")));
|
||||
mt_files_t files = mt_lex_files(arena, s8_lit("../src/wasm_app/main.c"), include_paths);
|
||||
|
||||
Reference in New Issue
Block a user