Beispiel #1
0
 void childf()
 {
     data d(topf());
 }
Beispiel #2
0
void glictSkinner::Paint(glictSize *size) {
    static float x1, y1, x2, y2;

#ifndef NO_GL
	if (center || left || right || top || bottom || topleft || topright || bottomleft || bottomright)  {
		glEnable(GL_TEXTURE_2D);
		glColor4f(1., 1., 1., 1.);
	}
#endif
	static glictColor col (1, 1, 1, 1);
    // first the corners...

    if (centerimg || center || centerf) {
        if (centerf)
            centerf(this, centerp);
		#ifndef NO_GL
        else if (!centerimg)
            glBindTexture(GL_TEXTURE_2D, center);
		#endif

        for (float pos = (left || leftf || leftimg) ? lefts.w : 0; pos < size->w - ((right || rightf || rightimg) ? rights.w : 0); pos+=centers.w) {
            for (float pos2 = (top || topf || topimg) ? tops.h : 0; pos2 < size->h - ((bottom || bottomf || bottomimg) ? bottoms.h : 0); pos2+=centers.h) {

                y1 = pos2;
                y2 = min(size->h - ((bottom || bottomf) ? bottoms.h : 0), pos2 + centers.h);

                x1 = pos;
                x2 = min(size->w - ((right || rightf) ? rights.w : 0), pos + centers.w);

                if (centerimg)
					centerimg->Paint(x1, y1, x2-x1, y2-y1);
				else
					glictGlobals.PaintRect(x1, x2, y1, y2, col);
            }
        }
    }




    if (topimg || top || topf) {

        if (topf)
            topf(this, topp);
		#ifndef NO_GL
        else if (!topimg)
            glBindTexture(GL_TEXTURE_2D, top);
		#endif

        for (float pos = (topleft || topleftf || topleftimg) ? toplefts.w : 0; pos < size->w - ((topright || toprightf || toprightimg) ? toprights.w : 0); pos+=tops.w) {
            x1 = pos; y1 = 0;
            x2 = min(size->w - ((topright || toprightf || toprightimg) ? toprights.w : 0) , pos + tops.w); y2 = tops.h;
            if (topimg)
				topimg->Paint(x1, y1, x2-x1, y2-y1);
			else
				glictGlobals.PaintRect(x1, x2, y1, y2, col);
        }
    }

    if (bottomimg || bottom || bottomf) {
        if (bottomf)
            bottomf(this, bottomp);
		#ifndef NO_GL
        else if (!bottomimg)
            glBindTexture(GL_TEXTURE_2D, bottom);
		#endif
        for (float pos = (bottomleft || bottomleftf || bottomleftimg) ? bottomlefts.w : 0; pos < size->w - ((bottomright || bottomrightf || bottomrightimg) ? bottomrights.w : 0); pos+=bottoms.w) {
            x1 = pos; y1 = size->h - bottoms.h;
            x2 = min(size->w - ((bottomleft || bottomleftf || bottomrightimg) ? bottomlefts.w : 0), pos + bottoms.w); y2 = size->h;
            if (bottomimg)
				bottomimg->Paint(x1, y1, x2-x1, y2-y1);
			else
				glictGlobals.PaintRect(x1, x2, y1, y2, col);

        }
    }



    if (leftimg || left || leftf) {
        if (leftf)
            leftf(this, leftp);
		#ifndef NO_GL
        else if (!leftimg)
            glBindTexture(GL_TEXTURE_2D, left);
		#endif
        for (float pos = (topleft || topleftf || topleftimg) ? toplefts.h : 0; pos < size->h - ((bottomleft || bottomleftf || bottomleftimg) ? bottomlefts.w : 0); pos+=lefts.h) {
            x1 = 0; y1 = pos;
            x2 = lefts.w; y2 = min(size->h - ((bottomleft || bottomleftf || bottomleftimg) ? bottomlefts.h : 0), pos + lefts.h);
            if (leftimg)
				leftimg->Paint(x1, y1, x2-x1, y2-y1);
			else
				glictGlobals.PaintRect(x1, x2, y1, y2, col);
        }
    }


    if (rightimg || right || rightf) {
        if (rightf)
            rightf(this, rightp);
		#ifndef NO_GL
        else if (!rightimg)
            glBindTexture(GL_TEXTURE_2D, right);
		#endif
        for (float pos = (topright || toprightf || toprightimg) ? toprights.h : 0; pos < size->h - ((bottomright || bottomrightf || bottomrightimg) ? bottomrights.w : 0); pos+=rights.h) {
            x1 = size->w - rights.w; y1 = pos;
            x2 = size->w; y2 = min(size->h - ((bottomright || bottomrightf || bottomrightimg) ? bottomrights.w : 0), pos + rights.h);
            if (rightimg)
				rightimg->Paint(x1, y1, x2-x1, y2-y1);
			else
				glictGlobals.PaintRect(x1, x2, y1, y2, col);
        }
    }




    if (topleftimg || topleft || topleftf) {
        x1 = y1 = 0;
        x2 = toplefts.w+1; y2 = toplefts.h;
        if (topleftimg)
			topleftimg->Paint(x1, y1, x2-x1, y2-y1);
		else {
			if (topleftf)
				topleftf(this, topleftp);
			#ifndef NO_GL
			else
				glBindTexture(GL_TEXTURE_2D, topleft);
			#endif
			glictGlobals.PaintRect(x1, x2, y1, y2, col);
		}
    }

    if (toprightimg || topright || toprightf) {
        x1 = size->w - toprights.w; y1 = 0;
        x2 = size->w; y2 = toprights.h;
        if (toprightimg)
			toprightimg->Paint(x1, y1, x2-x1, y2-y1);
		else {
			if (toprightf)
				toprightf(this, toprightp);
			#ifndef NO_GL
			else
				glBindTexture(GL_TEXTURE_2D, topright);
			#endif
			glictGlobals.PaintRect(x1, x2, y1, y2, col);
		}
    }

    if (bottomleftimg || bottomleft || bottomleftf) {
        x1 = 0; y1 = size->h - bottomlefts.h;
        x2 = bottomlefts.w ; y2 = size->h;
        if (bottomleftimg)
			bottomleftimg->Paint(x1, y1, x2-x1, y2-y1);
		else {
			if (bottomleftf)
				bottomleftf(this, bottomleftp);
			#ifndef NO_GL
			else
				glBindTexture(GL_TEXTURE_2D, bottomleft);
			#endif
			glictGlobals.PaintRect(x1, x2, y1, y2, col);
		}
    }

    if (bottomrightimg || bottomright || bottomrightf) {
        x1 = size->w - bottomrights.w; y1 = size->h - bottomrights.h;
        x2 = size->w - 1; y2 = size->h;
        if (bottomrightimg)
			bottomrightimg->Paint(x1, y1, x2-x1, y2-y1);
		else {
			if (bottomrightf)
				bottomrightf(this, bottomrightp);
			#ifndef NO_GL
			else
				glBindTexture(GL_TEXTURE_2D, bottomright);
			#endif
			glictGlobals.PaintRect(x1, x2, y1, y2, col);
		}
    }



#ifndef NO_GL
	if (center || left || right || top || bottom || topleft || topright || bottomleft || bottomright)  {
		glDisable(GL_TEXTURE_2D);
	}
#endif

}