From ed7f273a91b494d03e88aacd2c24a46d1b8f783e Mon Sep 17 00:00:00 2001 From: Paul W Date: Wed, 28 Jan 2026 01:36:47 +0000 Subject: [PATCH] revert 654367a6d52ee271ac391a96a708f254135da6c6 revert Add borderless-win32-odin, lua-dylib-odin --- .gitignore | 1 - borderless-win32-odin/main.odin | 167 ------------------------- linked-list-odin/linked-list/list.odin | 10 +- lua-dylib-odin/.gitignore | 3 - lua-dylib-odin/build.bat | 2 - lua-dylib-odin/main.odin | 34 ----- lua-dylib-odin/test.lua | 4 - odin-templating/README.md | 2 +- 8 files changed, 6 insertions(+), 217 deletions(-) delete mode 100644 .gitignore delete mode 100644 borderless-win32-odin/main.odin delete mode 100644 lua-dylib-odin/.gitignore delete mode 100644 lua-dylib-odin/build.bat delete mode 100644 lua-dylib-odin/main.odin delete mode 100644 lua-dylib-odin/test.lua diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b883f1f..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.exe diff --git a/borderless-win32-odin/main.odin b/borderless-win32-odin/main.odin deleted file mode 100644 index 150a3b2..0000000 --- a/borderless-win32-odin/main.odin +++ /dev/null @@ -1,167 +0,0 @@ -package borderless_win - -import "core:os" -import win32 "core:sys/windows" - -// foreign import win32ex "system:User32.lib" -// @(default_calling_convention="stdcall") -// foreign win32ex { -// IsZoomed :: proc (hwnd: win32.HWND) -> win32.BOOL --- -// } -// IsMaximized :: IsZoomed - -WM_NCUAHDRAWCAPTION :: (0x00AE) -WM_NCUAHDRAWFRAME :: (0x00AF) - -UserData := struct { - dwm_enabled: win32.BOOL, - width: i32, - height: i32, -} { - dwm_enabled = false, - width = 0, - height = 0, -} - -handle_nchittest :: proc "stdcall" (hwnd: win32.HWND, lparam: win32.LPARAM) -> win32.LRESULT { - // if IsMaximized(hwnd) do return win32.HTCLIENT - mouse := win32.POINT{win32.GET_X_LPARAM(lparam), win32.GET_Y_LPARAM(lparam)} - win32.ScreenToClient(hwnd, &mouse) - frame_size := - win32.GetSystemMetrics(win32.SM_CXFRAME) + win32.GetSystemMetrics(win32.SM_CXPADDEDBORDER) - diagonal_width := frame_size * 2 + win32.GetSystemMetrics(win32.SM_CXBORDER) - - if mouse.y < frame_size { - if mouse.x < diagonal_width do return win32.HTTOPLEFT - if mouse.x >= UserData.width - diagonal_width do return win32.HTTOPRIGHT - return win32.HTTOP - } - - if mouse.y >= UserData.height - frame_size { - if mouse.x < diagonal_width do return win32.HTBOTTOMLEFT - if mouse.x >= UserData.width - diagonal_width do return win32.HTBOTTOMRIGHT - return win32.HTBOTTOM - } - - if mouse.x < frame_size do return win32.HTLEFT - if mouse.x >= UserData.width - frame_size do return win32.HTRIGHT - return win32.HTCLIENT -} - -handle_windowposchanged :: proc "stdcall" ( - hwnd: win32.HWND, - pos: ^win32.WINDOWPOS, -) -> win32.LRESULT { - client: win32.RECT - win32.GetClientRect(hwnd, &client) - last_width, last_height := UserData.width, UserData.height - UserData.width, UserData.height = client.right, client.bottom - client_changed := UserData.width != last_width || UserData.height != last_height - - if client_changed { - if UserData.width > last_width do win32.InvalidateRect(hwnd, &(win32.RECT){last_width - 1, 0, last_width, last_height}, true) - else do win32.InvalidateRect(hwnd,&(win32.RECT){UserData.width - 1, 0, UserData.width, UserData.height}, true) - if UserData.height > last_height do win32.InvalidateRect(hwnd, &(win32.RECT){0, last_height - 1, last_width, last_height}, true) - else do win32.InvalidateRect(hwnd, &(win32.RECT){0, UserData.height - 1, UserData.width, UserData.height}, true) - } - return 0 -} - -handle_dwmcompositionchanged :: proc "stdcall" (hwnd: win32.HWND) { - enabled: win32.BOOL = false - win32.DwmIsCompositionEnabled(&enabled) - UserData.dwm_enabled = enabled - if enabled { - win32.DwmSetWindowAttribute( - hwnd, - u32(win32.DWMWINDOWATTRIBUTE.DWMWA_NCRENDERING_POLICY), - rawptr(uintptr(win32.DWORD(win32.DWMNCRENDERINGPOLICY.DWMNCRP_ENABLED))), - size_of(win32.DWORD), - ) - } -} - -handle_win32_events :: proc "stdcall" ( - hwnd: win32.HWND, - msg: win32.UINT, - wparam: win32.WPARAM, - lparam: win32.LPARAM, -) -> win32.LRESULT { - switch msg { - case win32.WM_CLOSE: - win32.DestroyWindow(hwnd) - return 0 - case win32.WM_DESTROY: - win32.PostQuitMessage(0) - return 0 - case win32.WM_PAINT: - ps: win32.PAINTSTRUCT - hdc := win32.BeginPaint(hwnd, &ps) - win32.FillRect(hdc, &ps.rcPaint, win32.HBRUSH(win32.COLOR_BACKGROUND + uintptr(1))) - win32.EndPaint(hwnd, &ps) - return 0 - case win32.WM_NCACTIVATE: - return win32.DefWindowProcW(hwnd, msg, wparam, -1) - case win32.WM_NCHITTEST: - return handle_nchittest(hwnd, lparam) - case win32.WM_WINDOWPOSCHANGED: - return handle_windowposchanged(hwnd, transmute(^win32.WINDOWPOS)(lparam)) - case win32.WM_NCCALCSIZE: - return 0 - case win32.WM_NCPAINT: - if !UserData.dwm_enabled do return 0 - case win32.WM_LBUTTONDOWN: - win32.ReleaseCapture() - win32.SendMessageW(hwnd, win32.WM_NCLBUTTONDOWN, win32.HTCAPTION, 0) - case win32.WM_DWMCOMPOSITIONCHANGED: - handle_dwmcompositionchanged(hwnd) - return 0 - case WM_NCUAHDRAWCAPTION: - return 0 - case WM_NCUAHDRAWFRAME: - return 0 - } - return win32.DefWindowProcW(hwnd, msg, wparam, lparam) -} - -main :: proc() { - hinstance := win32.HINSTANCE(win32.GetModuleHandleW(nil)) - - cid := win32.RegisterClassExW( - &(win32.WNDCLASSEXW) { - cbSize = size_of(win32.WNDCLASSEXW), - hInstance = hinstance, - hbrBackground = win32.HBRUSH(win32.COLOR_WINDOW + uintptr(1)), - lpszClassName = win32.utf8_to_wstring("OdinBorderlessWindow"), - hCursor = win32.LoadCursorA(nil, win32.IDC_ARROW), - lpfnWndProc = handle_win32_events, - }, - ) - - hwnd := win32.CreateWindowExW( - 0, - win32.LPCWSTR(uintptr(cid)), - win32.utf8_to_wstring("Borderless Window"), - win32.WS_OVERLAPPEDWINDOW | win32.WS_SIZEBOX, - win32.CW_USEDEFAULT, - win32.CW_USEDEFAULT, - win32.CW_USEDEFAULT, - win32.CW_USEDEFAULT, - nil, - nil, - hinstance, - nil, - ) - handle_dwmcompositionchanged(hwnd) - win32.ShowWindow(hwnd, win32.SW_SHOWNORMAL) - win32.UpdateWindow(hwnd) - - message: win32.MSG - for win32.GetMessageW(&message, nil, 0, 0) != 0 { - win32.TranslateMessage(&message) - win32.DispatchMessageW(&message) - } - - win32.UnregisterClassW(win32.LPCWSTR(uintptr(cid)), hinstance) - os.exit(int(message.wParam)) -} diff --git a/linked-list-odin/linked-list/list.odin b/linked-list-odin/linked-list/list.odin index 5c3a3c8..b7955c4 100644 --- a/linked-list-odin/linked-list/list.odin +++ b/linked-list-odin/linked-list/list.odin @@ -6,18 +6,18 @@ node :: struct($Value: typeid) { next: ^node(Value), } -to_string :: proc(head: ^node($T), trunc_after: int = 8) -> string { +to_string :: proc(head: ^node($T)) -> string { curr := head out: string counter := 0 - out = fmt.aprintf("[%v]", curr.data) + out = fmt.tprintf("[%v]", curr.data) for curr.next != nil{ curr = curr.next - if trunc_after > 0 && counter >= trunc_after { - out = fmt.aprintf("%s -> ... -> [%v]", out, tail(curr.next)) + if counter >= 8 { + out = fmt.tprintf("%s -> ... -> [%v]", out, tail(curr.next)) break } - out = fmt.aprintf("%s -> [%v]", out, curr.data) + out = fmt.tprintf("%s -> [%v]", out, curr.data) counter += 1 } diff --git a/lua-dylib-odin/.gitignore b/lua-dylib-odin/.gitignore deleted file mode 100644 index e182bde..0000000 --- a/lua-dylib-odin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -args.dll -args.exp -args.lib \ No newline at end of file diff --git a/lua-dylib-odin/build.bat b/lua-dylib-odin/build.bat deleted file mode 100644 index 4141258..0000000 --- a/lua-dylib-odin/build.bat +++ /dev/null @@ -1,2 +0,0 @@ -odin build . -build-mode:dll -out:args.dll -lua test.lua \ No newline at end of file diff --git a/lua-dylib-odin/main.odin b/lua-dylib-odin/main.odin deleted file mode 100644 index d1b7126..0000000 --- a/lua-dylib-odin/main.odin +++ /dev/null @@ -1,34 +0,0 @@ -package args - -import "base:runtime" -import "core:fmt" - -LUA_SHARED :: true -import lua "vendor:lua/5.4" - -lua_print_arg_count :: lua.L_Reg { - name = "printargcount", - func = lua_print_arg_count_proc, -} - -lua_print_arg_count_proc :: proc "c" (L: ^lua.State) -> i32 { - context = runtime.default_context() - top := lua.gettop(L) - if top > 0 { - fmt.println(top, "arguments were passed to the function", lua_print_arg_count.name) - } else { - fmt.println("no arguments were passed to the function", lua_print_arg_count.name) - } - return 0 -} - -procs :: []lua.L_Reg{lua_print_arg_count, {nil, nil}} - -@(export) -luaopen_args :: proc(L: ^lua.State) -> i32 { - lua.L_checkversion(L) - lua.L_newlib(L, procs) - lua.pushinteger(L, 8008135) - lua.setfield(L, -2, "version") - return 1 -} diff --git a/lua-dylib-odin/test.lua b/lua-dylib-odin/test.lua deleted file mode 100644 index 9a0dc79..0000000 --- a/lua-dylib-odin/test.lua +++ /dev/null @@ -1,4 +0,0 @@ -local a = require'args' -print('version', a.version) -print('printargcount(1,2,3):') -a.printargcount(1,2,3) \ No newline at end of file diff --git a/odin-templating/README.md b/odin-templating/README.md index d22684f..18e20da 100644 --- a/odin-templating/README.md +++ b/odin-templating/README.md @@ -59,4 +59,4 @@ -``` +``` \ No newline at end of file