Roman Clock

Post gaming related scripts
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Roman Clock

31 Dec 2017, 12:36

I have been playing around with GDIP+ and roman numerals.
The script also contains a function called Zoom(), with the AHK version 1.1.27, it can be renamed to Scale()
Dependency:
ScreenShot:
Hotkeys:

Attachments
Roman Clock.zip
(8.97 KiB) Downloaded 147 times
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 06:17

Hello wolf_II :wave:
This doesn't work for me on win7, I believe it is beacuse of the combination of some of the styles and setparent, it requires win 10 if irc.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 10:05

:wave: Oops, I remember now. sorry.

I really should look into moving the "canvas" with some other method. I look how you moved the circles or something a while back.
I am just working on Pong now, and it is also using setparent to a GuiControl :(. I'm glad you mention the Win7 problem again.
If I get anywhere, I (c|s)hould update my spinner as well. And then see how that breaks "Anagrams" (hopefully it would not break anything).
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 10:17

Edit: I forgot in case I read it before, does this work in Win7?

Code: Select all

#NoEnv
#SingleInstance, Force

    CoordMode, Mouse, Screen
    r := 50, d := 100

    Gui, +AlwaysOnTop                   ; always on top
    Gui, -Caption                       ; no titlebar
    Gui, +Owner                         ; no taskbar button
    Gui, +hWndhGui                      ; handle
    Gui, +E0x00000020                   ; WS_EX_TRANSPARENT (click through)
    Gui, +E0x00080000                   ; WS_EX_LAYERED
    Gui, Show, NA

    Gdip_Startup()
    hDC := CreateCompatibleDC()
    hBM := CreateDIBSection(d, d)
    oBM := SelectObject(hDC, hBM)
    Graph := Gdip_GraphicsFromHdc(hDC)
    Brush := Gdip_BrushCreateSolid(0x40FFFF00) ; (alpha) RGB

Return



;-------------------------------------------------------------------------------
F12:: ; toggle circle on/off
;-------------------------------------------------------------------------------
    If Toggle := !Toggle {
        Gdip_FillEllipse(Graph, Brush, 0, 0, d, d)
        SetTimer, Update, 10
    }

    Else {
        SetTimer, Update, Off
        Gdip_GraphicsClear(Graph)
        UpdateLayeredWindow(hGui, hDC, mX-r, mY-r, d, d)
    }

Return



;-------------------------------------------------------------------------------
Update: ; update layered window
;-------------------------------------------------------------------------------
    MouseGetPos, mX, mY
    UpdateLayeredWindow(hGui, hDC, mX-r, mY-r, d, d)

Return
In this script, the styles are used, but SetParent is not.
It looks like I can position the graphic using UpdateLayeredWindow
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 11:32

I see a transparent circle :P

Cheers.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 12:03

Thx for the feedback. I'll start rewriting the code.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 16:12

This might work on Win7, I can't tell though.
  • removed the nested Gui
  • fixed style "Neutral" which got broken along the way. Missing colour definitions default to black now.
Roman Clock.zip
(8.71 KiB) Downloaded 101 times
PS: Not implemented yet: adding SetWinDelay, -1 to the auto-execute section seems to help smooth zooming. :)
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 17:06

Great, it works!

I notice a small border at the top and left edge, I see that

Code: Select all

Gdip_FillRectangle(pGraphics, Brush.Back, 0, 0, Width-1, Height-1)
adds border to bottom and right, and

Code: Select all

Gdip_FillRectangle(pGraphics, Brush.Back, -1, -1, Width+1, Height+1)
removes border.

Indeed setwindelay -1 seems to smoothen the zoom.

Cheers.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 17:33

Thanks for testing! :thumbup:
And for putting the final touch. I like the border all around.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 17:38

Me too :D
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Roman Clock

18 Jan 2018, 17:50

Hi wolf_II,
It works great for me with AHK_H U32 1.1.27.06 and AHK_L U32 1.1.27.06. 64-bit AHKs show a blank rectangle, probably due to my lib setup.
As a workaround I did added the following:

In Roman Clock.ahk:

Find:
Spoiler
Replace:
Spoiler
Find:
Spoiler
Replace:
Spoiler
My "Include" folder (the one below the main script, that is) now contains these files:

Code: Select all

01/18/2018  08:54 PM             1,457 Create.ahk
01/18/2018  09:53 PM             2,430 Events.ahk
01/18/2018  09:04 PM             1,930 Gdip.Helper.ahk
12/18/2017  06:29 PM           131,708 Gdip_All.ahk
01/18/2018  07:01 PM             1,946 INI.Handler.ahk
01/18/2018  09:57 PM             6,256 MainCode.ahk
It now works for me on Win7, 64-bit, AHK_L U32 or U64, AHK_H U32 or U64, version 1.1.27.06 for all.
The Gdip_All.ahk I used is attached.

Thanks very much for this script, I like it a lot!
regards,
burque505
Gdip_All.ahk
(128.62 KiB) Downloaded 97 times
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 17:53

@ burque505, I have renamed Gdip_All.ahk to Gdip.ahk and put it in my user lib, it works for both ahk 32 and 64.

Cheers.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Roman Clock

18 Jan 2018, 17:56

Cool, Helgef, thanks! Do you think that'll work for most scripts that ask for Gdip.ahk?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 18:02

I never had a problem which I fixed by using gdip.ahk instead. :thumbup:
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 18:04

@ burque505, I'm glad you like it! :D
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Roman Clock

18 Jan 2018, 18:05

:D It's in my startup folder now. And Helgef, thanks again for that Gdip tip.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Roman Clock

18 Jan 2018, 18:11

with the AHK version 1.1.27, it can be renamed to Scale()
Hehe, I remember that ;)
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Roman Clock

18 Jan 2018, 18:39

In Create.ahk, I changed

Code: Select all

;-------------------------------------------------------------------------------
GuiCreate: ; create the graphical user interface
;-------------------------------------------------------------------------------
    Gui, +hwndhClock -Caption
    hDC_Window := GetDC(hClock)
To:

Code: Select all

;-------------------------------------------------------------------------------
GuiCreate: ; create the graphical user interface
;-------------------------------------------------------------------------------
    Gui, +hwndhClock -Caption +ToolWindow
    hDC_Window := GetDC(hClock)
No taskbar icon this way, which I prefer.

Regards,
burque505
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Roman Clock

18 Jan 2018, 19:13

You could also try +Owner

+ToolWindow kills two birds at once: no taskbar button and no more Alt-Talbbing to reach the window.
+Owner removes only the taskbar button, which is my preference.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Roman Clock

18 Jan 2018, 21:33

wolf_II, that sounds better. I'll change it.
Thanks!

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: kunkel321 and 20 guests