diff --git a/MeseconEdit.ahk b/MeseconEdit.ahk index c5178ea..7c2d21c 100644 --- a/MeseconEdit.ahk +++ b/MeseconEdit.ahk @@ -1,6 +1,5 @@ #NoEnv -;wip: pass hDC to Node.Draw() ;wip: multiple simultaneous viewports with independent views ;wip: undo/redo ;wip: component count in status bar - nodes used in selection, in total, as well as info such as hovered node class and state @@ -110,6 +109,7 @@ class Nodes } FileNew: +Gui, Main:+OwnDialogs If FileModified { MsgBox, 35, Confirm, Save current schematic? @@ -128,6 +128,7 @@ ResizeWindow(Width,Height) Return FileOpen: +Gui, Main:+OwnDialogs If FileModified { MsgBox, 35, Confirm, Save current schematic? @@ -179,6 +180,7 @@ SetModified(False) Return FileSave: +Gui, Main:+OwnDialogs If (CurrentFile = "") { Gosub, FileSaveAs @@ -188,15 +190,13 @@ FileDelete, %CurrentFile% Value := FileVersion . "`n" . Viewport.X . " " . Viewport.Y . " " . Viewport.W . " " . Viewport.H . "`n" . Serialize(Grid) FileAppend, %Value%, %CurrentFile% If ErrorLevel -{ - Gui, Main:+OwnDialogs MsgBox, 16, Error, Could not save file as "%CurrentFile%". -} - -SetModified(False) +Else + SetModified(False) Return FileSaveAs: +Gui, Main:+OwnDialogs FileSelectFile, FileName, S48,, Save mesecon schematic, Mesecon Schematic (*.mesecon) If ErrorLevel Return @@ -206,10 +206,12 @@ Gosub, FileSave Return FileImport: +Gui, Main:+OwnDialogs ;wip Return FileExport: +Gui, Main:+OwnDialogs FileSelectFile, FileName, S48,, Save worldedit schematic, WorldEdit Schematic (*.we) If ErrorLevel Return @@ -242,9 +244,8 @@ Return AboutGuiEscape: AboutGuiClose: -Gui, About:Destroy Gui, Main:-Disabled -Gui, Main:Show +Gui, About:Destroy Return MainGuiClose: @@ -282,7 +283,7 @@ CurrentTool.Class.Select() Return Draw: -Draw(Grid,Width,Height,Viewport) +Draw(hDC,hMemoryDC,Grid,Width,Height,Viewport) Return SetModified(Value) @@ -499,9 +500,8 @@ UninitializeViewport(hWindow) throw Exception("Could not release window device context.") } -Draw(Grid,Width,Height,Viewport) +Draw(hDC,hMemoryDC,Grid,Width,Height,Viewport) { - global hDC, hMemoryDC static hPen := DllCall("CreatePen","Int",0,"Int",0,"UInt",0x888888,"UPtr") ;PS_SOLID ;clear the bitmap @@ -547,7 +547,7 @@ Draw(Grid,Width,Height,Viewport) Loop, % Ceil(Viewport.H) + 1 { If Grid[IndexX,IndexY1] - Grid[IndexX,IndexY1].Draw(BlockX,BlockY1,BlockW,BlockH) + Grid[IndexX,IndexY1].Draw(hMemoryDC,BlockX,BlockY1,BlockW,BlockH) IndexY1 ++, BlockY1 += BlockH } IndexX ++, BlockX += BlockW diff --git a/Nodes/Basis.ahk b/Nodes/Basis.ahk index 744f0e1..ca682c4 100644 --- a/Nodes/Basis.ahk +++ b/Nodes/Basis.ahk @@ -10,7 +10,7 @@ class Basis } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { } diff --git a/Nodes/Blinky Plant.ahk b/Nodes/Blinky Plant.ahk index 62cf83f..02ae6b5 100644 --- a/Nodes/Blinky Plant.ahk +++ b/Nodes/Blinky Plant.ahk @@ -35,18 +35,17 @@ class BlinkyPlant extends Nodes.Power this.base.BlinkyPlantArray.Remove(&this,"") } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC hBrush := this.State ? this.base.hOnBrush : this.base.hOffBrush - hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen - hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hBrush,"UPtr") ;select the brush + hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen + hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",hBrush,"UPtr") ;select the brush ;draw the power plant - DllCall("Ellipse","UPtr",hMemoryDC,"Int",Round(X + (W * 0.1)),"Int",Round(Y + (H * 0.1)),"Int",Round(X + (W * 0.9)),"Int",Round(Y + (H * 0.9))) + DllCall("Ellipse","UPtr",hDC,"Int",Round(X + (W * 0.1)),"Int",Round(Y + (H * 0.1)),"Int",Round(X + (W * 0.9)),"Int",Round(Y + (H * 0.9))) - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush } } \ No newline at end of file diff --git a/Nodes/Inverter.ahk b/Nodes/Inverter.ahk index 0352d59..560f087 100644 --- a/Nodes/Inverter.ahk +++ b/Nodes/Inverter.ahk @@ -28,12 +28,10 @@ class Inverter extends Nodes.Power base.__New(IndexX,IndexY) } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC - - hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen - hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush + hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen + hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush Vertices := 3 VarSetCapacity(Points,8 * Vertices) @@ -42,27 +40,27 @@ class Inverter extends Nodes.Power NumPut(Round(X),Points,0,"Int"), NumPut(Round(Y + (H * 0.3)),Points,4,"Int") NumPut(Round(X),Points,8,"Int"), NumPut(Round(Y + (H * 0.7)),Points,12,"Int") NumPut(Round(X + (W * 0.3)),Points,16,"Int"), NumPut(Round(Y + (H * 0.5)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw right arrow NumPut(Round(X + W),Points,0,"Int") NumPut(Round(X + W),Points,8,"Int") NumPut(Round(X + (W * 0.7)),Points,16,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw top arrow NumPut(Round(X + (W * 0.3)),Points,0,"Int"), NumPut(Round(Y),Points,4,"Int") NumPut(Round(X + (W * 0.7)),Points,8,"Int"), NumPut(Round(Y),Points,12,"Int") NumPut(Round(X + (W * 0.5)),Points,16,"Int"), NumPut(Round(Y + (H * 0.3)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw bottom arrow NumPut(Round(Y + H),Points,4,"Int") NumPut(Round(Y + H),Points,12,"Int") NumPut(Round(Y + (H * 0.7)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush } } \ No newline at end of file diff --git a/Nodes/Mesecon.ahk b/Nodes/Mesecon.ahk index dfb9180..e38df3f 100644 --- a/Nodes/Mesecon.ahk +++ b/Nodes/Mesecon.ahk @@ -141,9 +141,9 @@ class Mesecon extends Nodes.Basis Bottom.ModifyState(Amount,OpenList) } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC, Grid + global Grid ;obtain neighbor nodes Left := Grid[this.IndexX - 1,this.IndexY], Left := Left.Send || Left.Receive @@ -165,19 +165,19 @@ class Mesecon extends Nodes.Basis NumPut(Round(X + W),Rectangle,8,"Int") Else NumPut(Round(X + (W * 0.6)),Rectangle,8,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",hBrush) } Else If Right ;right but not left neighbor { NumPut(Round(X + (W * 0.4)),Rectangle,0,"Int") NumPut(Round(X + W),Rectangle,8,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",hBrush) } Else If !(Top || Bottom) ;no neighbors { NumPut(Round(X + (W * 0.4)),Rectangle,0,"Int") NumPut(Round(X + (W * 0.6)),Rectangle,8,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",hBrush) } ;draw vertical bar @@ -190,13 +190,13 @@ class Mesecon extends Nodes.Basis NumPut(Round(Y + H),Rectangle,12,"Int") Else NumPut(Round(Y + (H * 0.6)),Rectangle,12,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",hBrush) } Else If Bottom { NumPut(Round(Y + (H * 0.4)),Rectangle,12,"Int") NumPut(Round(Y + H),Rectangle,12,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",hBrush) } } } \ No newline at end of file diff --git a/Nodes/Meselamp.ahk b/Nodes/Meselamp.ahk index ef619f6..2c1cac8 100644 --- a/Nodes/Meselamp.ahk +++ b/Nodes/Meselamp.ahk @@ -5,9 +5,8 @@ class Meselamp extends Nodes.Load static hOffBrush := DllCall("CreateSolidBrush","UInt",0x777777,"UPtr") static hOnBrush := DllCall("CreateSolidBrush","UInt",0xFFFFFF,"UPtr") - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC hBrush := this.State ? this.base.hOnBrush : this.base.hOffBrush ;select the brush VarSetCapacity(Rectangle,16) @@ -17,6 +16,6 @@ class Meselamp extends Nodes.Load NumPut(Round(Y + (H * 0.3)),Rectangle,4,"Int") NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int") NumPut(Round(Y + (H * 0.7)),Rectangle,12,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",hBrush) } } \ No newline at end of file diff --git a/Nodes/Plug.ahk b/Nodes/Plug.ahk index 881475c..d0899e5 100644 --- a/Nodes/Plug.ahk +++ b/Nodes/Plug.ahk @@ -56,11 +56,10 @@ class Plug extends Nodes.Load } } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC - hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen - hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush + hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen + hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush Vertices := 3 VarSetCapacity(Points,8 * Vertices) @@ -69,27 +68,27 @@ class Plug extends Nodes.Load NumPut(Round(X),Points,0,"Int"), NumPut(Round(Y + (H * 0.5)),Points,4,"Int") NumPut(Round(X + (W * 0.3)),Points,8,"Int"), NumPut(Round(Y + (H * 0.3)),Points,12,"Int") NumPut(Round(X + (W * 0.3)),Points,16,"Int"), NumPut(Round(Y + (H * 0.7)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw right arrow NumPut(Round(X + W),Points,0,"Int") NumPut(Round(X + (W * 0.7)),Points,8,"Int") NumPut(Round(X + (W * 0.7)),Points,16,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw top arrow NumPut(Round(X + (W * 0.5)),Points,0,"Int"), NumPut(Round(Y),Points,4,"Int") NumPut(Round(X + (W * 0.3)),Points,8,"Int"), NumPut(Round(Y + (H * 0.3)),Points,12,"Int") NumPut(Round(X + (W * 0.7)),Points,16,"Int"), NumPut(Round(Y + (H * 0.3)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw bottom arrow NumPut(Round(Y + H),Points,4,"Int") NumPut(Round(Y + (H * 0.7)),Points,12,"Int") NumPut(Round(Y + (H * 0.7)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush } } \ No newline at end of file diff --git a/Nodes/Power Plant.ahk b/Nodes/Power Plant.ahk index 8563b84..484c02c 100644 --- a/Nodes/Power Plant.ahk +++ b/Nodes/Power Plant.ahk @@ -11,17 +11,16 @@ class PowerPlant extends Nodes.Power base.__New(IndexX,IndexY) } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC - hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen - hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush + hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen + hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush ;draw the power plant - DllCall("Ellipse","UPtr",hMemoryDC,"Int",Round(X + (W * 0.1)),"Int",Round(Y + (H * 0.1)),"Int",Round(X + (W * 0.9)),"Int",Round(Y + (H * 0.9))) + DllCall("Ellipse","UPtr",hDC,"Int",Round(X + (W * 0.1)),"Int",Round(Y + (H * 0.1)),"Int",Round(X + (W * 0.9)),"Int",Round(Y + (H * 0.9))) - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush } Serialize() diff --git a/Nodes/Sign.ahk b/Nodes/Sign.ahk index c81d105..d01e8ee 100644 --- a/Nodes/Sign.ahk +++ b/Nodes/Sign.ahk @@ -37,9 +37,8 @@ class Sign extends Nodes.Basis Return } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC static hFont := 0, PreviousH := -1 VarSetCapacity(Rectangle,16) @@ -49,7 +48,7 @@ class Sign extends Nodes.Basis NumPut(Round(Y + (H * 0.2)),Rectangle,4,"Int") NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int") NumPut(Round(Y + (H * 0.7)),Rectangle,12,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",this.base.hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",this.base.hBrush) ;set up text properties If (H != PreviousH) @@ -73,20 +72,20 @@ class Sign extends Nodes.Basis ,"Str","Arial" ;typeface name ,"UPtr") } - DllCall("SetTextColor","UPtr",hMemoryDC,"UInt",0xFFFFFF) - DllCall("SetBkMode","UPtr",hMemoryDC,"Int",1) ;TRANSPARENT - DllCall("SetTextAlign","UPtr",hMemoryDC,"UInt",6) ;TA_CENTER | TA_TOP: align text to the center and the top + DllCall("SetTextColor","UPtr",hDC,"UInt",0xFFFFFF) + DllCall("SetBkMode","UPtr",hDC,"Int",1) ;TRANSPARENT + DllCall("SetTextAlign","UPtr",hDC,"UInt",6) ;TA_CENTER | TA_TOP: align text to the center and the top ;draw text - hOriginalFont := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hFont,"UPtr") + hOriginalFont := DllCall("SelectObject","UPtr",hDC,"UPtr",hFont,"UPtr") PositionX := X + (W * 0.5), PositionY := Y + (H * 0.25) Text := this.Text Loop, Parse, Text, `n { - DllCall("TextOut","UPtr",hMemoryDC,"Int",Round(PositionX),"Int",Round(PositionY),"Str",A_LoopField,"Int",StrLen(A_LoopField)) + DllCall("TextOut","UPtr",hDC,"Int",Round(PositionX),"Int",Round(PositionY),"Str",A_LoopField,"Int",StrLen(A_LoopField)) PositionY += H * 0.2 } - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalFont,"UPtr") + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalFont,"UPtr") } Serialize() diff --git a/Nodes/Socket.ahk b/Nodes/Socket.ahk index 1fb9031..fd915f0 100644 --- a/Nodes/Socket.ahk +++ b/Nodes/Socket.ahk @@ -28,12 +28,10 @@ class Socket extends Nodes.Power base.__New(IndexX,IndexY) } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC - - hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen - hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush + hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen + hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush Vertices := 3 VarSetCapacity(Points,8 * Vertices) @@ -42,27 +40,27 @@ class Socket extends Nodes.Power NumPut(Round(X),Points,0,"Int"), NumPut(Round(Y + (H * 0.3)),Points,4,"Int") NumPut(Round(X),Points,8,"Int"), NumPut(Round(Y + (H * 0.7)),Points,12,"Int") NumPut(Round(X + (W * 0.3)),Points,16,"Int"), NumPut(Round(Y + (H * 0.5)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw right arrow NumPut(Round(X + W),Points,0,"Int") NumPut(Round(X + W),Points,8,"Int") NumPut(Round(X + (W * 0.7)),Points,16,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw top arrow NumPut(Round(X + (W * 0.3)),Points,0,"Int"), NumPut(Round(Y),Points,4,"Int") NumPut(Round(X + (W * 0.7)),Points,8,"Int"), NumPut(Round(Y),Points,12,"Int") NumPut(Round(X + (W * 0.5)),Points,16,"Int"), NumPut(Round(Y + (H * 0.3)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) ;draw bottom arrow NumPut(Round(Y + H),Points,4,"Int") NumPut(Round(Y + H),Points,12,"Int") NumPut(Round(Y + (H * 0.7)),Points,20,"Int") - DllCall("Polygon","UPtr",hMemoryDC,"UPtr",&Points,"Int",Vertices) + DllCall("Polygon","UPtr",hDC,"UPtr",&Points,"Int",Vertices) - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen - DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen + DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush } } \ No newline at end of file diff --git a/Nodes/Solid.ahk b/Nodes/Solid.ahk index 6e91abb..6b13086 100644 --- a/Nodes/Solid.ahk +++ b/Nodes/Solid.ahk @@ -8,10 +8,8 @@ class Solid extends Nodes.Basis this.Receive := False } - Draw(X,Y,W,H) + Draw(hDC,X,Y,W,H) { - global hMemoryDC - VarSetCapacity(Rectangle,16) ;draw rectangle @@ -19,7 +17,7 @@ class Solid extends Nodes.Basis NumPut(Round(Y + (H * 0.1)),Rectangle,4,"Int") NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int") NumPut(Round(Y + (H * 0.9)),Rectangle,12,"Int") - DllCall("FillRect","UPtr",hMemoryDC,"UPtr",&Rectangle,"UPtr",this.base.hBrush) + DllCall("FillRect","UPtr",hDC,"UPtr",&Rectangle,"UPtr",this.base.hBrush) } Serialize()