ReloadFont when variables change
This commit is contained in:
@@ -21,9 +21,5 @@ set flags=/EHsc- /MD /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column
|
||||
set libs=%sdllib%/SDL3-static.lib %sdllib%/SDL_uclibc.lib kernel32.lib gdi32.lib user32.lib Imm32.lib ole32.lib Shell32.lib OleAut32.lib Cfgmgr32.lib Setupapi.lib Advapi32.lib version.lib winmm.lib
|
||||
cl %flags% ../src/text_editor/text_editor.cpp -Fe:te.exe -I%sdl%/include -I../src/external/glad -I../src/ %libs% -link /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD
|
||||
|
||||
copy te.exe ..\data\te.exe
|
||||
copy te.pdb ..\data\te.pdb
|
||||
echo written ..\data\te.exe
|
||||
|
||||
popd
|
||||
rem /fsanitize=address
|
||||
|
||||
1
build.sh
1
build.sh
@@ -9,6 +9,5 @@ FLAGS="-Wall -Wno-missing-braces -Wno-writable-strings -nostdlib++ -fsanitize=ad
|
||||
|
||||
I="-I../src/external/SDL/include -I../src/external/lua/src -I../src/external/glad"
|
||||
clang -o te $FLAGS ../src/text_editor/text_editor.cpp $I -lSDL3 -lm -lbacktrace
|
||||
cp te ../data/te
|
||||
|
||||
# -v -Wl,--verbose
|
||||
@@ -1,42 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
|
||||
<title>Emscripten-Generated Code</title>
|
||||
<style>
|
||||
body { margin: 0; background-color: black }
|
||||
.game {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
margin: 0px;
|
||||
border: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
image-rendering: optimizeSpeed;
|
||||
image-rendering: -moz-crisp-edges;
|
||||
image-rendering: -o-crisp-edges;
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
image-rendering: optimize-contrast;
|
||||
image-rendering: crisp-edges;
|
||||
image-rendering: pixelated;
|
||||
-ms-interpolation-mode: nearest-neighbor;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas class="game" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
||||
<script type='text/javascript'>
|
||||
var Module = {
|
||||
preRun: [],
|
||||
print: (...args) => console.log('[stdout]: ' + args.join(' ')),
|
||||
printErr: (...args) => console.log('[stderr]: ' + args.join(' ')),
|
||||
};
|
||||
window.onerror = (event) => console.log('[onerror]: ' + event.message);
|
||||
</script>
|
||||
{{{ SCRIPT }}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -895,7 +895,7 @@ API void RedoEdit(Buffer *buffer, Array<Caret> *carets) {
|
||||
|
||||
if (buffer->redo_stack.len > 0) {
|
||||
HistoryEntry *next = GetLast(buffer->redo_stack);
|
||||
if (next->time - entry.time <= UndoMergeTimeWindow) {
|
||||
if (next->time - entry.time <= UndoMergeTime) {
|
||||
RedoEdit(buffer, carets);
|
||||
}
|
||||
}
|
||||
@@ -921,7 +921,7 @@ API void UndoEdit(Buffer *buffer, Array<Caret> *carets) {
|
||||
|
||||
if (buffer->undo_stack.len > 0) {
|
||||
HistoryEntry *next = GetLast(buffer->undo_stack);
|
||||
if (entry.time - next->time <= UndoMergeTimeWindow) {
|
||||
if (entry.time - next->time <= UndoMergeTime) {
|
||||
UndoEdit(buffer, carets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1328,6 +1328,12 @@ void Set(String16 string) {
|
||||
return;
|
||||
}
|
||||
} ElseInvalidCodepath();
|
||||
|
||||
|
||||
if (name8 == "FontSize" || name8 == "Font") {
|
||||
ReloadFont(Font, (U32)FontSize);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,6 @@ RegisterVariable(Int, IndentSize, 4);
|
||||
RegisterVariable(Int, FontSize, 15);
|
||||
RegisterVariable(String, Font, "");
|
||||
RegisterVariable(String, VCVarsall, "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat");
|
||||
RegisterVariable(Float, UndoMergeTimeWindow, 0.3);
|
||||
RegisterVariable(Float, JumpHistoryMergeTimeWindow, 0.3);
|
||||
RegisterVariable(Float, UndoMergeTime, 0.3);
|
||||
RegisterVariable(Float, JumpHistoryMergeTime, 0.3);
|
||||
RegisterVariable(String, InternetBrowser, "firefox");
|
||||
|
||||
@@ -278,7 +278,7 @@ void JumpBack(Window *window) {
|
||||
|
||||
if (window->goto_history.len) {
|
||||
GotoCrumb *next = GetLast(window->goto_history);
|
||||
if (c.view_id == next->view_id && c.time - next->time <= JumpHistoryMergeTimeWindow) {
|
||||
if (c.view_id == next->view_id && c.time - next->time <= JumpHistoryMergeTime) {
|
||||
JumpBack(window);
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ void JumpForward(Window *window) {
|
||||
|
||||
if (window->goto_redo.len) {
|
||||
GotoCrumb *next = GetLast(window->goto_redo);
|
||||
if (c.view_id == next->view_id && next->time - c.time <= JumpHistoryMergeTimeWindow) {
|
||||
if (c.view_id == next->view_id && next->time - c.time <= JumpHistoryMergeTime) {
|
||||
JumpForward(window);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user