Fix error when using default argument
This commit is contained in:
@@ -44,18 +44,17 @@ BI_PNG :: 0x0005
|
||||
BI_CMYK :: 0x000B
|
||||
BI_CMYKRLE8 :: 0x000C
|
||||
BI_CMYKRLE4 :: 0x000
|
||||
DIB_RGB_COLORS :: 0x00
|
||||
|
||||
BITMAPINFO :: struct
|
||||
bmiHeader :: BITMAPINFOHEADER
|
||||
bmiColors :: [1]RBGQUAD
|
||||
|
||||
|
||||
|
||||
// #import #foreign "gdi32.lib" @todo
|
||||
CreateWindowA :: #foreign (dwExStyle: DWORD, lpClassName: *char, lpWindowName: *char, dwStyle: DWORD, X: int, Y: int, nWidth: int, nHeight: int, hWndParent: HWND, hMenu: HMENU, hInstance: HINSTANCE, lpParam: *void): HWND
|
||||
GetDC :: #foreign (hWnd: HWND): HDC
|
||||
CreateDIBSection :: #foreign (hdc: HDC, pbmi: *BITMAPINFO, usage: UINT, ppvBits: **VOID, hSection: HANDLE, offset: DWORD): HBITMAP
|
||||
CreateCompatibleDC :: (hdc: HDC): HDC
|
||||
CreateCompatibleDC :: #foreign (hdc: HDC): HDC
|
||||
|
||||
MEM_COMMIT :: 0x00001000
|
||||
MEM_RESERVE :: 0x00002000
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user