Decided to have some fun with direct2d. Ive started a 2d game engine and so far Ive got some objects and a menue. Pressing the esc key toggles the menue in and out. I'd be curious if it works on windows xp as I don't have that os anymore.
My ide is radAsm 3.0.0.c and artwork with inkscape. Os is windows 7
On XP SP3, it says D2D1.dll not found:(
On Win7-64, it shows red squares but CPU usage goes over the top - did you forget the message pump?
In my W7 looks nice, but a bit huge and 25% CPU consuming. Did you use the Siekmanski d2d example?
QuoteIn my W7 looks nice, but a bit huge and 25% CPU consuming. Did you use the Siekmanski d2d example?
No, its all my own stuff.
.WHILE TRUE
invoke PeekMessage, ADDR msg, NULL, 0, 0, PM_REMOVE
.if (eax != 0)
;===================================
; Break if it was the quit messge
;===================================
mov eax, msg.message
.IF eax == WM_QUIT
;======================
; Break out
;======================
jmp shutdown
.endif
;===================================
; Translate and Dispatch the message
;===================================
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.endif
invoke OnRender
invoke UpdateMenue
invoke UpdateObjects
.ENDW
I am flipping the screen 34 times a second. Painting the background and all objects.
Windows doesn't work like that. Use GetMessage instead of PeekMessage...
Quote from: jj2007 on May 18, 2018, 06:57:18 AM
Windows doesn't work like that. Use GetMessage instead of PeekMessage...
PeekMessage is normal for games. I'd definitely not recommend GetMessage, end user will get all sorts of weird stalls.
doesnt work on any of my computers :(
win 10 home 64 bit, 70-80% cpu usage
looks nice so far and the menu works good
Fixed the window size problem. Now buttons light up when mouse hovers over them.
Buttons now click. Quit button works
The new 3 state buttons look good, cpu usage is down to 45-46% a step in the right direction. :t
Windows 64 Home edition
Quote from: Ascended on May 18, 2018, 10:07:27 PM
Quote from: jj2007 on May 18, 2018, 06:57:18 AM
Windows doesn't work like that. Use GetMessage instead of PeekMessage...
PeekMessage is normal for games. I'd definitely not recommend GetMessage, end user will get all sorts of weird stalls.
+1 with Ascended: games usually use Peekmessage
Nice menu man!!!!!!! Classy stuff
win10. CPU at about 18%.
As soon as you sleep the game loop, CPU goes down to a nice %.
OS win 8.1
When I click on start, the button flashes but nothing happens.
Or am I doing something wrong?
QuoteWhen I click on start, the button flashes but nothing happens.
Or am I doing something wrong?
Just the quit button works for now. I'm working on a high scores screen right now.
-1 :t
Updated mouse coordinates on screen resize.
There is a scores screen. -No text yet.
There is a Start game.
Tried to use mouse messages for the paddle,way too herkie jerkie. So I translated DirectInput8,and now the paddle is very smooth and fast.
Need .686 directive for floating point. (?)
Next is the dreaded collision detection. -Gulp -
Hi BugCatcher
Try this
;#############################################################################################################
MsgLoopMain PROC
Local wMsg:MSG
invoke RtlZeroMemory, addr wMsg, sizeof(MSG)
mAm wMsg.hwnd, TheApp.hWind
.while true
invoke PeekMessage, addr wMsg, null, 0, 0, PM_REMOVE
.if (eax != 0)
.break .if (wMsg.message == WM_QUIT)
invoke TranslateAccelerator, TheApp.hWind, TheApp.hAccel, addr wMsg
.if (eax == 0)
invoke TranslateMessage, addr wMsg
invoke DispatchMessage, addr wMsg
.endif
.else
invoke UpdateTimers
invoke UpdateDetectInput
invoke UpdateCamera
invoke UpdateScene
invoke RenderScene
;; For BugCatcher
;; V V
invoke SleepEx, null, false ;; <-- Give up the rest of your time slice.
.endif
.endw
return wMsg.wParam
MsgLoopMain ENDP
;#############################################################################################################
Ok here it is.
.WHILE TRUE
invoke PeekMessage, ADDR msg, NULL, 0, 0, PM_REMOVE
.if (eax != 0)
;===================================
; Break if it was the quit messge
;===================================
mov eax, msg.message
.IF eax == WM_QUIT
;======================
; Break out
;======================
jmp shutdown
.endif
;===================================
; Translate and Dispatch the message
;===================================
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.endif
invoke Main_Game_Loop,hWnd
.if PaddleActivated?
invoke DI_Read_Mouse,hWnd
invoke Process_Paddle
.endif
invoke SleepEx, 0, FALSE ;; <-- Give up the rest of your time slice.
.ENDW
Hi BugCatcher.
This looks awesome. I can't wait till it's complete.
Collision detection is finished. Small bug in paddle,no big thing. Bricks light up.
Next is some specialized bricks for more fun.
Finish high score screen.
Hey bugcatcher the game is not working all ok by now (at least on my pc :idea:) but if you can finish it, this will be sure a great game. Congrats. :icon14: