diff --git a/examples/using_multimedia.core b/examples/using_multimedia.core index ea5c83c..8340686 100644 --- a/examples/using_multimedia.core +++ b/examples/using_multimedia.core @@ -4,4 +4,8 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS StartMultimedia(title = "Hello, people!") for UpdateMultimedia() if Mu.key[Key.Escape].is_down - Mu.quit = true \ No newline at end of file + Mu.quit = true + + for y := 0, y < Mu.y, y+=1 + for x := 0, x < Mu.x, x+=1 + Mu.scrn[x + y*Mu.x] = 0xFFFFFF00 \ No newline at end of file diff --git a/modules/win32_multimedia.core b/modules/win32_multimedia.core index 036d302..064ce7d 100644 --- a/modules/win32_multimedia.core +++ b/modules/win32_multimedia.core @@ -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