Skip to content

Commit

Permalink
force loop issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wassimulator committed May 20, 2024
1 parent 12da0d0 commit e83798d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/ui/ui_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ inline f32 UI_round_away_from_zero(f32 value) {

static f32 UI_lerp_f32(f32 a, f32 b, f32 t)
{
if (UI_abs(a - b) > 1) G->force_loop = true;
if (UI_abs(a - b) > 3) G->force_loop = true;
return (a + (b - a) * t);
}

Expand Down
8 changes: 4 additions & 4 deletions include/wassentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ Dynarray<String8> w_tokenize(const String8 str)


void*walloc(size_t size) {
return malloc(size);
//return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
//return malloc(size);
return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
}
//NOTE (Wassim): for some reaosn VirtualFree was crashing, need to investigate this later
void wfree(void* address) {
free(address);
//VirtualFree(address, 0, MEM_RELEASE);
//free(address);
VirtualFree(address, 0, MEM_RELEASE);
}
3 changes: 2 additions & 1 deletion src/source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3018,7 +3018,8 @@ static void update_gui() {
{
static f32 begin = 0;
f32 begin_should = WW / 2.f - thumb_dim / 2.f - G->current_file_index * thumb_dim + 25.f;
begin = UI_lerp_f32(begin, begin_should, 0.2);
if (WW)
begin = UI_lerp_f32(begin, begin_should, 0.2);
UI_Block *thumbs_scroll = UI_push_block(ctx);
thumbs_scroll->style.position[axis_x] = { UI_Position_t::absolute, f32(begin) };
thumbs_scroll->style.layout.axis = axis_x;
Expand Down

0 comments on commit e83798d

Please sign in to comment.