Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » RectTracker : usage of the callback sync
RectTracker : usage of the callback sync [message #35661] Sun, 11 March 2012 17:16 Go to next message
omari is currently offline  omari
Messages: 265
Registered: March 2010
Experienced Member
Hello Mirek,

I am using RectTracker and i want to aligne to a grid while tracking a rect.
to do that, i use the callback sync :

to let that work, i do two changes to RectTracker:


1. CtrlCore.h line 1457


I modified the type of parameter of the callback1 from Rect to Rect&,

    Callback1<Rect&> sync; 

instead of
    Callback1<Rect> sync; 



2. LocalLoop.cpp lines 174..180


to let DrawRect() clear the old Rect, i change the order of call to methodes sync() and DrawRect in the MouseMove() methode


	if(rect != o) {
		rect = Round(rect);
		if(rect != o) {
			sync(rect);
			DrawRect(o, rect); // DrawRect after sync, not before.
			o = rect;
		}
	}


instead of

	if(rect != o) {
		rect = Round(rect);
		if(rect != o) {
			DrawRect(o, rect);
			sync(rect);
			o = rect;
		}
	}



the sync callback is it made for this kind of use? or I must use a Rounder instead ?

Thanks


regards
omari.
Re: RectTracker : usage of the callback sync [message #35677 is a reply to message #35661] Mon, 12 March 2012 09:17 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Such change would be backward incompatible.

But it is true that special object for rounding is a little bit unconvient, so I have added 'round' callback with semantics you propose. See reference/RectTracker.

Mirek
Re: RectTracker : usage of the callback sync [message #35696 is a reply to message #35677] Tue, 13 March 2012 19:08 Go to previous message
omari is currently offline  omari
Messages: 265
Registered: March 2010
Experienced Member
Thanks Mirek.

omari


regards
omari.
Previous Topic: pimp Stream for protocol generation/processing
Next Topic: Xmlize Null Color
Goto Forum:
  


Current Time: Tue Apr 23 16:10:48 CEST 2024

Total time taken to generate the page: 0.02997 seconds