virtual void render(int x, int y, int w) { mitem::render(x, y, w); if(image || altfont) { int xs = 0; if(image) { glBindTexture(GL_TEXTURE_2D, image->id); glDisable(GL_BLEND); glColor3f(1, 1, 1); xs = (FONTH*image->xs)/image->ys; glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0, 0); glVertex2f(x, y); glTexCoord2f(1, 0); glVertex2f(x+xs, y); glTexCoord2f(0, 1); glVertex2f(x, y+FONTH); glTexCoord2f(1, 1); glVertex2f(x+xs, y+FONTH); glEnd(); xtraverts += 4; glEnable(GL_BLEND); } draw_text(text, !image || *text == '\t' ? x : x+xs + FONTH/2, y); if(altfont && strchr(text, '\a')) { char *r = newstring(text), *re, *l = r; while((re = strchr(l, '\a')) && re[1]) { *re = '\0'; x += text_width(l); l = re + 2; pushfont(altfont->name); draw_textf("%c", x, y, re[1]); popfont(); } delete[] r; } if(image && isselection() && !hidebigmenuimages && image->ys > FONTH) { w += FONTH; int xs = (2 * VIRTW - w) / 5, ys = (xs * image->ys) / image->xs; x = (6 * VIRTW + w - 2 * xs) / 4; y = VIRTH - ys / 2; blendbox(x - FONTH, y - FONTH, x + xs + FONTH, y + ys + FONTH, false); glBindTexture(GL_TEXTURE_2D, image->id); // I just copy&pasted this... glDisable(GL_BLEND); glColor3f(1, 1, 1); glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0, 0); glVertex2f(x, y); glTexCoord2f(1, 0); glVertex2f(x+xs, y); glTexCoord2f(0, 1); glVertex2f(x, y+ys); glTexCoord2f(1, 1); glVertex2f(x+xs, y+ys); glEnd(); xtraverts += 4; glEnable(GL_BLEND); } } else mitemmanual::render(x, y, w); }
int LuaFont::luaNew(lua_State *L) { const int LuaTop = lua_gettop( L ); if( LuaTop == 0 ) { pushfont( L, QFont() ); } else { const char *s = luaL_checkstring( L, 1 ); QString FontFace = QString( s ? s : "" ); int PointSize = -1; int Weight = -1; bool Italic = false; if( LuaTop >= 2 ) { PointSize = luaL_checkinteger( L, 2 ); } if( LuaTop >= 3 ) { Weight = luaL_checkinteger( L, 3 ); } if( LuaTop >= 3 ) { Italic = lua_toboolean( L, 3 ); } if( LuaTop > 3 ) { luaL_argerror( L, 3, "Unknown additional arguments" ); } pushfont( L, QFont( FontFace, PointSize, Weight, Italic ) ); } return( 1 ); }