Ejemplo n.º 1
0
Font::Font(const std::string &file, int height)
    : Resource() {
    m_filePath = file;
    m_height = height;

    FT_Library library;
    if (FT_Init_FreeType(&library))
        throw std::runtime_error("FT_Init_FreeType failed");

    FT_Face face;
    if (FT_New_Face(library, file.c_str(), 0, &face))
        throw std::runtime_error("FT_New_Face failed");

    // Multiply height with 64 to match FreeType's convention
    FT_Set_Char_Size(face, height << 6, height << 6, 96, 96);

    m_displayLists = glGenLists(128);
    glGenTextures(128, &m_textures[0]);

    for (unsigned char i = 0; i < 128; i++)
        makeDisplayList(face, i);

    FT_Done_Face(face);
    FT_Done_FreeType(library);
}
Ejemplo n.º 2
0
void Disk::doDraw() {
    Screen::getInstance()->setDrawingMode(0, Screen::DM_PREMUL);
    if (displayList_ == 0)
        makeDisplayList();
    else
        glCallList(displayList_);
}