Show
Ignore:
Timestamp:
07/04/08 03:46:13 (5 months ago)
Author:
krobillard
Message:

Thune

  • Implemented date!. Added ur_arrayExpand(), save.

ThuneGL

  • Added line-edit widget, blit, move-glyphs.
  • Can now make font from texture & binary.
  • Optimized renderGlyphXY() a bit.
  • twidget close event handler works again.
  • Updated thune-gl.spec for renamed glv RPM.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/gl/draw_list.c

    r536 r540  
    242242  Advances x. 
    243243*/ 
    244 static TexFontGlyph* renderGlyphXY( const TexFont* txf, int c, 
    245                                     GLfloat* xp, GLfloat y, 
     244static TexFontGlyph* renderGlyphXY( const TexFont* txf, 
     245                                    GLfloat texW, GLfloat texH, 
     246                                    int c, GLfloat* xp, GLfloat y, 
    246247                                    const TexFontGlyph* leftGI ) 
    247248{ 
    248     GLfloat w, h; 
    249     GLfloat tw, th; 
     249    GLfloat gw, gh; 
    250250    GLfloat gx, gy; 
    251251    GLfloat min_s, max_s; 
     
    257257    if( tgi ) 
    258258    { 
    259         w = (GLfloat) txf->tex_width; 
    260         h = (GLfloat) txf->tex_height; 
    261  
    262         tw = (GLfloat) tgi->width; 
    263         th = (GLfloat) tgi->height; 
    264  
     259        gw = (GLfloat) tgi->width; 
     260        gh = (GLfloat) tgi->height; 
    265261        gx = (GLfloat) tgi->x; 
    266262        gy = (GLfloat) tgi->y; 
    267263 
    268         min_s = gx / w; 
    269         min_t = 1.0f - (gy / h); 
    270         max_s = (gx + tw) / w; 
    271         max_t = 1.0f - ((gy + th) / h); 
     264        min_s = gx / texW; 
     265        max_s = (gx + gw) / texW; 
     266#if 0 
     267        min_t = 1.0f - (gy / texH); 
     268        max_t = 1.0f - ((gy + gh) / texH); 
     269#else 
     270        min_t = gy / texH; 
     271        max_t = (gy - gh) / texH; 
     272#endif 
    272273 
    273274        xkern = leftGI ? txf_kerning( txf, leftGI, tgi ) : 0; 
     
    278279 
    279280        glTexCoord2f( min_s, min_t );  glVertex2f( gx, gy ); 
    280         glTexCoord2f( max_s, min_t );  glVertex2f( gx + tw, gy ); 
    281         glTexCoord2f( max_s, max_t );  glVertex2f( gx + tw, gy + th ); 
    282         glTexCoord2f( min_s, max_t );  glVertex2f( gx, gy + th ); 
     281        glTexCoord2f( max_s, min_t );  glVertex2f( gx + gw, gy ); 
     282        glTexCoord2f( max_s, max_t );  glVertex2f( gx + gw, gy + gh ); 
     283        glTexCoord2f( min_s, max_t );  glVertex2f( gx, gy + gh ); 
    283284    } 
    284285    return tgi; 
     
    302303{ 
    303304    GLfloat x, y; 
     305    GLfloat tw, th; 
    304306    TexFontGlyph* prev = 0; 
     307 
     308    tw = (GLfloat) tf->tex_width; 
     309    th = (GLfloat) tf->tex_height; 
    305310 
    306311    if( (it != end) ) 
     
    317322            { 
    318323                x = (GLfloat) tf->max_ascent; 
    319                 y -= x * 1.5f;  // Estimate of line spacing. 
     324                y -= txf_lineSpacing( tf ); 
    320325                x = grState.penX; 
    321326                prev = 0; 
     
    328333            else 
    329334            { 
    330                 prev = renderGlyphXY( tf, *it, &x, y, prev ); 
     335                prev = renderGlyphXY( tf, tw, th, *it, &x, y, prev ); 
    331336            } 
    332337            ++it;