News:

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

Main Menu

Coloured rounded buttons

Started by jj2007, August 25, 2022, 10:08:07 AM

Previous topic - Next topic

jj2007

Spinoff from the recent buttons thread: test the Click me now! button :cool:

zedd151

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?

zedd151

Looks okay over here. Windows 7 64 bit OS.

jj2007

Quote from: Swordfish 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?

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

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

Cool. Glad you have gotten that all sorted out.

jj2007

#5
New version - to the left, the new button, to the right the old one.

Still work in progress, but I am getting nearer :badgrin:

jj2007

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

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

jj2007

Quote from: Swordfish on August 30, 2022, 06:55:30 AMWe should have each other's AI play against each other. lol

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

zedd151

Rumour has it that you are King in that regard

jj2007

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

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...

jj2007

It still looks as above, but now the logic is implemented. Still with little glitches, but one can play the game :cool:

jj2007

Version 3, almost perfect, and no font problems :cool:

jj2007

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:

P#1 P#2
r0c0 r2c2
r0c2 r0c1
r2c0 r1c0
r1c1 player won


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