Drawing to screen using multimedia

This commit is contained in:
Krzosa Karol
2022-10-01 22:47:20 +02:00
parent 4451553e85
commit 5baff3585e
2 changed files with 17 additions and 3 deletions

View File

@@ -133,15 +133,25 @@ StartMultimedia :: (x: S64 = 1280, y: S64 = 720, title: String = "Hello people!"
Mu.os.bitmap = W32.CreateBitmap(Mu.os.window_dc, size)
Mu.scrn = Mu.os.bitmap.data
Mu.x = Mu.os.bitmap.size.x
Mu.y = Mu.os.bitmap.size.y
Mu.x = size.x
Mu.y = size.y
UpdateMultimedia :: (): Bool
DrawBitmapInCompatibleDC(&Mu.os.bitmap)
msg: MSG
for PeekMessageW(&msg, Mu.os.window, 0, 0, PM_REMOVE) == 1
TranslateMessage(&msg)
DispatchMessageW(&msg)
size := GetWindowSize(Mu.os.window)
if size.x != Mu.x || size.y != Mu.y
DestroyBitmap(&Mu.os.bitmap)
CreateBitmap(Mu.os.window_dc, size)
Mu.x = size.x
Mu.y = size.y
Mu.frame_count += 1
frame_time := Time() - Mu.time.frame_start
Mu.time.total += frame_time