RedWindow wrapper for SCWindow

superclass: SCWindow

adding some functionallity to the standard window class.

requires RedVector

note: this class uses cocoa gui. if you wan't to run redUniverse on osx with swing, then copy the file RedJWindow into the osx folder.

see also [RedJWindow], [SCWindow]

instance methods:

draw(func)

alias for drawHook_

play(fps= 40)

starts an internal thread on the AppClock updating at rate fps

stop

stop internal thread

resize([width, height])

change window size while keeping x and y position. the argument can also be a RedVector

background_(color)

set window background. alias for w.view.background_

isOpen

boolean

instance variables:

<>mouse

returns a RedVector for mouse x and y position. click&drag in window to set position.

<isPlaying

if the window is updating

<userView

access to the embedded view

//--

GUI.cocoa;

w= RedWindow.new.front;

w.resize(RedVector2D[200, 200])

w.background= Color.red

w.draw{GUI.pen.fillColor= Color.black; GUI.pen.fillOval(Rect.aboutPoint(175.rand@175.rand, 50, 50))}

w.play //start drawing

w.stop

( //mouse control

w.draw{

var radius= 100.rand;

GUI.pen.fillColor= Color.blue(0.5, radius/100);

GUI.pen.fillOval(Rect.aboutRedVector2D(w.mouse, radius))

}

)

w.play(25) //25fps

w.mouse

w.isPlaying

w.isOpen

w.stop

w.close