[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] .clear .. again sorry



Hi Thor,
i cannot promise anything - but i will try to have a look before monday.
Jan

On Jan 17, 2008, at 11:49 AM, thor wrote:



Hi Jan

Since you're working on the GUI these days, could I put forth
a request for a .clear in SCUserView (when drawing).

It would make a GUI instrument I'm working on run on 20% CPU
instead of 90% CPU.

Sorry for all the nagging
thor




Here is the mail I explained how my problem was:

------------------------

Check the following:
(it draws on top of the other drawing. If I then set clearOnRefresh to true, it
removes the drawing when the window is refreshed)

cheers
thor

(
var dropcount, drawer;
dropcount = 16;
c = true;
a = Array.fill(dropcount, {80.rand});
	
	w = SCWindow("drops", Rect(211, 311, 820, 343)).front;

	drawer = SCUserView(w, Rect(120, 5, 680, 200))
			.canFocus_(false)
			.relativeOrigin_(true)
			.drawFunc_({ |view|
				if(c == true, {
					\drawing.postln;
					Pen.color = Color.rand;
					16.do({ |i|
						a.do({ |steps, ix|
							steps.do({ |iy|
								Pen.line(
								Point(	(ix*(680/dropcount)),
										3.5+(((iy+1)*(192/steps))).round(1)),
								Point(	(ix*(680/dropcount))+(680/dropcount),
										3.5+(((iy+1)*(192/steps))).round(1))
								);
							});
						});
					});
					Pen.stroke;
					c = false;
				});
			})
			.clearOnRefresh_(false);
)

// run the following 3 lines a few times.
// I need to be able to clear when I want, but still no refresh
c = true
a = Array.fill(16, {80.rand});
w.refresh;


_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel