diff --git a/src/pp/pp_sim/pp_sim_tiles.cgh b/src/pp/pp_sim/pp_sim_tiles.cgh index 30b9d848..2ea71a84 100644 --- a/src/pp/pp_sim/pp_sim_tiles.cgh +++ b/src/pp/pp_sim/pp_sim_tiles.cgh @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// //~ Tile types -#define S_WorldSize 128 +#define S_WorldSize 96 #define S_TilesXMacro(X) \ X(Empty) \ diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 5d0fabd6..4e64e970 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -1077,9 +1077,16 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(AxisSize, UI_PIX(3, 1), .axis = !panel->axis); UI_BuildBoxEx(divider_key); - if (rep.is_hovered) + if (rep.is_hovered || rep.is_m1_held) { - WND_PushCmd(window_frame, .kind = WND_CmdKind_SetCursor, WND_CursorKind_HorizontalResize); + if (panel->axis == Axis_X) + { + WND_PushCmd(window_frame, .kind = WND_CmdKind_SetCursor, WND_CursorKind_VerticalResize); + } + else + { + WND_PushCmd(window_frame, .kind = WND_CmdKind_SetCursor, WND_CursorKind_HorizontalResize); + } } if (rep.is_m1_held) @@ -1088,10 +1095,21 @@ void V_TickForever(WaveLaneCtx *lane) UI_Report parent_rep = UI_ReportFromKey(panel->parent->key); /* FIXME: Height */ - f32 parent_width = DimsFromRng2(parent_rep.screen_rect).x; + f32 parent_size = 0; + f32 new_size = 0; + if (panel->axis == Axis_X) + { + parent_size = DimsFromRng2(parent_rep.screen_rect).y; + new_size = frame->ui_cursor.y - panel_rep.screen_rect.p0.y; + } + else + { + parent_size = DimsFromRng2(parent_rep.screen_rect).x; + new_size = frame->ui_cursor.x - panel_rep.screen_rect.p0.x; + } f32 old_ratio = panel->pref_ratio; - f32 new_ratio = (frame->ui_cursor.x - panel_rep.screen_rect.p0.x) / parent_width; + f32 new_ratio = new_size / parent_size; f32 ratio_diff = new_ratio - old_ratio; panel->pref_ratio_diff = ratio_diff; } diff --git a/src/window/window_win32/window_win32.c b/src/window/window_win32/window_win32.c index b32b9d5f..14da8a55 100644 --- a/src/window/window_win32/window_win32.c +++ b/src/window/window_win32/window_win32.c @@ -223,11 +223,11 @@ LRESULT CALLBACK WND_W32_WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM l { if ((HWND)wparam == hwnd && LOWORD(lparam) == HTCLIENT) { - HCURSOR new_cursor = (HCURSOR)Atomic64Fetch(&window->new_cursor); - if (new_cursor != window->active_cursor) + HCURSOR desired_cursor = (HCURSOR)Atomic64Fetch(&window->desired_cursor); + if (desired_cursor != window->active_cursor) { - SetCursor(new_cursor); - window->active_cursor = new_cursor; + SetCursor(desired_cursor); + window->active_cursor = desired_cursor; } result = 1; } @@ -573,7 +573,7 @@ void WND_EndFrame(WND_Frame frame, i32 vsync) /* Process cmds */ b32 was_restored = 0; - WND_CursorKind new_cursor = (WND_CursorKind)Atomic64Fetch(&window->new_cursor); + HCURSOR desired_cursor = (HCURSOR)Atomic64Fetch(&window->desired_cursor); for (WND_W32_CmdNode *n = window->first_cmd; n; n = n->next) { WND_Cmd cmd = n->cmd; @@ -646,7 +646,7 @@ void WND_EndFrame(WND_Frame frame, i32 vsync) //- Cursor case WND_CmdKind_SetCursor: { - new_cursor = cmd.cursor; + desired_cursor = g->cursors[cmd.cursor]; } break; //- Restore @@ -710,7 +710,13 @@ void WND_EndFrame(WND_Frame frame, i32 vsync) } /* Set cursor */ - Atomic64Set(&window->new_cursor, (u64)g->cursors[new_cursor]); + { + HCURSOR old_desired_cursor = (HCURSOR)Atomic64FetchSet(&window->desired_cursor, (i64)desired_cursor); + if (old_desired_cursor != desired_cursor) + { + PostMessage(window->hwnd, WM_SETCURSOR, (WPARAM)window->hwnd, (LPARAM)HTCLIENT); + } + } /* Commit backbuffer */ G_CommitBackbuffer(frame.backbuffer, vsync); diff --git a/src/window/window_win32/window_win32.h b/src/window/window_win32/window_win32.h index cc5ae470..9d587c9a 100644 --- a/src/window/window_win32/window_win32.h +++ b/src/window/window_win32/window_win32.h @@ -26,7 +26,7 @@ Struct(WND_W32_Window) Arena *w2u_events_arena; /* User -> Window proc */ - Atomic64 new_cursor; + Atomic64 desired_cursor; }; ////////////////////////////////////////////////////////////