Files
corelang/programs/main.kl
2022-06-14 21:16:17 +02:00

44 lines
1.0 KiB
Plaintext

// #import "base.kl"
#load "Windows.kl"
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
main :: (argc: int, argv: **char): int
bitmap := create_bitmap({1280, 720})
// memory := os.reserve(size = 10000)
// os.commit(&memory, 1000)
// os.release(&memory)
// os.print("Hello world")