News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Direct2d breakout

Started by BugCatcher, May 18, 2018, 02:38:10 AM

Previous topic - Next topic

avcaballero


BugCatcher

#16
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                                   -

Caché GB

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

;#############################################################################################################

Caché GB's 1 and 0-nly language:MASM

BugCatcher

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

Caché GB

Hi BugCatcher.
This looks awesome. I can't wait till it's complete. 
Caché GB's 1 and 0-nly language:MASM

BugCatcher

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.

felipe

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: