Hex Calc and Cube Calc

Post your working scripts, libraries and tools
x32
Posts: 77
Joined: 25 Nov 2016, 16:44

Hex Calc and Cube Calc

11 Apr 2018, 15:47

This is more of an experiment than something I expect people will find useful. It's an odd shaped calculator with hexagon buttons. Each button is it's own gui, all are linked together with DockA. Eval is used for calculating.

The script, all libraries, and images can be downloaded in the zip file. Hex_Calc.7z

Image

Click here to see Cube Calc.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by x32 on 13 Apr 2018, 10:13, edited 1 time in total.
wolf_II
Posts: 1957
Joined: 08 Feb 2015, 20:55

Re: Hex Calc

11 Apr 2018, 17:29

:bravo: :thumbup: Nice!
After looking closer, I noticed all *.png files have a height of 72, and in code you resize them to h70. This causes the edges to be smeared out.
I tried with searching for h70 and replacing with h72, which seems to clean the edges for me. Is there any reason not to do so?

Thanks for sharing.
x32
Posts: 77
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

11 Apr 2018, 17:50

wolf_II wrote:After looking closer, I noticed all *.png files have a height of 72, and in code you resize them to h70. This causes the edges to be smeared out.
I tried with searching for h70 and replacing with h72, which seems to clean the edges for me. Is there any reason not to do so?.


No reason they can't be set back to 72. I changed it because the images looked taller than their width and it fixed a spacing issue.
burque505
Posts: 492
Joined: 22 Jan 2017, 19:37

Re: Hex Calc

11 Apr 2018, 17:57

Very nice indeed, thank you.
Thank you for sharing this with us.
Bravo!
User avatar
kczx3
Posts: 578
Joined: 06 Oct 2015, 21:39

Re: Hex Calc

11 Apr 2018, 18:11

Why use separate guis?
x32
Posts: 77
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

11 Apr 2018, 20:35

kczx3 wrote:Why use separate guis?

It's the only way I could find to use the odd shaped buttons. Even if I used pics with transparent backgrounds they are still square. If the transparent corner of one button is on top of another button the transparent corner receives the click.
User avatar
BGM
Posts: 419
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: Hex Calc

11 Apr 2018, 21:49

Very interesting! Thanks for sharing!
User avatar
SpeedMaster
Posts: 189
Joined: 12 Nov 2016, 16:09

Re: Hex Calc

12 Apr 2018, 06:57

Very interesting :clap:
x32 wrote:
kczx3 wrote:Why use separate guis?

It's the only way I could find to use the odd shaped buttons. Even if I used pics with transparent backgrounds they are still square. If the transparent corner of one button is on top of another button the transparent corner receives the click.

In theory it is possible take a pixel location (such as a mouse click) and convert it into a hex grid coordinate.
for those who are interested here is a tutorial (maybe too complicated) but well explained: :ugeek:
https://www.redblobgames.com/grids/hexagons/

Cheers
x32
Posts: 77
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

12 Apr 2018, 09:42

That is interesting but beyond my level. However I'm going to study it and see if I can make it work in AHK.
User avatar
kczx3
Posts: 578
Joined: 06 Oct 2015, 21:39

Re: Hex Calc

12 Apr 2018, 19:04

I’d think this could done with gdi as well. It’d be super easy with html/js/css
x32
Posts: 77
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

12 Apr 2018, 19:32

kczx3 wrote:I’d think this could done with gdi as well. It’d be super easy with html/js/css

I made this script years ago, using GDIP, where you could load an image for a background, draw the shape of your controls on the image and it would produce transparent windows over the background image which would received the click. In short, you could draw your own buttons on your background.

That was here;
https://autohotkey.com/board/topic/70340-draw-your-own-controls-no-more-square-buttons/
x32
Posts: 77
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

13 Apr 2018, 10:06

And just because I was reminded about an old script...

Cube Calc. Created using my old script Area as Control.ahk. This took a fraction of the time as creating it from scratch.

Uses DockA to keep it all together and Eval for the calculations.

The scripts, libraries and pics can be found in the zip file, Cube Calc

Image
This code was mostly written automatically. The edit box and transparent background were added.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



The subroutines were automatically added but empty. The commands had to be added.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 13 guests