matthiasm schrieb:
> 
> On Mar 17, 2007, at 11:54 PM, Maximilian Matthé wrote:
> 
>> In my program i have a while-loop where I change the content of an own
>> widget. I want to redraw the widget after every change of its content:
> 
> Call Fl::flush() after redraw().
> 
> Note however that this will slow down your loop considerably. Screen 
> drawing is expensive. Depending what your loop does, it is usually 
> better to do those calculations in a separate thread and use the 
> Fl::awake() mechanism, or use a timer to slice very long operations into 
> shorter execution units, preferably around 10ms... .
> 
> Matthias
> 
> ----
> http://robowerk.com/
> 
> 

Calling fltk::flush() works fine. Almost :) Maybe its a feature, but: 
fltk::flush() changes the current transformation. I have to enclose 
fltk::flush in to push_matrix and pop_matrix. Is this usual?

I'm drawing into the widget I want to be redrawn with redraw:

while(i <= 1.0f)
{
        sVector p = pos + dir * i;
        sLine l = BuildLine(p-orth, p+orth);
        

        fltk::push_matrix(); // flush must be enclosed to store the current 
matrix?
        redraw();
        fltk::flush();
        fltk::pop_matrix();

        fltk::setcolor(fltk::BLACK);
        fltk::drawline(l.Start.x, l.Start.y, l.End.x, l.End.y);

        fltk::setcolor(fltk::RED);
                for(int c = 0; c < hits.size(); c++)
                {
                        const sPoint& p = m_Corns[hits[c]];
                        if(PointLineCoords(p, l) > 0)
                                DrawCorn(p);
                }
        i += step;
}

My Widget::draw() restores the current transformation:
void cDrawField::draw()
{
        fltk::push_matrix();
        SetMatrix();

        // ...

        fltk::pop_matrix();
}

So is this a bug or is it a feature?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to