The MASM Forum

Projects => Game Development => Topic started by: LordAdef on April 14, 2019, 05:02:42 AM

Title: Dialogs
Post by: LordAdef on April 14, 2019, 05:02:42 AM
Hey guys!
Because of lack of time, I decided to tackle something easier that is still missing in my game.
..Dialogs..
Games need cool Dialogs, not those boring Windows ones.
Instead of finding out how to customize/learn the Windows way of doing it, I decided to code my own dialogs.

If anyone has any interest, I'll be happy to clean and share the code.
Although mine is already working, I am interest in knowing different solutions for this topic. Please let me know.
For now I'd like to ask: What's the conventional behaviour for bringing the dialogs up, on "mouse down" or "mouse up"?
Cheers Alex
Title: Re: Dialogs
Post by: jj2007 on April 14, 2019, 12:18:06 PM
Quote from: LordAdef on April 14, 2019, 05:02:42 AMWhat's the conventional behaviour for bringing the dialogs up, on "mouse down" or "mouse up"?
Click here (http://masm32.com/board/index.php?topic=7788.0) to find out.
Title: Re: Dialogs
Post by: LordAdef on April 14, 2019, 03:06:50 PM
Quote from: jj2007 on April 14, 2019, 12:18:06 PM
Quote from: LordAdef on April 14, 2019, 05:02:42 AMWhat's the conventional behaviour for bringing the dialogs up, on "mouse down" or "mouse up"?
Click here (http://masm32.com/board/index.php?topic=7788.0) to find out.
Hi JJ,
Unless your link was only for me to click it, the link is of this very thread.
Otherwise, the link responds to the mouse up event.
However, menus respond to the mouse down events.
I am curious to check on your link


Title: Re: Dialogs
Post by: jj2007 on April 14, 2019, 06:39:05 PM
Quote from: LordAdef on April 14, 2019, 03:06:50 PM
Otherwise, the link responds to the mouse up event.

Yes, that's the whole point ;-)

Check whatever you like: menu file open, the close box in the upper right corner, etc, it's always the mouse up event.

Quote from: LordAdef on April 14, 2019, 03:06:50 PM
However, menus respond to the mouse down events.

Check again. Mine on Win7 and Win10 respond to mouse up.
Title: Re: Dialogs
Post by: LordAdef on April 15, 2019, 05:29:58 AM
QuoteCheck again. Mine on Win7 and Win10 respond to mouse up.
Quote
Top menus are mouse down, for me. Win10, but on a laptop.
But it makes sense for dialogs to be mouse up, so one can trace mouse coords to move things around, during the mouse down.
Thanks! I've learned it's never a waste of time to ask stupid questions :dazzled:
Title: Re: Dialogs
Post by: LordAdef on April 15, 2019, 07:44:22 AM
By the way, has anyone around here implemented a dialog system? I will soon post mine solution, but am curious to know
Title: Re: Dialogs
Post by: jj2007 on April 15, 2019, 09:56:30 AM
Sure :P

include \masm32\MasmBasic\MasmBasic.inc         ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
 DlgDefine "Please enter your data, tab for next line:", 0, 0, 150, -4, , 12   ; x, y ignored, 150 wide, 4 lines, blank, font size 12
  ; the blank arg uses DlgDefStyle=WS_OVERLAPPED or WS_SYSMENU or DS_CENTER - modify if necessary
  DlgControl dcEdit,   "First name", WS_BORDER or WS_TABSTOP, 1, -2    ; first control gets the focus; this is the 2nd line
  DlgControl dcEdit,   "Family name", WS_BORDER or WS_TABSTOP, 1, -4   ; x, y only, the macro will assign width, height and ID
  DlgControl dcStatic,         "Type your first name:", SS_LEFT, 1, -1, 70.0           ; 70 means 70% - the buttons need space; line 1
  DlgControl dcButton,         "OK", BS_DEFPUSHBUTTON or WS_TABSTOP, 71.0, -1, 12.0, , IDOK            ; x=71%, y, width=14%, height, ID
  DlgControl dcButton,         "Quit", BS_PUSHBUTTON or WS_TABSTOP, 84.0, -1, 16.0, , IDCANCEL
  DlgControl dcStatic,         wCat$("Type your family name: (it's "+wTime$+" now)"), SS_LEFT, 1, -3
; DlgHandler MyHandler                         ; optional - PM me for details
  DlgShow
  .if eax==IDOK                         ; user clicked OK, let's see what was typed into the two edit boxes:
        wMsgBox 0, wCat$(Dlg$(0)+wCrLf$+Dlg$(1)), "Please confirm:", MB_OKCANCEL
  .endif
EndOfCode
Title: Re: Dialogs
Post by: LordAdef on April 15, 2019, 12:36:44 PM
Just built it. Nice and clean.
I will post my version as soon as possible.
Title: Re: Dialogs
Post by: daydreamer on April 17, 2019, 01:25:49 AM
Quote from: LordAdef on April 14, 2019, 05:02:42 AM
Hey guys!
Because of lack of time, I decided to tackle something easier that is still missing in my game.
..Dialogs..
Games need cool Dialogs, not those boring Windows ones.
Instead of finding out how to customize/learn the Windows way of doing it, I decided to code my own dialogs.

If anyone has any interest, I'll be happy to clean and share the code.
Although mine is already working, I am interest in knowing different solutions for this topic. Please let me know.
For now I'd like to ask: What's the conventional behaviour for bringing the dialogs up, on "mouse down" or "mouse up"?
Cheers Alex
I would be interested,great to see you work on your game again
Title: Re: Dialogs
Post by: LordAdef on April 18, 2019, 09:08:20 AM
Thanks dayDreamer,


I do it everytime I can, but sometimes it's quite difficult. Either because of the work, or exaustion.


As soon as I have a working demo I share.