Ignore:
Timestamp:
Jul 14, 2010, 2:14:35 AM (11 years ago)
Author:
sam
Message:

Naive font renderer prototype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tileset.cpp

    r81 r87  
    4040    int ntiles;
    4141
     42    SDL_Surface *img;
    4243    GLuint texture[1];
    4344};
     
    4950TileSet::TileSet(char const *path)
    5051{
    51     SDL_Surface *img = NULL;
    52 
    5352    data = new TileSetData();
    5453    data->name = strdup(path);
     
    5655    data->tiles = NULL;
    5756    data->ntiles = 0;
     57    data->img = NULL;
    5858
    59     /* One tile texture */
    6059    for (char const *name = path; *name; name++)
    61         if ((img = IMG_Load(name)))
     60        if ((data->img = IMG_Load(name)))
    6261            break;
    6362
    64     if (!img)
     63    if (!data->img)
    6564    {
    6665        SDL_Quit();
     
    7170    glBindTexture(GL_TEXTURE_2D, data->texture[0]);
    7271
    73     glTexImage2D(GL_TEXTURE_2D, 0, 4, img->w, img->h, 0,
    74                  GL_RGBA, GL_UNSIGNED_BYTE, img->pixels);
     72    glTexImage2D(GL_TEXTURE_2D, 0, 4, data->img->w, data->img->h, 0,
     73                 GL_RGBA, GL_UNSIGNED_BYTE, data->img->pixels);
    7574
    7675    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
Note: See TracChangeset for help on using the changeset viewer.