News:

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

Main Menu

FloodFill and ExtFloodFill

Started by zedd151, February 26, 2025, 03:08:52 PM

Previous topic - Next topic

zedd151

I have been working on using gdi32 drawing functions to use instead of bitmaps for my tic tac toe game.
I now have all of the bimaps removed from the game. All of the drawing issues have been resolved.


No Title bar, no movable borders. You close the program with the ESC key.  :wink2:  Plain and simple.
I might add an ini file, for the user to select their own color for X and O. This image shows another variation of contrasting colors for X and O.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

sinsi

Can't you just draw a line using a wide pen? For the X.

zedd151

Quote from: sinsi on February 26, 2025, 03:31:30 PMCan't you just draw a line using a wide pen? For the X.
I have not.   :sad: I was spending way too much time trying to figure the FloodFill problems out.
What would the 'points' of the X look like, I hope not rounded.
I'll try that when I get back inside, to see how it looks.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

sinsi

Quote from: zedd151 on February 26, 2025, 03:39:36 PMWhat would the 'points' of the X look like
Think of a thick texta (sharpie?)

zedd151

Quote from: sinsi on February 26, 2025, 03:41:02 PM
Quote from: zedd151 on February 26, 2025, 03:39:36 PMWhat would the 'points' of the X look like
Think of a thick texta (sharpie?)
Okay. If needed I could always put in a coupla lines to make the points less round and more square like the bitmap.
I'll post my progress in a little while.  :smiley:

It never dawned on me to try it. I did think about using extra large fonts though.
Speaking of fonts, I used to have a bootleg copy of Font Creator. You could design your own fonts, even from a bitmap.  :biggrin:  I might just explore that possibility, if this doesn't look very good using wide pen..
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

NoCforMe

Dunno if it'll help, but I have my own flood-fill routine I could post that you could try. Works for me.
Assembly language programming should be fun. That's why I do it.

sinsi

Quote from: zedd151 on February 26, 2025, 03:44:54 PMIt never dawned on me to try it.
First thing I thought of :biggrin:

Flashbacks to drawing on a 320x200x256 VGA screen on a 386sx. Everything.
None of this fancy Windows drawing stuff.

zedd151

#7
It needs a little tweaking, but I can live with that.

Thanks, sinsi. That works much better, it will look even better after a few adjustments.


Quote from: sinsi on February 26, 2025, 04:25:57 PM
Quote from: zedd151 on February 26, 2025, 03:44:54 PMIt never dawned on me to try it.
First thing I thought of :biggrin:

Flashbacks to drawing on a 320x200x256 VGA screen on a 386sx. Everything.
None of this fancy Windows drawing stuff.
I never had to suffer such Phun.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

sinsi


zedd151

Quote from: NoCforMe on February 26, 2025, 04:03:38 PMDunno if it'll help, but I have my own flood-fill routine I could post that you could try. Works for me.

I totally missed your post earlier. Sorry.
Sure, you only need to post the essential bits. I won't need a full blown example. At least I don't think I will.

Quote from: sinsi on February 26, 2025, 04:49:59 PMThe new X looks friendlier :badgrin:
Why do you fear the old style?  :greensml:
I still need to tweak it so it looks 'right' next to the O's.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

zedd151

I just had another overnight epiphany while I slept, sinsi.  :biggrin:

Why the hell don't I now use the thick pen to also draw the "O", so it will look much better when side by side with the new and improved "X".

Last night, I was thinking about making the X (created with a thick pen), look better and match it to the O, which was created using filled ellipses.

Kinda like making an apple look like an orange.  :joking:

Amazing what a little sleep can do, to restore common sense, or at least better thought processes.  :biggrin:

¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

daydreamer

Quote from: zedd151 on February 26, 2025, 03:44:54 PM
Quote from: sinsi on February 26, 2025, 03:41:02 PM
Quote from: zedd151 on February 26, 2025, 03:39:36 PMWhat would the 'points' of the X look like
Think of a thick texta (sharpie?)
Okay. If needed I could always put in a coupla lines to make the points less round and more square like the bitmap.
I'll post my progress in a little while.  :smiley:

It never dawned on me to try it. I did think about using extra large fonts though.
Speaking of fonts, I used to have a bootleg copy of Font Creator. You could design your own fonts, even from a bitmap.  :biggrin:  I might just explore that possibility, if this doesn't look very good using wide pen..
I am using code that changes font to bigger size in my unicode chess,so big 'X' and 'O' could be used
 
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

zedd151

Quote from: daydreamer on February 27, 2025, 02:18:01 AMI am using code that changes font to bigger size in my unicode chess,so big 'X' and 'O' could be used
 
I have considered that possibilty as well. I am currently working on a different approach, though.   :biggrin:
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

zedd151

#13
YaY! I got 'er done.Thanks again sinsi for a simple solution. I like simplicity. But I still wonder why I had issues with FloodFill and ExtFloodFill.

    DrawX proc hDC:dword, color:dword, x:dword, y:dword
    local hPen:dword, hPenOld:dword
        invoke CreatePen, PS_SOLID, 20, red
        mov hPen, eax
        invoke SelectObject, hDC, hPen
        mov hPenOld, eax
        mov ecx, x
        mov edx, y
        add ecx, 26
        add edx, 26
        invoke MoveToEx, hDC, ecx, edx, 0
        mov ecx, x
        add ecx, 112
        mov edx, y
        add edx, 112
        invoke LineTo, hDC, ecx, edx
        mov ecx, x
        add ecx, 112
        mov edx, y
        add edx, 26
        invoke MoveToEx, hDC, ecx, edx, 0
        mov ecx, x
        mov edx, y
        add ecx, 26
        add edx, 112
        invoke LineTo, hDC, ecx, edx
        invoke SelectObject, hDC, hPenOld
        invoke DeleteObject, hPen
        ret
    DrawX endp

    DrawO proc hDC:dword, hback:dword, hfill:dword, x:dword, y:dword
    local hPen:dword
        invoke SelectObject, hDC, hback
        invoke CreatePen, PS_SOLID, 18, blue
        mov hPen, eax
        invoke SelectObject, hDC, hPen
        add x, 32
        mov eax, x
        add eax, 96
        add y, 32
        mov ecx, y
        add ecx, 96
        invoke Ellipse, hDC, x, y, eax, ecx
        ret
    DrawO endp

So that issue is still unresolved. I must have spent the better part of half a day messing around trying to get either of those to behave.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

raymond

Have you ever considered using the CreatePolygonRgn and FillRgn functions with two regions, one for each the oblique parts of the X.

It would fill the center part of the X twice but who cares!
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html