(Side note: you may want to download the "Rondo" font)
Code: Select all
#SingleInstance, Force
#NoEnv
SetBatchLines, -1
#Include %A_ScriptDir%\Gdip.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 := 600
Height := 500
Gui, 1: +E0x80000 +LastFound
Gui, 1: Show
hwnd1 := WinExist()
hbm := CreateDIBSection(Width, Height)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
pBrush := Gdip_BrushCreateSolid(0xFFFF0000)
Gdip_FillRectangle(G, pBrush, 0, 0, 600, 500)
Gdip_DeleteBrush(pBrush)
pBrush := Gdip_BrushCreateSolid(0xFFFFFFFF)
Gdip_FillEllipse(G, pBrush, 5, 420, 75, 75)
Gdip_FillEllipse(G, pBrush, 520, 420, 75, 75)
Gdip_DeleteBrush(pBrush)
pBrush := Gdip_BrushCreateSolid(0xFFC4C4C4)
Gdip_FillRectangle(G, pBrush, 75, 75, 450, 350)
Gdip_DeleteBrush(pBrush)
Gdip_TextToGraphics(G, "AHK Sketch", "w450 h75 x80 y10 s40 Center", "Rondo")
UpdateLayeredWindow(hwnd1, hdc, A_ScreenWidth/4+Width/8, A_ScreenHeight/4, Width, Height)
MyPen := Gdip_CreatePen("0xFF000000", 5)
xPos := BackupX := 300
yPos := BackupY := 250
return
#If WinActive("ahk_id " hwnd1)
a::
d::
s::
w::
#If
dir := (A_ThisHotkey = "s" || A_ThisHotkey = "w") ? "x" : "y"
xdir := (A_ThisHotkey = "s" || A_ThisHotkey = "w") ? "y" : "x"
Backup%dir% := %dir%pos
%xdir%Pos += (A_ThisHotkey = "d" || A_ThisHotkey = "a") ? ((A_ThisHotkey = "d") ? (xPos > 520 ? 0 : 5) : (xPos < 80 ? 0 : -5)) : ((A_ThisHotkey = "s") ? (yPos > 420 ? 0 : 5) : (yPos < 80 ? 0 : -5))
Gdip_DrawLine(G, MyPen, BackupX, BackupY, XPos, YPos)
UpdateLayeredWindow(hwnd1, hdc, A_ScreenWidth/4+Width/8, A_ScreenHeight/4, Width, Height)
return
Esc::
Exit:
Gdip_Shutdown(pToken)
ExitApp
Return