-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Description
This opens two windows which can be used as drawing canvas independently:
(@v1.7) pkg> add https://github.com/oheil/Luxor.jl#multi_drawing
using MiniFB, Luxor, Colors
WIDTH=800
HEIGHT=600
mutable struct MfbState
state::mfb_update_state
mousePressed::Int
end
stateArray=[
MfbState( MiniFB.STATE_OK, 0 ),
MfbState( MiniFB.STATE_OK, 0 ),
]
function windowUpdateTask(window,windowIndex,buffer,stateArray)
stateArray[windowIndex].state=mfb_update(window,buffer)
while stateArray[windowIndex].state == MiniFB.STATE_OK
stateArray[windowIndex].state=mfb_update(window,buffer)
sleep(1.0/120.0)
end
println("\nWindow closed\n")
end
window1 = mfb_open_ex("MiniFB", WIDTH, HEIGHT, MiniFB.WF_RESIZABLE)
buffer1 = zeros(ARGB32, WIDTH, HEIGHT)
d1=Drawing(buffer1)
@async windowUpdateTask(window1,1,buffer1,stateArray)
window2 = mfb_open_ex("MiniFB", WIDTH, HEIGHT, MiniFB.WF_RESIZABLE)
buffer2 = zeros(ARGB32, WIDTH, HEIGHT)
Luxor.CURRENTDRAWINGINDEX[1]=2
d2=Drawing(buffer2)
@async windowUpdateTask(window2,2,buffer2,stateArray)
origin()
setcolor("red")
circle(0,0,150,:fill)
Luxor.CURRENTDRAWINGINDEX[1]=1
origin()
setcolor("green")
circle(0,0,150,:fill)
Just a proof of concept.
Except for a ignorable error message from Cairo this works pretty well.
Metadata
Metadata
Assignees
Labels
No labels