Drawing to screen using multimedia
This commit is contained in:
@@ -5,3 +5,7 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS
|
|||||||
for UpdateMultimedia()
|
for UpdateMultimedia()
|
||||||
if Mu.key[Key.Escape].is_down
|
if Mu.key[Key.Escape].is_down
|
||||||
Mu.quit = true
|
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
|
||||||
@@ -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.os.bitmap = W32.CreateBitmap(Mu.os.window_dc, size)
|
||||||
|
|
||||||
Mu.scrn = Mu.os.bitmap.data
|
Mu.scrn = Mu.os.bitmap.data
|
||||||
Mu.x = Mu.os.bitmap.size.x
|
Mu.x = size.x
|
||||||
Mu.y = Mu.os.bitmap.size.y
|
Mu.y = size.y
|
||||||
|
|
||||||
UpdateMultimedia :: (): Bool
|
UpdateMultimedia :: (): Bool
|
||||||
|
DrawBitmapInCompatibleDC(&Mu.os.bitmap)
|
||||||
|
|
||||||
msg: MSG
|
msg: MSG
|
||||||
for PeekMessageW(&msg, Mu.os.window, 0, 0, PM_REMOVE) == 1
|
for PeekMessageW(&msg, Mu.os.window, 0, 0, PM_REMOVE) == 1
|
||||||
TranslateMessage(&msg)
|
TranslateMessage(&msg)
|
||||||
DispatchMessageW(&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
|
Mu.frame_count += 1
|
||||||
frame_time := Time() - Mu.time.frame_start
|
frame_time := Time() - Mu.time.frame_start
|
||||||
Mu.time.total += frame_time
|
Mu.time.total += frame_time
|
||||||
|
|||||||
Reference in New Issue
Block a user