aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-03-19 00:52:09 +0000
committergingerBill <bill@gingerbill.org>2023-03-19 00:52:09 +0000
commitfa62963da70083d6792c10e161bdee84a19f89f6 (patch)
tree742183a290ba634d2b1c9715246c23ecf9b2e0f3
parent1f5bb99548d4164b3225cb145a44850909d6e0d7 (diff)
parentf1cd56c28ae952478aabbb6522518be80e16e7a0 (diff)
Merge branch 'master' of https://github.com/odin-lang/Odin
-rw-r--r--core/sys/windows/kernel32.odin2
-rw-r--r--core/sys/windows/shell32.odin2
-rw-r--r--core/sys/windows/types.odin167
-rw-r--r--core/sys/windows/user32.odin10
-rw-r--r--vendor/ENet/enet.odin88
5 files changed, 223 insertions, 46 deletions
diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin
index 13ffda371..1bbf910bb 100644
--- a/core/sys/windows/kernel32.odin
+++ b/core/sys/windows/kernel32.odin
@@ -393,6 +393,8 @@ foreign kernel32 {
GetConsoleScreenBufferInfo :: proc(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: PCONSOLE_SCREEN_BUFFER_INFO) -> BOOL ---
SetConsoleScreenBufferSize :: proc(hConsoleOutput: HANDLE, dwSize: COORD) -> BOOL ---
SetConsoleWindowInfo :: proc(hConsoleOutput: HANDLE, bAbsolute : BOOL, lpConsoleWindow: ^SMALL_RECT) -> BOOL ---
+ GetConsoleCursorInfo :: proc(hConsoleOutput: HANDLE, lpConsoleCursorInfo: PCONSOLE_CURSOR_INFO) -> BOOL ---
+ SetConsoleCursorInfo :: proc(hConsoleOutput: HANDLE, lpConsoleCursorInfo: PCONSOLE_CURSOR_INFO) -> BOOL ---
GetDiskFreeSpaceExW :: proc(
lpDirectoryName: LPCWSTR,
diff --git a/core/sys/windows/shell32.odin b/core/sys/windows/shell32.odin
index 2ac84fbba..0a6f90a44 100644
--- a/core/sys/windows/shell32.odin
+++ b/core/sys/windows/shell32.odin
@@ -23,6 +23,8 @@ foreign shell32 {
SHFileOperationW :: proc(lpFileOp: LPSHFILEOPSTRUCTW) -> c_int ---
SHGetFolderPathW :: proc(hwnd: HWND, csidl: c_int, hToken: HANDLE, dwFlags: DWORD, pszPath: LPWSTR) -> HRESULT ---
SHAppBarMessage :: proc(dwMessage: DWORD, pData: PAPPBARDATA) -> UINT_PTR ---
+
+ Shell_NotifyIconW :: proc(dwMessage: DWORD, lpData: ^NOTIFYICONDATAW) -> BOOL ---
}
APPBARDATA :: struct {
diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin
index 514998a43..e6d641c89 100644
--- a/core/sys/windows/types.odin
+++ b/core/sys/windows/types.odin
@@ -724,6 +724,14 @@ CWPRETSTRUCT :: struct {
hwnd: HWND,
}
+MSLLHOOKSTRUCT :: struct {
+ pt: POINT,
+ mouseData: DWORD,
+ flags: DWORD,
+ time: DWORD,
+ dwExtraInfo: ULONG_PTR,
+}
+
KBDLLHOOKSTRUCT :: struct {
vkCode: DWORD,
scanCode: DWORD,
@@ -732,6 +740,59 @@ KBDLLHOOKSTRUCT :: struct {
dwExtraInfo: ULONG_PTR,
}
+MOUSEINPUT :: struct {
+ dx: LONG,
+ dy: LONG,
+ mouseData: DWORD,
+ dwFlags: DWORD,
+ time: DWORD,
+ dwExtraInfo: ULONG_PTR,
+}
+
+KEYBDINPUT :: struct {
+ wVk: WORD,
+ wScan: WORD,
+ dwFlags: DWORD,
+ time: DWORD,
+ dwExtraInfo: ULONG_PTR,
+}
+
+HARDWAREINPUT :: struct {
+ uMsg: DWORD,
+ wParamL: WORD,
+ wParamH: WORD,
+}
+
+INPUT_TYPE :: enum DWORD {
+ MOUSE = 0,
+ KEYBOARD = 1,
+ HARDWARE = 2,
+}
+
+INPUT :: struct {
+ type: INPUT_TYPE,
+ using _: struct #raw_union {
+ mi: MOUSEINPUT,
+ ki: KEYBDINPUT,
+ hi: HARDWAREINPUT,
+ },
+}
+
+MOUSEEVENTF_MOVE :: 0x0001
+MOUSEEVENTF_LEFTDOWN :: 0x0002
+MOUSEEVENTF_LEFTUP :: 0x0004
+MOUSEEVENTF_RIGHTDOWN :: 0x0008
+MOUSEEVENTF_RIGHTUP :: 0x0010
+MOUSEEVENTF_MIDDLEDOWN :: 0x0020
+MOUSEEVENTF_MIDDLEUP :: 0x0040
+MOUSEEVENTF_XDOWN :: 0x0080
+MOUSEEVENTF_XUP :: 0x0100
+MOUSEEVENTF_WHEEL :: 0x0800
+MOUSEEVENTF_HWHEEL :: 0x1000
+MOUSEEVENTF_MOVE_NOCOALESCE :: 0x2000
+MOUSEEVENTF_VIRTUALDESK :: 0x4000
+MOUSEEVENTF_ABSOLUTE :: 0x8000
+
WNDCLASSA :: struct {
style: UINT,
lpfnWndProc: WNDPROC,
@@ -799,6 +860,104 @@ MSG :: struct {
LPMSG :: ^MSG
+NOTIFYICONDATAW :: struct {
+ cbSize: DWORD,
+ hWnd: HWND,
+ uID: UINT,
+ uFlags: UINT,
+ uCallbackMessage: UINT,
+ hIcon: HICON,
+ szTip: [128]WCHAR,
+ dwState: DWORD,
+ dwStateMask: DWORD,
+ szInfo: [256]WCHAR,
+ using _: struct #raw_union {
+ uTimeout: UINT,
+ uVersion: UINT,
+ },
+ szInfoTitle: [64]WCHAR,
+ dwInfoFlags: DWORD,
+ guidItem: GUID,
+ hBalloonIcon: HICON,
+}
+
+NIF_MESSAGE :: 0x00000001
+NIF_ICON :: 0x00000002
+NIF_TIP :: 0x00000004
+NIF_STATE :: 0x00000008
+NIF_INFO :: 0x00000010
+NIF_GUID :: 0x00000020
+NIF_REALTIME :: 0x00000040
+NIF_SHOWTIP :: 0x00000080
+
+NIM_ADD :: 0x00000000
+NIM_MODIFY :: 0x00000001
+NIM_DELETE :: 0x00000002
+NIM_SETFOCUS :: 0x00000003
+NIM_SETVERSION :: 0x00000004
+
+// Menu flags for Add/Check/EnableMenuItem()
+MF_INSERT :: 0x00000000
+MF_CHANGE :: 0x00000080
+MF_APPEND :: 0x00000100
+MF_DELETE :: 0x00000200
+MF_REMOVE :: 0x00001000
+
+MF_BYCOMMAND :: 0x00000000
+MF_BYPOSITION :: 0x00000400
+
+MF_SEPARATOR :: 0x00000800
+
+MF_ENABLED :: 0x00000000
+MF_GRAYED :: 0x00000001
+MF_DISABLED :: 0x00000002
+
+MF_UNCHECKED :: 0x00000000
+MF_CHECKED :: 0x00000008
+MF_USECHECKBITMAPS :: 0x00000200
+
+MF_STRING :: 0x00000000
+MF_BITMAP :: 0x00000004
+MF_OWNERDRAW :: 0x00000100
+
+MF_POPUP :: 0x00000010
+MF_MENUBARBREAK :: 0x00000020
+MF_MENUBREAK :: 0x00000040
+
+MF_UNHILITE :: 0x00000000
+MF_HILITE :: 0x00000080
+
+MF_DEFAULT :: 0x00001000
+MF_SYSMENU :: 0x00002000
+MF_HELP :: 0x00004000
+MF_RIGHTJUSTIFY :: 0x00004000
+
+MF_MOUSESELECT :: 0x00008000
+MF_END :: 0x00000080 // Obsolete -- only used by old RES files
+
+// Flags for TrackPopupMenu
+TPM_LEFTBUTTON :: 0x0000
+TPM_RIGHTBUTTON :: 0x0002
+TPM_LEFTALIGN :: 0x0000
+TPM_CENTERALIGN :: 0x0004
+TPM_RIGHTALIGN :: 0x0008
+TPM_TOPALIGN :: 0x0000
+TPM_VCENTERALIGN :: 0x0010
+TPM_BOTTOMALIGN :: 0x0020
+
+TPM_HORIZONTAL :: 0x0000 /* Horz alignment matters more */
+TPM_VERTICAL :: 0x0040 /* Vert alignment matters more */
+TPM_NONOTIFY :: 0x0080 /* Don't send any notification msgs */
+TPM_RETURNCMD :: 0x0100
+TPM_RECURSE :: 0x0001
+TPM_HORPOSANIMATION :: 0x0400
+TPM_HORNEGANIMATION :: 0x0800
+TPM_VERPOSANIMATION :: 0x1000
+TPM_VERNEGANIMATION :: 0x2000
+TPM_NOANIMATION :: 0x4000
+TPM_LAYOUTRTL :: 0x8000
+TPM_WORKAREA :: 0x10000
+
// WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes
HTERROR :: -2
HTTRANSPARENT :: -1
@@ -3782,8 +3941,14 @@ CONSOLE_SCREEN_BUFFER_INFO :: struct {
dwMaximumWindowSize: COORD,
}
+CONSOLE_CURSOR_INFO :: struct {
+ dwSize: DWORD,
+ bVisible: BOOL,
+}
+
PCONSOLE_SCREEN_BUFFER_INFO :: ^CONSOLE_SCREEN_BUFFER_INFO
+PCONSOLE_CURSOR_INFO :: ^CONSOLE_CURSOR_INFO
//
// Networking
@@ -4018,4 +4183,4 @@ DNS_SRV_DATAA :: struct {
SOCKADDR :: struct {
sa_family: ADDRESS_FAMILY,
sa_data: [14]CHAR,
-} \ No newline at end of file
+}
diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin
index f59bdf9e3..c1a6791cc 100644
--- a/core/sys/windows/user32.odin
+++ b/core/sys/windows/user32.odin
@@ -109,6 +109,12 @@ foreign user32 {
GetDlgCtrlID :: proc(hWnd: HWND) -> c_int ---
GetDlgItem :: proc(hDlg: HWND, nIDDlgItem: c_int) -> HWND ---
+ CreatePopupMenu :: proc() -> HMENU ---
+ DestroyMenu :: proc(hMenu: HMENU) -> BOOL ---
+ AppendMenuW :: proc(hMenu: HMENU, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCWSTR) -> BOOL ---
+ TrackPopupMenu :: proc(hMenu: HMENU, uFlags: UINT, x: int, y: int, nReserved: int, hWnd: HWND, prcRect: ^RECT) -> i32 ---
+ RegisterWindowMessageW :: proc(lpString: LPCWSTR) -> UINT ---
+
GetUpdateRect :: proc(hWnd: HWND, lpRect: LPRECT, bErase: BOOL) -> BOOL ---
ValidateRect :: proc(hWnd: HWND, lpRect: ^RECT) -> BOOL ---
InvalidateRect :: proc(hWnd: HWND, lpRect: ^RECT, bErase: BOOL) -> BOOL ---
@@ -206,6 +212,8 @@ foreign user32 {
GetRegisteredRawInputDevices :: proc(pRawInputDevices: PRAWINPUTDEVICE, puiNumDevices: PUINT, cbSize: UINT) -> UINT ---
RegisterRawInputDevices :: proc(pRawInputDevices: PCRAWINPUTDEVICE, uiNumDevices: UINT, cbSize: UINT) -> BOOL ---
+ SendInput :: proc(cInputs: UINT, pInputs: [^]INPUT, cbSize: ^c_int) -> UINT ---
+
SetLayeredWindowAttributes :: proc(hWnd: HWND, crKey: COLORREF, bAlpha: BYTE, dwFlags: DWORD) -> BOOL ---
FillRect :: proc(hDC: HDC, lprc: ^RECT, hbr: HBRUSH) -> int ---
@@ -469,4 +477,4 @@ WINDOWINFO :: struct {
atomWindowType: ATOM,
wCreatorVersion: WORD,
}
-PWINDOWINFO :: ^WINDOWINFO \ No newline at end of file
+PWINDOWINFO :: ^WINDOWINFO
diff --git a/vendor/ENet/enet.odin b/vendor/ENet/enet.odin
index 37e65b497..0e4493a17 100644
--- a/vendor/ENet/enet.odin
+++ b/vendor/ENet/enet.odin
@@ -343,58 +343,58 @@ foreign ENet {
deinitialize :: proc() ---
linked_version :: proc() -> Version ---
time_get :: proc() -> u32 ---
- time_set :: proc(u32) ---
+ time_set :: proc(newTimeBase: u32) ---
socket_create :: proc(SocketType) -> Socket ---
- socket_bind :: proc(Socket, ^Address) -> i32 ---
- socket_get_address :: proc(Socket, ^Address) -> i32 ---
- socket_listen :: proc(Socket, i32) -> i32 ---
- socket_accept :: proc(Socket, ^Address) -> Socket ---
- socket_connect :: proc(Socket, ^Address) -> i32 ---
- socket_send :: proc(Socket, ^Address, ^Buffer, uint) -> i32 ---
- socket_receive :: proc(Socket, ^Address, ^Buffer, uint) -> i32 ---
- socket_wait :: proc(Socket, ^u32, u32) -> i32 ---
- socket_set_option :: proc(Socket, SocketOption, i32) -> i32 ---
- socket_get_option :: proc(Socket, SocketOption, ^i32) -> i32 ---
- socket_shutdown :: proc(Socket, SocketShutdown) -> i32 ---
- socket_destroy :: proc(Socket) ---
- socketset_select :: proc(Socket, ^SocketSet, ^SocketSet, u32) -> i32 ---
+ socket_bind :: proc(socket: Socket, address: ^Address) -> i32 ---
+ socket_get_address :: proc(socket: Socket, address: ^Address) -> i32 ---
+ socket_listen :: proc(socket: Socket, backlog: i32) -> i32 ---
+ socket_accept :: proc(socket: Socket, address: ^Address) -> Socket ---
+ socket_connect :: proc(socket: Socket, address: ^Address) -> i32 ---
+ socket_send :: proc(socket: Socket, address: ^Address, buffers: [^]Buffer, bufferCount: uint) -> i32 ---
+ socket_receive :: proc(socket: Socket, address: ^Address, buffers: [^]Buffer, bufferCount: uint) -> i32 ---
+ socket_wait :: proc(socket: Socket, condition: ^u32, timeout: u32) -> i32 ---
+ socket_set_option :: proc(socket: Socket, option: SocketOption, value: i32) -> i32 ---
+ socket_get_option :: proc(socket: Socket, option: SocketOption, value: ^i32) -> i32 ---
+ socket_shutdown :: proc(socket: Socket, how: SocketShutdown) -> i32 ---
+ socket_destroy :: proc(socket: Socket) ---
+ socketset_select :: proc(socket: Socket, readSet: ^SocketSet, writeSet: ^SocketSet, timeout: u32) -> i32 ---
address_set_host_ip :: proc(address: ^Address, hostName: cstring) -> i32 ---
address_set_host :: proc(address: ^Address, hostName: cstring) -> i32 ---
address_get_host_ip :: proc(address: ^Address, hostName: [^]u8, nameLength: uint) -> i32 ---
address_get_host :: proc(address: ^Address, hostName: [^]u8, nameLength: uint) -> i32 ---
- packet_create :: proc(rawptr, uint, u32) -> ^Packet ---
- packet_destroy :: proc(^Packet) ---
- packet_resize :: proc(^Packet, uint) -> i32 ---
- crc32 :: proc(^Buffer, uint) -> u32 ---
-
- host_create :: proc(^Address, uint, uint, u32, u32) -> ^Host ---
- host_destroy :: proc(^Host) ---
- host_connect :: proc(^Host, ^Address, uint, u32) -> ^Peer ---
- host_check_events :: proc(^Host, ^Event) -> i32 ---
- host_service :: proc(^Host, ^Event, u32) -> i32 ---
- host_flush :: proc(^Host) ---
- host_broadcast :: proc(^Host, u8, ^Packet) ---
- host_compress :: proc(^Host, ^Compressor) ---
- host_compress_with_range_coder :: proc(^Host) -> i32 ---
- host_channel_limit :: proc(^Host, uint) ---
- host_bandwidth_limit :: proc(^Host, u32, u32) ---
-
- peer_send :: proc(^Peer, u8, ^Packet) -> i32 ---
- peer_receive :: proc(^Peer, ^u8) -> ^Packet ---
- peer_ping :: proc(^Peer) ---
- peer_ping_interval :: proc(^Peer, u32) ---
- peer_timeout :: proc(^Peer, u32, u32, u32) ---
- peer_reset :: proc(^Peer) ---
- peer_disconnect :: proc(^Peer, u32) ---
- peer_disconnect_now :: proc(^Peer, u32) ---
- peer_disconnect_later :: proc(^Peer, u32) ---
- peer_throttle_configure :: proc(^Peer, u32, u32, u32) ---
+ packet_create :: proc(data: rawptr, dataLength: uint, flags: PacketFlag) -> ^Packet ---
+ packet_destroy :: proc(packet: ^Packet) ---
+ packet_resize :: proc(packet: ^Packet, dataLength: uint) -> i32 ---
+ crc32 :: proc(buffers: [^]Buffer, bufferCount: uint) -> u32 ---
+
+ host_create :: proc(address: ^Address, peerCount: uint, channelLimit: uint, incomingBandwidth: u32, outgoingBandwidth: u32) -> ^Host ---
+ host_destroy :: proc(host: ^Host) ---
+ host_connect :: proc(host: ^Host, address: ^Address, channelCount: uint, data: u32) -> ^Peer ---
+ host_check_events :: proc(host: ^Host, event: ^Event) -> i32 ---
+ host_service :: proc(host: ^Host, event: ^Event, timeout: u32) -> i32 ---
+ host_flush :: proc(host: ^Host) ---
+ host_broadcast :: proc(host: ^Host, channelID: u8, packet: ^Packet) ---
+ host_compress :: proc(host: ^Host, compressor: ^Compressor) ---
+ host_compress_with_range_coder :: proc(host: ^Host) -> i32 ---
+ host_channel_limit :: proc(host: ^Host, channelLimit: uint) ---
+ host_bandwidth_limit :: proc(host: ^Host, incomingBandwidth: u32, outgoingBandwidth: u32) ---
+
+ peer_send :: proc(peer: ^Peer, channelID: u8, packet: ^Packet) -> i32 ---
+ peer_receive :: proc(peer: ^Peer, channelID: ^u8) -> ^Packet ---
+ peer_ping :: proc(peer: ^Peer) ---
+ peer_ping_interval :: proc(peer: ^Peer, pingInterval: u32) ---
+ peer_timeout :: proc(peer: ^Peer, timoutLimit: u32, timeoutMinimum: u32, timeoutMaximum: u32) ---
+ peer_reset :: proc(peer: ^Peer) ---
+ peer_disconnect :: proc(peer: ^Peer, data: u32) ---
+ peer_disconnect_now :: proc(peer: ^Peer, data: u32) ---
+ peer_disconnect_later :: proc(peer: ^Peer, data: u32) ---
+ peer_throttle_configure :: proc(peer: ^Peer, interval: u32, acceleration: u32, deceleration: u32) ---
range_coder_create :: proc() -> rawptr ---
- range_coder_destroy :: proc(rawptr) ---
- range_coder_compress :: proc(rawptr, [^]Buffer, uint, uint, [^]u8, uint) -> uint ---
- range_coder_decompress :: proc(rawptr, [^]u8, uint, [^]u8, uint) -> uint ---
+ range_coder_destroy :: proc(ctx: rawptr) ---
+ range_coder_compress :: proc(ctx: rawptr, inBuffers: [^]Buffer, inBufferCount: uint, inLimit: uint, outData: [^]u8, outLimit: uint) -> uint ---
+ range_coder_decompress :: proc(ctx: rawptr, inData: [^]u8, inLimit: uint, outData: [^]u8, outLimit: uint) -> uint ---
} \ No newline at end of file