66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
// #import "base.kl"
|
|
#load "gdi32.kl"
|
|
#load "user32.kl"
|
|
|
|
String16 :: struct;; str: *U16; len: S64
|
|
String32 :: struct;; str: *U32; len: S64
|
|
UTF32_Result :: struct
|
|
out_str: U32
|
|
advance: S64
|
|
error : Bool
|
|
UTF16_Result :: struct
|
|
out_str: [2]U16
|
|
len : S32
|
|
error : Bool
|
|
|
|
BINARY :: 0b1001
|
|
|
|
utf8_to_utf32 :: (c: *U8, max_advance: S64): UTF32_Result
|
|
result: UTF32_Result
|
|
return result
|
|
|
|
|
|
Vec2I :: struct;; x: S32; y: S32
|
|
Vec2 :: struct;; x: F32; y: F32
|
|
|
|
Windows_Bitmap :: struct
|
|
size: Vec2I
|
|
data: *U32
|
|
hdc: HDC
|
|
dib: HBITMAP
|
|
|
|
create_bitmap :: (size: Vec2I, bottom_up: Bool = true): Windows_Bitmap
|
|
result: Windows_Bitmap = {size = size}
|
|
if bottom_up == false
|
|
result.size.y = -result.size.y
|
|
|
|
bminfo := BITMAPINFO{
|
|
BITMAPINFOHEADER{
|
|
biSize = size_of(BITMAPINFOHEADER),
|
|
biWidth = size.x->LONG,
|
|
biHeight = size.y->LONG,
|
|
biPlanes = 1,
|
|
biBitCount = 32,
|
|
biCompression = BI_RGB,
|
|
biXPelsPerMeter = 1,
|
|
biYPelsPerMeter = 1,
|
|
}
|
|
}
|
|
|
|
hdc := GetDC(0)
|
|
result.dib = CreateDIBSection(hdc, &bminfo, DIB_RGB_COLORS, &result.data->**void, 0, 0)
|
|
result.hdc = CreateCompatibleDC(hdc)
|
|
return result
|
|
|
|
|
|
window_procedure :: (hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM): LRESULT
|
|
if msg == WM_DESTROY
|
|
PostQuitMessage(0)
|
|
return 0
|
|
else;; return DefWindowProc(hwnd, msg, wparam, lparam)
|
|
|
|
main :: (argc: int, argv: **char): int
|
|
bitmap := create_bitmap({1280, 720})
|
|
|
|
|