Fix improperly prompting about unused local in another modules, fix full recompile, Text editor: restructure

This commit is contained in:
Krzosa Karol
2024-06-09 12:04:38 +02:00
parent b08c7c9ce6
commit 39cb9cb4b4
22 changed files with 86 additions and 54 deletions

View File

@@ -6,9 +6,9 @@ bool text_editor() {
defer { LC_LangEnd(lang); };
LC_RegisterPackageDir("../pkgs");
LC_RegisterPackageDir("../examples");
LC_RegisterPackageDir("../examples/text_editor");
LC_Intern name = LC_ILit("text_editor");
LC_Intern name = LC_ILit("entry_point");
LC_ParseAndResolve(name);
if (L->errors) return false;

View File

@@ -1,3 +1,6 @@
import "raylib";
import "std_types";
ClampInt :: proc(val: int, min: int, max: int): int {
result := val;
if (val < min) result = min;

View File

@@ -12,6 +12,9 @@ import "raylib";
import "std_types";
import "libc";
import "core";
import TE "text_editor";
InvalidCodepath :: proc() {
assert(:*char("invalid codepath") == :*char(""));
}
@@ -81,12 +84,13 @@ main :: proc(): int {
ClearBackground(RAYWHITE);
if sandbox_chosen == SANDBOX_TEXT_EDITOR {
UpdateTextEditor(screen_rect, font, font_size, font_spacing);
TE.UpdateTextEditor(screen_rect, font, font_size, font_spacing);
} else if sandbox_chosen == SANDBOX_PROTOTYPE {
UpdatePrototype(screen_rect);
}
DrawRect(top_bar_original, LIGHTGRAY);
TE.DrawRect(top_bar_original, LIGHTGRAY);
DrawRectangleRoundedLines(Rect2PToRectangle(button1), 0.3, 12, 2, BLACK);
if button1_hover DrawRectangleRounded(Rect2PToRectangle(button1), 0.3, 12, WHITE);
@@ -101,4 +105,5 @@ main :: proc(): int {
}
CloseWindow();
return 0;
}
}

View File

@@ -1,3 +1,9 @@
import "std_types";
import "raylib";
import "libc";
import "core";
TeInited := false;
TeFontSize: float = 14;
TeFontSpacing: float = 1;
@@ -91,7 +97,6 @@ UpdateAndDrawWindow :: proc(w: *Window, font: Font, font_size: float) {
}
}
if w == FocusedWindow {
if IsKeyPressed(KEY_LEFT) || IsKeyPressedRepeat(KEY_LEFT) {
if IsKeyDown(KEY_LEFT_SHIFT) {