Пример #1
0
void drawrect(int x, int y, int right, int bottom, uint32_t color)
{
    set_color(color);
    glBindTexture(GL_TEXTURE_2D, white);
    makequad(&quads[0], x, y, right, bottom);
    glDrawQuads(0, 1);
}
Пример #2
0
void drawalpha(int bm, int x, int y, int width, int height, uint32_t color)
{
    set_color(color);
    glBindTexture(GL_TEXTURE_2D, bitmap[bm]);
    makequad(&quads[0], x, y, x + width, y + height);
    glDrawQuads(0, 1);
}
Пример #3
0
static int _drawtext(int x, int xmax, int y, uint8_t *str, uint16_t length)
{
    glUniform3fv(k, 1, colorf);
    glBindTexture(GL_TEXTURE_2D, sfont->texture);
    int c = 0;

    GLYPH *g;
    uint8_t len;
    uint32_t ch;
    while(length) {
        len = utf8_len_read(str, &ch);
        str += len;
        length -= len;

        g = font_getglyph(sfont, ch);
        if(g) {
            if(x + g->xadvance > xmax) {
                x = -x;
                break;
            }

            if(c == 64) {
                glDrawQuads(0, 64);
                c = 0;
            }

            makeglyph(&quads[c++], x + g->x, y + g->y, g->mx, g->my, g->width, g->height);

            x += g->xadvance;
        }
    }

    glDrawQuads(0, c);

    return x;
}