Skip to content

win32

FreeBodyEngine.core.window.win32 #

IMAGE_CURSOR = 2 module-attribute #

LR_CREATEDIBSECTION = 8192 module-attribute #

LR_DEFAULTSIZE = 64 module-attribute #

LR_LOADFROMFILE = 16 module-attribute #

kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) module-attribute #

user32 = ctypes.WinDLL('user32', use_last_error=True) module-attribute #

Win32Cursor(image) #

Bases: Cursor

The Win32 implementation of the cursor class. Converts image into .cur file format and sets up for use with Win32.

Builds a Win32 HCURSOR from image's PIL image via build_cursor_from_pil().

handle = build_cursor_from_pil(self.image._image) instance-attribute #

image = image instance-attribute #

Win32Window(size, title) #

Bases: Window

The Win32 implmentation of the window class. Supports both OpenGL and Vulkan renderers.

Registers a Win32 window class and creates the window, marking the process DPI-aware first.

DPI awareness is set via SetProcessDpiAwareness (falling back to the older SetProcessDPIAware if that API isn't available) before window creation, since Windows decides scaling behavior for a window based on the process's DPI-awareness state at creation time.

hdc = win32gui.GetDC(self._window) instance-attribute #

position property #

Moves the window to new (x, y), in pixels, keeping its current size.

size property writable #

The window's size, in pixels, as (right, bottom) of its window rect.

window_type = 'win32' instance-attribute #

close() #

Releases the window's device context and destroys the window.

create_mouse() #

Not yet implemented - returns a bare Service('mouse') placeholder rather than a working Mouse.

draw() #

Swaps the window's GDI buffers to present the frame.

is_ready() #

True once the window has received its first WM_PAINT.

update() #

Closes the window if its native handle has become invalid, then pumps any waiting Win32 messages.

wnd_proc(hwnd, msg, wparam, lparam) #

The window's WNDPROC - handles WM_DESTROY (closes the window), WM_PAINT (marks the window ready) and WM_SIZE (emits WINDOW_RESIZE), passing everything else to DefWindowProc.