Fix error when using default argument

This commit is contained in:
Krzosa Karol
2022-06-14 21:16:17 +02:00
parent a4513fcdfa
commit 44ee0f4351
3 changed files with 26 additions and 14 deletions

View File

@@ -6,17 +6,17 @@ Vec2 :: struct;; x: F32; y: F32
Windows_Bitmap :: struct
size: Vec2I
data: *U32
hdc: HDC
dib: HBITMAP
create_bitmap :: (size: Vec2I, bottom_up: Bool)
bitmap: Windows_Bitmap = {size = size}
create_bitmap :: (size: Vec2I, bottom_up: Bool = true): Windows_Bitmap
result: Windows_Bitmap = {size = size}
if bottom_up == false
bitmap.size.y = -bitmap.size.y
result.size.y = -result.size.y
hdc := GetDC(0)
bminfo := BITMAPINFO{
bmiHeader = BITMAPINFOHEADER{
BITMAPINFOHEADER{
biSize = size_of(BITMAPINFOHEADER),
biWidth = size.x->LONG,
biHeight = size.y->LONG,
@@ -28,10 +28,14 @@ create_bitmap :: (size: Vec2I, bottom_up: Bool)
}
}
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
pass
bitmap := create_bitmap({1280, 720})
// memory := os.reserve(size = 10000)
// os.commit(&memory, 1000)
// os.release(&memory)