Ignore:
Timestamp:
Feb 1, 2011, 2:20:05 AM (10 years ago)
Author:
sam
Message:

Test entity alignment features. Also, start working on the mouse tracking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/font.cpp

    r320 r326  
    4141
    4242    SDL_Surface *img;
    43     int width, height;
     43    int2 size;
    4444    float tx, ty;
    4545    GLuint texture;
     
    6969    }
    7070
    71     data->width = data->img->w / 16;
    72     data->height = data->img->h / 16;
    73     data->tx = (float)data->width / PotUp(data->img->w);
    74     data->ty = (float)data->height / PotUp(data->img->h);
     71    data->size = int2(data->img->w, data->img->h) / 16;
     72    data->tx = (float)data->size.x / PotUp(data->img->w);
     73    data->ty = (float)data->size.y / PotUp(data->img->h);
    7574
    7675    drawgroup = DRAWGROUP_BEFORE;
     
    151150            glVertex2f(pos.x, pos.y);
    152151            glTexCoord2f(tx + data->tx, ty + data->ty);
    153             glVertex2f(pos.x + data->width, pos.y);
     152            glVertex2f(pos.x + data->size.x, pos.y);
    154153            glTexCoord2f(tx + data->tx, ty);
    155             glVertex2f(pos.x + data->width, pos.y + data->height);
     154            glVertex2f(pos.x + data->size.x, pos.y + data->size.y);
    156155            glTexCoord2f(tx, ty);
    157             glVertex2f(pos.x, pos.y + data->height);
     156            glVertex2f(pos.x, pos.y + data->size.y);
    158157        }
    159158
    160         pos.x += data->width;
     159        pos.x += data->size.x;
    161160    }
    162161    glEnd();
     
    189188}
    190189
     190int2 Font::GetSize() const
     191{
     192    return data->size;
     193}
     194
Note: See TracChangeset for help on using the changeset viewer.