Misc changes
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
size_t :: U64
|
||||
size_t :: U64 // @todo(Krzosa): Need this type
|
||||
long :: #strict int // @todo(Krzosa): Need this type
|
||||
|
||||
malloc :: #foreign (size: size_t): *void
|
||||
realloc :: #foreign (ptr: *void, size: size_t): *void
|
||||
free :: #foreign (ptr: *void)
|
||||
|
||||
FILE :: #strict U64 // Doesnt matter the type just handle
|
||||
fopen :: #foreign (file: *char, mode: *char): *FILE
|
||||
fclose :: #foreign (file: *FILE): int
|
||||
fseek :: #foreign (public_stream: *FILE, offset: long, whence: int): int
|
||||
ftell :: #foreign (public_stream: *FILE): long
|
||||
fread :: #foreign (buffer: *void, element_size: size_t, element_count: size_t, stream: *FILE): size_t
|
||||
|
||||
SEEK_CUR :: 1
|
||||
SEEK_END :: 2
|
||||
SEEK_SET :: 0
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user