Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » al_set_clipping_rectangle behaivor

This thread is locked; no one can reply to it. rss feed Print
al_set_clipping_rectangle behaivor
AMCerasoli
Member #11,955
May 2010
avatar

Guys I don't understand how the clipping rectangle function works.

I'm drawing a rectangle using this:

    int x,y,w,h;
    al_get_clipping_rectangle(&x, &y, &w, &h);
    std::cout<<"x: "<<x<<" y: "<<y<<" w: "<<w<<" h: "<<h<<std::endl;
    awDrawRectangle(x,
                    y,
                    w,
                    h,
                    255, 0, 0, 255, false);

and setting the clipping rectangle like this:

        al_set_clipping_rectangle(mouse.posX,
                                  mouse.posY,
                                  mouse.posX+50,
                                  mouse.posY+50);

And I'm getting this:

video

I don't understand why that's happening. Shouldn't I see only that tiny rectangle filled with the back-buffer bitmap?

Edgar Reynaldo
Member #8,592
May 2007
avatar

AMCerasoli
Member #11,955
May 2010
avatar

Oh it's true man! hehehe I'm burned out, too much programming for now, I was unable to see that, so the function already adds the width and height relative to the position.

Edgar... :-* Eeeedddgaaar :-* Come on, say yes... :-*:-*

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: