Author Topic: Coloured rounded buttons  (Read 854 times)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Coloured rounded buttons
« on: August 25, 2022, 10:08:07 AM »
Spinoff from the recent buttons thread: test the Click me now! button :cool:

zedd151

  • Member
  • *****
  • Posts: 1626
Re: Coloured rounded buttons
« Reply #1 on: August 25, 2022, 10:27:12 AM »
I haven't downloaded it yet to check it out, I'm on my iPad. Does this mean you found a solution? Or did you opt for a different method?
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1626
Re: Coloured rounded buttons
« Reply #2 on: August 25, 2022, 10:52:56 AM »
Looks okay over here. Windows 7 64 bit OS.
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Re: Coloured rounded buttons
« Reply #3 on: August 25, 2022, 06:15:47 PM »
I haven't downloaded it yet to check it out, I'm on my iPad. Does this mean you found a solution? Or did you opt for a different method?

I opted for a full ownerdraw, with FillRect, DrawText etc. It's not yet perfect but I'm working on it. Syntax:

Code: [Select]
GuiControl MyButton, "button", "Coloured pushbutton", font -16:FW_BOLD, fcol DarkBlue, bcol LiteYellow, y310, w300, h300, BS_OWNERDRAW
You may have noted that the window is sizeable:
y310   310/1000 of main window height
w300   300/1000 of main window width
h300   300/1000 of main window height

zedd151

  • Member
  • *****
  • Posts: 1626
Re: Coloured rounded buttons
« Reply #4 on: August 25, 2022, 06:25:00 PM »
Cool. Glad you have gotten that all sorted out.
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Re: Coloured rounded buttons
« Reply #5 on: August 27, 2022, 10:53:55 AM »
New version - to the left, the new button, to the right the old one.

Still work in progress, but I am getting nearer :badgrin:
« Last Edit: August 27, 2022, 07:04:17 PM by jj2007 »

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Tic Tac Toe
« Reply #6 on: August 30, 2022, 06:50:56 AM »
In contrast to Swordfish, I have no game logic so far, this is just the graphics (and yes, this is the complete source :tongue:):

GuiParas equ "Tic Tac Toe", w172, h280, m4, b LitePink, icon Dice      ; width+height, margins, background colour
include \masm32\MasmBasic\Res\MbGui.asm
  rct=0
  Repeat 3                                      ; variable+fixed parts
        GuiControl @CatStr(<ttt>, %rct+0), "button", x000, y rct*111+1, h333, w333, bcol LiteYellow, font -32:FW_BOLD
        GuiControl @CatStr(<ttt>, %rct+1), "button", x333, y rct*111+1, h333, w333, bcol LiteGreen, font -32:FW_BOLD
        GuiControl @CatStr(<ttt>, %rct+2), "button", x666, y rct*111+1, h333, w333, bcol LiteBlue, font -32:FW_BOLD
        rct=rct+3
  Endm
  GuiControl MyStatus, "statusbar", wRec$(Str$("Last ID=%i, common controls version ", %IdCt)+ComCtl32$())
Event Key
  .if VKey==-VK_ESCAPE
        invoke SendMessage, hGui, WM_CLOSE, 0, 0
  .endif
Event Command
  If_ nCode==BN_CLICKED Then SetWin$ <rv(GetDlgItem, hGui, MenuID)>="X"
GuiEnd

zedd151

  • Member
  • *****
  • Posts: 1626
Re: Coloured rounded buttons
« Reply #7 on: August 30, 2022, 06:55:30 AM »
For the game logic (AI lol)
Test for winning move first. If found, take it
Next test for blocking move, if found take it. Sometimes more than one though, in that case computer will lose.
If none of those are found test the center square, take it.
Else a random move.


daydreamer is also contemplating a tic tac toe game


We should have each other's AI play against each other. lol
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Re: Coloured rounded buttons
« Reply #8 on: August 30, 2022, 07:12:32 AM »
We should have each other's AI play against each other. lol

One day - right now, I've too many unfinished projects :sad:

zedd151

  • Member
  • *****
  • Posts: 1626
Re: Coloured rounded buttons
« Reply #9 on: August 30, 2022, 07:13:43 AM »
Rumour has it that you are King in that regard
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Re: Coloured rounded buttons
« Reply #10 on: September 01, 2022, 10:19:10 AM »
Yeah, that's true :biggrin:

I am just playing around :cool:

Btw this is Win7-64, on Win10 the fish looks different. I also wonder why it remains black & white on Win10 :sad:


zedd151

  • Member
  • *****
  • Posts: 1626
Re: Coloured rounded buttons
« Reply #11 on: September 01, 2022, 10:22:24 AM »
I don't know if it will be fun, but it looks fun(ny).
Where's the X and O?  :biggrin:
I'll look at it later...
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Tic Tac Toe
« Reply #12 on: September 02, 2022, 10:18:53 AM »
It still looks as above, but now the logic is implemented. Still with little glitches, but one can play the game :cool:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Tic Tac Toe
« Reply #13 on: September 02, 2022, 08:57:02 PM »
Version 3, almost perfect, and no font problems :cool:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13336
  • Assembly is fun ;-)
    • MasmBasic
Re: Coloured rounded buttons
« Reply #14 on: September 02, 2022, 11:10:06 PM »
Version 4 has a manual mode: type m

If manual mode is on, Shift click plays for the software. This is basically for verifying if there are better moves than what the software chooses for itself. For example:

Code: [Select]
P#1 P#2
r0c0 r2c2
r0c2 r0c1
r2c0 r1c0
r1c1 player won

Does anybody know a sequence that allows player #2 to win?