News:

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

Main Menu

sudoku avatar creator

Started by zedd151, April 30, 2024, 08:05:44 AM

Previous topic - Next topic

zedd151

I was having a little fun with making my current 'sudoku' based avatar (and the previous one). It was rather time consuming though, and sometimes error prone. I came up with the idea to code a small version of a sudoku player to automate some of that. (instead of just using ms paint to fill the cells manually by copy & pasting the bitmap)

This is the first step towards that goal...
A 127x127 sudoku grid is dislayed in the client area of the main window.

During real game play, the user would fill in a value into an open 'cell' then click on 'Print Frame' to capture the current frame and save it to a sequentially numbered bitmap file.
This is done for each empty cell on the grid, until the board is completely filled.

The folder with the sequentially numbered files will then be opened in Image Ready to make the animated .gif. I do it in this way because I do not know (yet!) how to do that conversion programmatically. (I briefly looked into doing that, it won't be easy... )

code is attached.
This is in the 'Game Development' board because once it is finished, it will be a playable sudoku game (A tiny one) This is only the start of the code, just an empty sudoku grid at this time. (no cells filled yet with values)

A 'work-in-progress' as I am modifying existing code to work in this new project. I will post updates here as the project progresses... and I have time to devote to it...  :smiley:

This is the program Window (currently) the output is a 127x127 bitmap image(s), images will be sequential starting at "00.bmp" once I add the code to do that.

I hate how PostImg shrinks (slightly) this image, but leaves others alone... click image to view full size

Latest version attached here

jj2007


zedd151

#2
I found a library that might be just what I need for converting a series of bitmaps to animated .gif

imagemagick libraries
Of course they don't list x86 assembly, but the C version should work. I will investigate this later for possible incorporation into the project.
I have not downloaded yet. If it is a bloated library or has too many dependencies, I may not use it though.
I will see when I'm back at my computer...

Later...
Hmmm... no .lib files, only C sources (headers, structures, etc) that need to be compiled. :sad:
Seems I will not use that after all. I will (probably way in the future) write the code to make the animated .gif. I have already been looking at some reference material to do just that.

Biterider


zedd151

Thanks Biterider, jj2007.

After thinking about it for a bit, I think I should make the user interface probably twice as large or a little more.
There will be at least one more menu item on the menu bar, possibly two more.
I just made it in its current form for the initial demo.

Now time to start working on the code.  :biggrin: Will probably post updated code, some time within the next few hours or so, time permitting.

FORTRANS

Hi,

   Well, interesting project.  I looked at the posted code,
and it looks as if you just produce 127x127 pixel "frames".
Animated GIFs allow for smaller images to be overlayed onto
an existing image.  You might consider making nine 13x13
pixel images and placing them one by one to make your final
animated sequence.  Or, of course, I may have misread your
code?

Regards,

Steve N.

Edit:  128 => 127

zedd151

Hi FORTRANS, if you look at my avatar it has 57 frames. It starts with a grid with 24 clues. Each value is placed one by one, in subsequent frames. Hence, 57 frames. (127x127)
I use ImageReady to assemble the sequence of bitmaps into an optimized GIF, since I do not know (yet) how to do that in code.

C3

Quote from: sudoku on April 30, 2024, 10:08:36 PMHi FORTRANS, if you look at my avatar it has 57 frames. It starts with a grid with 24 clues. Each value is placed one by one, in subsequent frames. Hence, 57 frames. (127x127)
I use ImageReady to assemble the sequence of bitmaps into an optimized GIF, since I do not know (yet) how to do that in code.

I think GDI+ @Microsoft Learn documentation will help you to do you avatar with code.

zedd151

Quote from: C3 on April 30, 2024, 10:19:54 PMI think GDI+ @Microsoft Learn documentation will help you to do you avatar with code.
Thanks, C3. I have been doing some research on this already, including reading related topics at MS Learn.  :smiley:

TimoVJL

Perhaps you could use EMF for temporary storage format to save every frame, as it can used to scale quite easily for later usage.
Later GDI+ could save them in usable bitmap format for GIF.

May the source be with you

FORTRANS

Hi,

Quote from: sudoku on April 30, 2024, 10:08:36 PMHi FORTRANS, if you look at my avatar it has 57 frames. It starts with a grid with 24 clues. Each value is placed one by one, in subsequent frames. Hence, 57 frames. (127x127)

  Right, but if you followed my suggestion, you would still have
57 images.  One 127x127 and 56 13x13.  Just a different way of doing
things.

QuoteI use ImageReady to assemble the sequence of bitmaps into an optimized GIF, since I do not know (yet) how to do that in code.

  Well, I wrote my own programs to play around with animated GIFs.
Probably of no interest as they are MS-DOS programs.  And looking at
them today, a rather opaque coding style.  Amazing what you (I) can
forget about something made a while back.  Hash tables, wow.

Cheers,

Steve N.

zedd151

Quote from: FORTRANS on May 01, 2024, 01:06:04 AMHi,
...
Right, but if you followed my suggestion, you would still have
57 images.  One 127x127 and 56 13x13.  Just a different way of doing
things.
:thumbsup:
Not a big matter, as ImageReady is doing the heavy lifting. The sequence of bitmaps produced are only needed for a short time until the animated GIF is made, then the sequence of bitmaps discarded. I plan on (attempting at least), creating an animated GIF in code, at some point in the future.

jj2007

Latest (and earlier) versions work fine here on Windows 7+10 :thumbsup:

zedd151

Quote from: learn64bit on May 01, 2024, 01:16:55 AMyes. your .exe same symptoms here, haha
Quote from: learn64bit on May 01, 2024, 01:16:55 AMOooops, I broked my win7
Yes, problems with your computer.  :thumbsup:   ...haha

zedd151

#14
Progress is a little slower than I had hoped. I am not going to reuse existing code (too time consuming and can introduce bugs) as I first planned but write the funtions for this from scratch.
Anyway I now have implemented cell selection.

click anywhere with the game board to 'select' a cell. Clicking outside of the game board removes the selection.

I have also coded for the sequential file naming. When capturing the game board the first capture is always "00.bmp"...

First file is "00.bmp"
second is "01.bmp"
third  "02.bmp" and so forth...

I have also made the window a bit bigger (will need space for a couple more menu items)

latest version attached in post #1