Misc changes

This commit is contained in:
Krzosa Karol
2022-10-13 20:46:03 +02:00
parent 022f874c32
commit 16a2fe659e
5 changed files with 50 additions and 20 deletions

View File

@@ -5,24 +5,24 @@
#import "Windows.core"
Platform :: struct
bitmap: Bitmap
bitmap: WIN32_Bitmap
window_dc: HDC
window: HWND
good_scheduling: Bool
Bitmap :: struct
WIN32_Bitmap :: struct
size: Vec2I
data: *U32
hdc: HDC
dib: HBITMAP
compatible_dc: HDC
IsValidBitmap :: (b: *Bitmap): Bool
IsValidBitmap :: (b: *WIN32_Bitmap): Bool
result := b.data != 0
return result
CreateBitmap :: (for_dc: HDC, size: Vec2I, bottom_up: Bool = true): Bitmap
result: Bitmap = {size = size}
CreateBitmap :: (for_dc: HDC, size: Vec2I, bottom_up: Bool = true): WIN32_Bitmap
result: WIN32_Bitmap = {size = size}
if bottom_up == false
result.size.y = -result.size.y
@@ -46,13 +46,13 @@ CreateBitmap :: (for_dc: HDC, size: Vec2I, bottom_up: Bool = true): Bitmap
result.compatible_dc = for_dc
return result
DestroyBitmap :: (b: *Bitmap)
DestroyBitmap :: (b: *WIN32_Bitmap)
if IsValidBitmap(b)
DeleteDC(b.hdc)
DeleteObject(b.dib)
ZeroMemory(b, SizeOf(Bitmap))
ZeroMemory(b, SizeOf(WIN32_Bitmap))
DrawBitmapInCompatibleDC :: (b: *Bitmap)
DrawBitmapInCompatibleDC :: (b: *WIN32_Bitmap)
if(IsValidBitmap(b))
SelectObject(b.hdc, b.dib)
BitBlt(b.compatible_dc, 0, 0, b.size.x->int, b.size.y->int, b.hdc, 0, 0, SRCCOPY)