Author Topic: Direct2d breakout  (Read 427 times)

BugCatcher

  • Regular Member
  • *
  • Posts: 41
Direct2d breakout
« on: May 18, 2018, 02:38:10 AM »
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
« Last Edit: June 16, 2018, 02:23:25 AM by BugCatcher »

jj2007

  • Member
  • *****
  • Posts: 8437
  • Assembler is fun ;-)
    • MasmBasic
Re: Direct2d breakout
« Reply #1 on: May 18, 2018, 04:54:59 AM »
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?

caballero

  • Member
  • ****
  • Posts: 973
    • Abre Ojos Ensamblador
Re: Direct2d breakout
« Reply #2 on: May 18, 2018, 05:10:57 AM »
In my W7 looks nice, but a bit huge and 25% CPU consuming. Did you use the Siekmanski d2d example?
En un lugar de la Mancha de cuyo nombre no quiero acordarme

BugCatcher

  • Regular Member
  • *
  • Posts: 41
Re: Direct2d breakout
« Reply #3 on: May 18, 2018, 06:54:11 AM »
Quote
In 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.

Code: [Select]
  .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.




jj2007

  • Member
  • *****
  • Posts: 8437
  • Assembler is fun ;-)
    • MasmBasic
Re: Direct2d breakout
« Reply #4 on: May 18, 2018, 06:57:18 AM »
Windows doesn't work like that. Use GetMessage instead of PeekMessage...

Ascended

  • Member
  • ***
  • Posts: 331
Re: Direct2d breakout
« Reply #5 on: May 18, 2018, 10:07:27 PM »
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.

daydreamer

  • Member
  • ***
  • Posts: 416
Re: Direct2d breakout
« Reply #6 on: May 19, 2018, 07:17:46 AM »
doesnt work on any of my computers :(
Quote from Flashdance
Nick  :  When you give up your dream, you die.

zedd151

  • Member
  • ****
  • Posts: 591
  • -------------
Re: Direct2d breakout
« Reply #7 on: May 19, 2018, 11:07:09 AM »
win 10 home 64 bit, 70-80% cpu usage

looks nice so far and the menu works good

__________________________________________________________________
I'll be back to coding soon....

BugCatcher

  • Regular Member
  • *
  • Posts: 41
Re: Direct2d breakout
« Reply #8 on: May 22, 2018, 01:44:25 AM »
Fixed the window size problem. Now buttons light up when mouse hovers over them.

BugCatcher

  • Regular Member
  • *
  • Posts: 41
Re: Direct2d breakout
« Reply #9 on: May 22, 2018, 08:55:45 AM »
Buttons now click. Quit button works

zedd151

  • Member
  • ****
  • Posts: 591
  • -------------
Re: Direct2d breakout
« Reply #10 on: May 22, 2018, 01:09:51 PM »
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

__________________________________________________________________
I'll be back to coding soon....

LordAdef

  • Member
  • ****
  • Posts: 588
Re: Direct2d breakout
« Reply #11 on: May 22, 2018, 02:43:38 PM »
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

LordAdef

  • Member
  • ****
  • Posts: 588
Re: Direct2d breakout
« Reply #12 on: May 22, 2018, 02:46:07 PM »
Nice menu man!!!!!!! Classy stuff

win10. CPU at about 18%.

As soon as you sleep the game loop, CPU goes down to a nice %.


Siekmanski

  • Member
  • *****
  • Posts: 1487
Re: Direct2d breakout
« Reply #13 on: May 22, 2018, 05:48:16 PM »
OS win 8.1

When I click on start, the button flashes but nothing happens.
Or am I doing something wrong?
Creative coders use backward thinking techniques as their strategy.

BugCatcher

  • Regular Member
  • *
  • Posts: 41
Re: Direct2d breakout
« Reply #14 on: May 23, 2018, 01:22:02 AM »
Quote
When 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.