intermediate

This commit is contained in:
Vicente Ferrari Smith 2025-07-09 08:41:30 +02:00
parent 6675f39303
commit d83f28c212
12 changed files with 13397 additions and 13394 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -6,9 +6,9 @@
NAME :: "mexplore";
VERSION :: "0.1";
JAI_VERSION :: "beta 0.2.014, built on 24 May 2025";
RELEASE_DATE :: "9 July 2025, 00:11:48";
RELEASE_DATE :: "9 July 2025, 08:38:11";
GIT_BRANCH :: "main";
GIT_REVISION :: "8b1302aa45aefcd2e5f3f6bbf69af06f3f934ac7";
GIT_REVISION :: "6675f39303fac93bdb6e9216afc488b6c41706ed";
DEBUG :: true;
//

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -320,7 +320,7 @@ STB_TEXTEDIT_INSERTCHARS :: (obj: *STB_TEXTEDIT_STRING, i: s32, c: *STB_TEXTEDIT
return true;
}
STB_TEXTEDIT_LAYOUTROW :: (row: *StbTexteditRow, obj: *STB_TEXTEDIT_STRING, n: u32) {
STB_TEXTEDIT_LAYOUTROW :: (row: *StbTexteditRow, obj: *STB_TEXTEDIT_STRING, n: s32) {
// text : *u8 = obj.text.data;
// line_start : *u8 = text + n;
// len := obj.text.count - (line_start - text);
@ -338,7 +338,7 @@ STB_TEXTEDIT_LAYOUTROW :: (row: *StbTexteditRow, obj: *STB_TEXTEDIT_STRING, n: u
// }
//size, max_descent, read := SegmentText(obj.font, text_utf32.data, xx text_utf32.count);
idx : u32;
idx : s32;
while row.x1 < obj.max_size.x {
size, max_descent, read := next_word_size(obj.font, string.{obj.text.count, obj.text.data}, n + idx, obj.max_size.x);

View File

@ -427,7 +427,7 @@ ShapeText :: (font: *Font, Cursor: *kbts_cursor, Codepoints: *u32, CodepointCoun
return size, max_descent;
}
SegmentText :: (font: *Font, Codepoints: *u32, CodepointCount: u64) -> Vector2, float, u32 {
SegmentText :: (font: *Font, Codepoints: *u32, CodepointCount: u64) -> Vector2, float, s32 {
Cursor : kbts_cursor;
Direction : kbts_direction = .NONE;
Script : kbts_script = .DONT_KNOW;
@ -472,7 +472,7 @@ SegmentText :: (font: *Font, Codepoints: *u32, CodepointCount: u64) -> Vector2,
size, max_descent := ShapeText(font, *Cursor, Codepoints + RunStart, RunLength, BreakState.MainDirection, Direction, Script);
//if max_width > 0.0 && size.x + word_size.x > max_width {
return size, max_descent, Break.Position;
return size, max_descent, xx Break.Position;
//}
// size.x += word_size.x;
@ -569,7 +569,7 @@ SegmentText :: (font: *Font, Codepoints: *u32, CodepointCount: u64) -> Vector2,
// return 0;
// }
next_word_size :: (font: *Font, text: string, n: u32, max_width: float = 0.0) -> Vector2, float, u32 {
next_word_size :: (font: *Font, text: string, n: s32, max_width: float = 0.0) -> Vector2, float, s32 {
textp : *u8 = text.data;
line_start : *u8 = textp + n;

View File

@ -411,7 +411,7 @@ ui_label :: (s: string = "", colour := Vector4.{1.0, 1.0, 1.0, 1.0}) {
ui_size_label :: (label: *Label, max_width: float) {
label_size : Vector2;
idx : u32;
idx : s32;
while idx < label.text.count {
word_size, word_ascent, read := next_word_size(label.font, label.text, idx, max_width);
@ -457,19 +457,22 @@ ui_draw_label :: (using label: *Label) {
// Restore modified GL state
// restore_opengl_state(*opengl_state);
r : StbTexteditRow;
n : s32 = STB_TEXTEDIT_STRINGLEN(str);
n : s32 = xx label.text.count;
midline : Vector2 = pos + Vector2.{cast(float, margin + padding), xx (size.y / 2.0)};
while i < n {
STB_TEXTEDIT_LAYOUTROW(*r, str, i);
if r.num_chars <= 0
break;
this_size : Vector2;
idx : s32;
while this_size.x < label.max_size.x {
word_size, word_max_descent, read := next_word_size(label.font, string.{label.text.count, label.text.data}, n + idx, label.max_size.x);
render_text(font, text, .{xx midline.x, xx (midline.y - label_size.y / 2.0 + max_descent)}, colour = font_colour);
if this_size.x + word_size.x > label.max_size.x {
midline.y += label.font.face.size.metrics.height >> 6;
}
midline.y += r.baseline_y_delta;
this_size.x += word_size.x;
this_size.y = max(this_size.y, word_size.y);
idx += read;
}
//label_size := Vector2.{xx Simp.prepare_text(font, text), xx font.character_height};
@ -619,7 +622,7 @@ ui_button :: (s: string = "", icon_texture: *Texture = null, font_colour := Vect
button.min_size = v2(2 * button.margin + 2 * button.border_size + 2 * button.padding);
idx : u32;
idx : s32;
while idx < text.count {
label_size, max_descent, read := next_word_size(button.font, button.text, idx, button.max_size.x);
@ -940,7 +943,7 @@ ui_draw_text_input :: (using text_input: *TextInput) {
draw_pos.y -= row.baseline_y_delta;
i += row.num_chars;
i += xx row.num_chars;
}
// whil