Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance, Force
- #NoEnv
- SetBatchLines, -1
- #Include Resources\Gdip_All.ahk
- #Include Resources\Gdip_Ext.ahk
- If !pToken := Gdip_Startup()
- {
- MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
- ExitApp
- }
- OnExit, Exit
- Width:=800, height:=800
- Gui,1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
- Gui, 1: Add, Edit, w%Width% h20 y300, vMeEdit
- Gui,1: Show, NA
- hwnd1 := WinExist()
- hbm := CreateDIBSection(Width, Height)
- hdc := CreateCompatibleDC()
- obm := SelectObject(hdc, hbm)
- G := Gdip_GraphicsFromHDC(hdc)
- Gdip_SetSmoothingMode(G, 4)
- pBrush := Gdip_BrushCreateSolid(0x00000000)
- Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 0)
- Gdip_DeleteBrush(pBrush)
- ;--- CHANGING VARIABLES
- FontName = Gotham
- Fontsize2 := 17
- Fontsize .= "s"+Fontsize2
- cName :="Nosta"
- cGuild := "<Gobelins>"
- charRace := "Briton"
- charClass := "Friar"
- charLevel := "Lvl 50"
- charRanklevel := "R1L7"
- FontSizes := [Fontsize2]
- ; Measure text width
- For Each, Size in FontSizes {
- T := MeasureText(charRace, "s" . Size, FontName)
- XW1 := T.W
- }
- For Each, Size in FontSizes {
- T := MeasureText(charClass, "s" . Size, FontName)
- XW2 := T.W
- }
- For Each, Size in FontSizes {
- T := MeasureText(charLevel, "s" . Size, FontName)
- XW3 := T.W
- }
- For Each, Size in FontSizes {
- T := MeasureText(charRankLevel, "s" . Size, FontName)
- XW4 := T.W
- }
- if (FontName = "Tahoma")
- {
- xwI := 1.3
- }
- else if (FontName = "Verdana")
- {
- x1 := Fontsize2*1.85
- xwI := 1.5
- }
- else if ((FontName = "Arial") or (FontName = "Trebuchet MS") or (FontName = "Ubuntu Mono"))
- {
- xwI := 1.6
- }
- else if ((FontName = "Segoe UI") or (FontName = "Bariol") or (FontName = "Montserrat"))
- {
- xwI := 1.9
- }
- else if ((FontName = "Noto Sans UI") or (FontName = "Overpass"))
- {
- xwI := 2.2
- }
- else if (FontName = "Gotham")
- {
- xwI := 2.9
- }
- else
- {
- xwI := 100.5
- }
- XW1_1 := (XW1/2)-(0.5*Fontsize2)
- if (XW1 > XW2)
- XW2_2 := (FontSize2/xwI)+(((XW2/2)+(0.5*Fontsize2))-((XW2+XW1)*0.1008))
- else if (XW1 <= XW2)
- XW2_2 := (FontSize2/xwI)+((XW2/2)+(0.5*Fontsize2)-((XW2+XW1)*0.1008))
- XW3_1 := (XW3/2)-(0.5*Fontsize2)
- if (XW3 > XW4)
- XW4_2 := (FontSize2/xwI)+(((XW4/2)+(0.5*Fontsize2))-((XW4+XW3)*0.1008))
- else if (XW3 <= XW4)
- XW4_2 := (FontSize2/xwI)+((XW4/2)+(0.5*Fontsize2)-((XW4+XW3)*0.1008))
- X1_0 := ((XWI/2)-(0.5*Fontsize2))
- y:=0
- Options = x%X1_0% y%y% w90p Center Bold cFFff0000 ow1 ocFF000000 r4 %Fontsize%
- Gdip_TextToGraphics2(G, cName, Options , FontName, Width, Height)
- y:=Fontsize2
- Options = x%X1_0% y%y% w90p Center cFFd60000 ow1 ocFF000000 r4 %Fontsize%
- Gdip_TextToGraphics2(G, cGuild, Options , FontName, Width, Height)
- y:=Fontsize2*2
- Options = x-%XW4_2% y%y% w90p Center cFFd60000 ow1 ocFF000000 r4 %Fontsize%
- Gdip_TextToGraphics2(G,charLevel, Options , FontName, Width, Height)
- Options = x%XW3_1% y%y% w90p Center Bold cFFff0000 ow1 ocFF000000 r4 %Fontsize%
- Gdip_TextToGraphics2(G,charRankLevel, Options , FontName, Width, Height)
- y:=Fontsize2*3
- Options = x-%XW2_2% y%y% w90p Center cFFd60000 ow1 ocFF000000 r4 %Fontsize%
- Gdip_TextToGraphics2(G,charRace, Options , FontName, Width, Height)
- Options = x%XW1_1% y%y% w90p Center Bold cFFff0000 ow1 ocFF000000 r4 %Fontsize%
- Gdip_TextToGraphics2(G,charClass, Options , FontName, Width, Height)
- UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth-Width)//2, (A_ScreenHeight-Height)//2, Width, Height)
- OnMessage(0x201, "WM_LBUTTONDOWN")
- ; Select the object back into the hdc
- SelectObject(hdc, obm)
- ; Now the bitmap may be deleted
- DeleteObject(hbm)
- ; Also the device context related to the bitmap may be deleted
- DeleteDC(hdc)
- ; The graphics may now be deleted
- Gdip_DeleteGraphics(G)
- WM_LBUTTONDOWN()
- {
- PostMessage, 0xA1, 2
- }
- Return
- MeasureText(Str, FontOpts = "", FontName = "") {
- Static DT_FLAGS := 0x0520 ; DT_SINGLELINE = 0x20, DT_NOCLIP = 0x0100, DT_CALCRECT = 0x0400
- Static WM_GETFONT := 0x31
- Size := {}
- Gui, New
- If (FontOpts <> "") || (FontName <> "")
- Gui, Font, %FontOpts%, %FontName%
- Gui, Add, Text, hwndHWND
- SendMessage, WM_GETFONT, 0, 0, , ahk_id %HWND%
- HFONT := ErrorLevel
- HDC := DllCall("User32.dll\GetDC", "Ptr", HWND, "Ptr")
- DllCall("Gdi32.dll\SelectObject", "Ptr", HDC, "Ptr", HFONT)
- VarSetCapacity(RECT, 16, 0)
- DllCall("User32.dll\DrawText", "Ptr", HDC, "Str", Str, "Int", -1, "Ptr", &RECT, "UInt", DT_FLAGS)
- DllCall("User32.dll\ReleaseDC", "Ptr", HWND, "Ptr", HDC)
- Gui, Destroy
- Size.W := NumGet(RECT, 8, "Int")
- Size.H := NumGet(RECT, 12, "Int")
- Return Size, W
- }
- ;#######################################################################
- Exit:
- ExitApp
- Return
- Esc::
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement