Properly have main window own all dialogs, pass hDC to Node.Draw().
parent
b0e4485119
commit
c20f83768d
|
@ -1,6 +1,5 @@
|
||||||
#NoEnv
|
#NoEnv
|
||||||
|
|
||||||
;wip: pass hDC to Node.Draw()
|
|
||||||
;wip: multiple simultaneous viewports with independent views
|
;wip: multiple simultaneous viewports with independent views
|
||||||
;wip: undo/redo
|
;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
|
;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:
|
FileNew:
|
||||||
|
Gui, Main:+OwnDialogs
|
||||||
If FileModified
|
If FileModified
|
||||||
{
|
{
|
||||||
MsgBox, 35, Confirm, Save current schematic?
|
MsgBox, 35, Confirm, Save current schematic?
|
||||||
|
@ -128,6 +128,7 @@ ResizeWindow(Width,Height)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
FileOpen:
|
FileOpen:
|
||||||
|
Gui, Main:+OwnDialogs
|
||||||
If FileModified
|
If FileModified
|
||||||
{
|
{
|
||||||
MsgBox, 35, Confirm, Save current schematic?
|
MsgBox, 35, Confirm, Save current schematic?
|
||||||
|
@ -179,6 +180,7 @@ SetModified(False)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
FileSave:
|
FileSave:
|
||||||
|
Gui, Main:+OwnDialogs
|
||||||
If (CurrentFile = "<Untitled>")
|
If (CurrentFile = "<Untitled>")
|
||||||
{
|
{
|
||||||
Gosub, FileSaveAs
|
Gosub, FileSaveAs
|
||||||
|
@ -188,15 +190,13 @@ FileDelete, %CurrentFile%
|
||||||
Value := FileVersion . "`n" . Viewport.X . " " . Viewport.Y . " " . Viewport.W . " " . Viewport.H . "`n" . Serialize(Grid)
|
Value := FileVersion . "`n" . Viewport.X . " " . Viewport.Y . " " . Viewport.W . " " . Viewport.H . "`n" . Serialize(Grid)
|
||||||
FileAppend, %Value%, %CurrentFile%
|
FileAppend, %Value%, %CurrentFile%
|
||||||
If ErrorLevel
|
If ErrorLevel
|
||||||
{
|
|
||||||
Gui, Main:+OwnDialogs
|
|
||||||
MsgBox, 16, Error, Could not save file as "%CurrentFile%".
|
MsgBox, 16, Error, Could not save file as "%CurrentFile%".
|
||||||
}
|
Else
|
||||||
|
SetModified(False)
|
||||||
SetModified(False)
|
|
||||||
Return
|
Return
|
||||||
|
|
||||||
FileSaveAs:
|
FileSaveAs:
|
||||||
|
Gui, Main:+OwnDialogs
|
||||||
FileSelectFile, FileName, S48,, Save mesecon schematic, Mesecon Schematic (*.mesecon)
|
FileSelectFile, FileName, S48,, Save mesecon schematic, Mesecon Schematic (*.mesecon)
|
||||||
If ErrorLevel
|
If ErrorLevel
|
||||||
Return
|
Return
|
||||||
|
@ -206,10 +206,12 @@ Gosub, FileSave
|
||||||
Return
|
Return
|
||||||
|
|
||||||
FileImport:
|
FileImport:
|
||||||
|
Gui, Main:+OwnDialogs
|
||||||
;wip
|
;wip
|
||||||
Return
|
Return
|
||||||
|
|
||||||
FileExport:
|
FileExport:
|
||||||
|
Gui, Main:+OwnDialogs
|
||||||
FileSelectFile, FileName, S48,, Save worldedit schematic, WorldEdit Schematic (*.we)
|
FileSelectFile, FileName, S48,, Save worldedit schematic, WorldEdit Schematic (*.we)
|
||||||
If ErrorLevel
|
If ErrorLevel
|
||||||
Return
|
Return
|
||||||
|
@ -242,9 +244,8 @@ Return
|
||||||
|
|
||||||
AboutGuiEscape:
|
AboutGuiEscape:
|
||||||
AboutGuiClose:
|
AboutGuiClose:
|
||||||
Gui, About:Destroy
|
|
||||||
Gui, Main:-Disabled
|
Gui, Main:-Disabled
|
||||||
Gui, Main:Show
|
Gui, About:Destroy
|
||||||
Return
|
Return
|
||||||
|
|
||||||
MainGuiClose:
|
MainGuiClose:
|
||||||
|
@ -282,7 +283,7 @@ CurrentTool.Class.Select()
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Draw:
|
Draw:
|
||||||
Draw(Grid,Width,Height,Viewport)
|
Draw(hDC,hMemoryDC,Grid,Width,Height,Viewport)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
SetModified(Value)
|
SetModified(Value)
|
||||||
|
@ -499,9 +500,8 @@ UninitializeViewport(hWindow)
|
||||||
throw Exception("Could not release window device context.")
|
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
|
static hPen := DllCall("CreatePen","Int",0,"Int",0,"UInt",0x888888,"UPtr") ;PS_SOLID
|
||||||
|
|
||||||
;clear the bitmap
|
;clear the bitmap
|
||||||
|
@ -547,7 +547,7 @@ Draw(Grid,Width,Height,Viewport)
|
||||||
Loop, % Ceil(Viewport.H) + 1
|
Loop, % Ceil(Viewport.H) + 1
|
||||||
{
|
{
|
||||||
If Grid[IndexX,IndexY1]
|
If Grid[IndexX,IndexY1]
|
||||||
Grid[IndexX,IndexY1].Draw(BlockX,BlockY1,BlockW,BlockH)
|
Grid[IndexX,IndexY1].Draw(hMemoryDC,BlockX,BlockY1,BlockW,BlockH)
|
||||||
IndexY1 ++, BlockY1 += BlockH
|
IndexY1 ++, BlockY1 += BlockH
|
||||||
}
|
}
|
||||||
IndexX ++, BlockX += BlockW
|
IndexX ++, BlockX += BlockW
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Basis
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,18 +35,17 @@ class BlinkyPlant extends Nodes.Power
|
||||||
this.base.BlinkyPlantArray.Remove(&this,"")
|
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
|
hBrush := this.State ? this.base.hOnBrush : this.base.hOffBrush
|
||||||
|
|
||||||
hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen
|
hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen
|
||||||
hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hBrush,"UPtr") ;select the brush
|
hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",hBrush,"UPtr") ;select the brush
|
||||||
|
|
||||||
;draw the power plant
|
;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",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen
|
||||||
DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,12 +28,10 @@ class Inverter extends Nodes.Power
|
||||||
base.__New(IndexX,IndexY)
|
base.__New(IndexX,IndexY)
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
global hMemoryDC
|
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
|
||||||
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
|
|
||||||
|
|
||||||
Vertices := 3
|
Vertices := 3
|
||||||
VarSetCapacity(Points,8 * Vertices)
|
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,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),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")
|
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
|
;draw right arrow
|
||||||
NumPut(Round(X + W),Points,0,"Int")
|
NumPut(Round(X + W),Points,0,"Int")
|
||||||
NumPut(Round(X + W),Points,8,"Int")
|
NumPut(Round(X + W),Points,8,"Int")
|
||||||
NumPut(Round(X + (W * 0.7)),Points,16,"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
|
;draw top arrow
|
||||||
NumPut(Round(X + (W * 0.3)),Points,0,"Int"), NumPut(Round(Y),Points,4,"Int")
|
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.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")
|
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
|
;draw bottom arrow
|
||||||
NumPut(Round(Y + H),Points,4,"Int")
|
NumPut(Round(Y + H),Points,4,"Int")
|
||||||
NumPut(Round(Y + H),Points,12,"Int")
|
NumPut(Round(Y + H),Points,12,"Int")
|
||||||
NumPut(Round(Y + (H * 0.7)),Points,20,"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",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen
|
||||||
DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -141,9 +141,9 @@ class Mesecon extends Nodes.Basis
|
||||||
Bottom.ModifyState(Amount,OpenList)
|
Bottom.ModifyState(Amount,OpenList)
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
global hMemoryDC, Grid
|
global Grid
|
||||||
|
|
||||||
;obtain neighbor nodes
|
;obtain neighbor nodes
|
||||||
Left := Grid[this.IndexX - 1,this.IndexY], Left := Left.Send || Left.Receive
|
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")
|
NumPut(Round(X + W),Rectangle,8,"Int")
|
||||||
Else
|
Else
|
||||||
NumPut(Round(X + (W * 0.6)),Rectangle,8,"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)
|
||||||
}
|
}
|
||||||
Else If Right ;right but not left neighbor
|
Else If Right ;right but not left neighbor
|
||||||
{
|
{
|
||||||
NumPut(Round(X + (W * 0.4)),Rectangle,0,"Int")
|
NumPut(Round(X + (W * 0.4)),Rectangle,0,"Int")
|
||||||
NumPut(Round(X + W),Rectangle,8,"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
|
Else If !(Top || Bottom) ;no neighbors
|
||||||
{
|
{
|
||||||
NumPut(Round(X + (W * 0.4)),Rectangle,0,"Int")
|
NumPut(Round(X + (W * 0.4)),Rectangle,0,"Int")
|
||||||
NumPut(Round(X + (W * 0.6)),Rectangle,8,"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
|
;draw vertical bar
|
||||||
|
@ -190,13 +190,13 @@ class Mesecon extends Nodes.Basis
|
||||||
NumPut(Round(Y + H),Rectangle,12,"Int")
|
NumPut(Round(Y + H),Rectangle,12,"Int")
|
||||||
Else
|
Else
|
||||||
NumPut(Round(Y + (H * 0.6)),Rectangle,12,"Int")
|
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
|
Else If Bottom
|
||||||
{
|
{
|
||||||
NumPut(Round(Y + (H * 0.4)),Rectangle,12,"Int")
|
NumPut(Round(Y + (H * 0.4)),Rectangle,12,"Int")
|
||||||
NumPut(Round(Y + H),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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,9 +5,8 @@ class Meselamp extends Nodes.Load
|
||||||
static hOffBrush := DllCall("CreateSolidBrush","UInt",0x777777,"UPtr")
|
static hOffBrush := DllCall("CreateSolidBrush","UInt",0x777777,"UPtr")
|
||||||
static hOnBrush := DllCall("CreateSolidBrush","UInt",0xFFFFFF,"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
|
hBrush := this.State ? this.base.hOnBrush : this.base.hOffBrush ;select the brush
|
||||||
|
|
||||||
VarSetCapacity(Rectangle,16)
|
VarSetCapacity(Rectangle,16)
|
||||||
|
@ -17,6 +16,6 @@ class Meselamp extends Nodes.Load
|
||||||
NumPut(Round(Y + (H * 0.3)),Rectangle,4,"Int")
|
NumPut(Round(Y + (H * 0.3)),Rectangle,4,"Int")
|
||||||
NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int")
|
NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int")
|
||||||
NumPut(Round(Y + (H * 0.7)),Rectangle,12,"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)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen
|
||||||
hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen
|
hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush
|
||||||
hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush
|
|
||||||
|
|
||||||
Vertices := 3
|
Vertices := 3
|
||||||
VarSetCapacity(Points,8 * Vertices)
|
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),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,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")
|
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
|
;draw right arrow
|
||||||
NumPut(Round(X + W),Points,0,"Int")
|
NumPut(Round(X + W),Points,0,"Int")
|
||||||
NumPut(Round(X + (W * 0.7)),Points,8,"Int")
|
NumPut(Round(X + (W * 0.7)),Points,8,"Int")
|
||||||
NumPut(Round(X + (W * 0.7)),Points,16,"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
|
;draw top arrow
|
||||||
NumPut(Round(X + (W * 0.5)),Points,0,"Int"), NumPut(Round(Y),Points,4,"Int")
|
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.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")
|
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
|
;draw bottom arrow
|
||||||
NumPut(Round(Y + H),Points,4,"Int")
|
NumPut(Round(Y + H),Points,4,"Int")
|
||||||
NumPut(Round(Y + (H * 0.7)),Points,12,"Int")
|
NumPut(Round(Y + (H * 0.7)),Points,12,"Int")
|
||||||
NumPut(Round(Y + (H * 0.7)),Points,20,"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",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen
|
||||||
DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,17 +11,16 @@ class PowerPlant extends Nodes.Power
|
||||||
base.__New(IndexX,IndexY)
|
base.__New(IndexX,IndexY)
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
global hMemoryDC
|
hOriginalPen := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hPen,"UPtr") ;select the pen
|
||||||
hOriginalPen := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hPen,"UPtr") ;select the pen
|
hOriginalBrush := DllCall("SelectObject","UPtr",hDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush
|
||||||
hOriginalBrush := DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",this.base.hBrush,"UPtr") ;select the brush
|
|
||||||
|
|
||||||
;draw the power plant
|
;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",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen
|
||||||
DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
||||||
}
|
}
|
||||||
|
|
||||||
Serialize()
|
Serialize()
|
||||||
|
|
|
@ -37,9 +37,8 @@ class Sign extends Nodes.Basis
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
global hMemoryDC
|
|
||||||
static hFont := 0, PreviousH := -1
|
static hFont := 0, PreviousH := -1
|
||||||
|
|
||||||
VarSetCapacity(Rectangle,16)
|
VarSetCapacity(Rectangle,16)
|
||||||
|
@ -49,7 +48,7 @@ class Sign extends Nodes.Basis
|
||||||
NumPut(Round(Y + (H * 0.2)),Rectangle,4,"Int")
|
NumPut(Round(Y + (H * 0.2)),Rectangle,4,"Int")
|
||||||
NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int")
|
NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int")
|
||||||
NumPut(Round(Y + (H * 0.7)),Rectangle,12,"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
|
;set up text properties
|
||||||
If (H != PreviousH)
|
If (H != PreviousH)
|
||||||
|
@ -73,20 +72,20 @@ class Sign extends Nodes.Basis
|
||||||
,"Str","Arial" ;typeface name
|
,"Str","Arial" ;typeface name
|
||||||
,"UPtr")
|
,"UPtr")
|
||||||
}
|
}
|
||||||
DllCall("SetTextColor","UPtr",hMemoryDC,"UInt",0xFFFFFF)
|
DllCall("SetTextColor","UPtr",hDC,"UInt",0xFFFFFF)
|
||||||
DllCall("SetBkMode","UPtr",hMemoryDC,"Int",1) ;TRANSPARENT
|
DllCall("SetBkMode","UPtr",hDC,"Int",1) ;TRANSPARENT
|
||||||
DllCall("SetTextAlign","UPtr",hMemoryDC,"UInt",6) ;TA_CENTER | TA_TOP: align text to the center and the top
|
DllCall("SetTextAlign","UPtr",hDC,"UInt",6) ;TA_CENTER | TA_TOP: align text to the center and the top
|
||||||
|
|
||||||
;draw text
|
;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)
|
PositionX := X + (W * 0.5), PositionY := Y + (H * 0.25)
|
||||||
Text := this.Text
|
Text := this.Text
|
||||||
Loop, Parse, Text, `n
|
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
|
PositionY += H * 0.2
|
||||||
}
|
}
|
||||||
DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalFont,"UPtr")
|
DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalFont,"UPtr")
|
||||||
}
|
}
|
||||||
|
|
||||||
Serialize()
|
Serialize()
|
||||||
|
|
|
@ -28,12 +28,10 @@ class Socket extends Nodes.Power
|
||||||
base.__New(IndexX,IndexY)
|
base.__New(IndexX,IndexY)
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
global hMemoryDC
|
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
|
||||||
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
|
|
||||||
|
|
||||||
Vertices := 3
|
Vertices := 3
|
||||||
VarSetCapacity(Points,8 * Vertices)
|
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,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),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")
|
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
|
;draw right arrow
|
||||||
NumPut(Round(X + W),Points,0,"Int")
|
NumPut(Round(X + W),Points,0,"Int")
|
||||||
NumPut(Round(X + W),Points,8,"Int")
|
NumPut(Round(X + W),Points,8,"Int")
|
||||||
NumPut(Round(X + (W * 0.7)),Points,16,"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
|
;draw top arrow
|
||||||
NumPut(Round(X + (W * 0.3)),Points,0,"Int"), NumPut(Round(Y),Points,4,"Int")
|
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.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")
|
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
|
;draw bottom arrow
|
||||||
NumPut(Round(Y + H),Points,4,"Int")
|
NumPut(Round(Y + H),Points,4,"Int")
|
||||||
NumPut(Round(Y + H),Points,12,"Int")
|
NumPut(Round(Y + H),Points,12,"Int")
|
||||||
NumPut(Round(Y + (H * 0.7)),Points,20,"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",hDC,"UPtr",hOriginalPen,"UPtr") ;deselect the pen
|
||||||
DllCall("SelectObject","UPtr",hMemoryDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
DllCall("SelectObject","UPtr",hDC,"UPtr",hOriginalBrush,"UPtr") ;deselect the brush
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,8 @@ class Solid extends Nodes.Basis
|
||||||
this.Receive := False
|
this.Receive := False
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(X,Y,W,H)
|
Draw(hDC,X,Y,W,H)
|
||||||
{
|
{
|
||||||
global hMemoryDC
|
|
||||||
|
|
||||||
VarSetCapacity(Rectangle,16)
|
VarSetCapacity(Rectangle,16)
|
||||||
|
|
||||||
;draw rectangle
|
;draw rectangle
|
||||||
|
@ -19,7 +17,7 @@ class Solid extends Nodes.Basis
|
||||||
NumPut(Round(Y + (H * 0.1)),Rectangle,4,"Int")
|
NumPut(Round(Y + (H * 0.1)),Rectangle,4,"Int")
|
||||||
NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int")
|
NumPut(Round(X + (W * 0.9)),Rectangle,8,"Int")
|
||||||
NumPut(Round(Y + (H * 0.9)),Rectangle,12,"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()
|
Serialize()
|
||||||
|
|
Loading…
Reference in New Issue