Ejemplo n.º 1
0
void ConfApp::draw() {
    if(!ready || app->isFinished()) return;

    if(background_image != 0) {

        display.mode2D();

        glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glEnable(GL_BLEND);
        glEnable(GL_TEXTURE_2D);

        glBindTexture(GL_TEXTURE_2D, background_image->textureid);
        glColor4f(1.0, 1.0, 1.0, 1.0);
        glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 0.0f);
            glVertex2f(0.0f, 0.0f);

            glTexCoord2f(1.0f, 0.0f);
            glVertex2f(display.width, 0.0f);

            glTexCoord2f(1.0f, 1.0f);
            glVertex2f(display.width, display.height);

            glTexCoord2f(0.0f, 1.0f);
            glVertex2i(0.0f, display.height);
        glEnd();

    }

    try {
        app->draw(scaled_t, scaled_dt);
    } catch(...) {
        finished = true;
        return;
    }

    float elapse_time = 15.0;
    float elapsed_fade = 5.0;

    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);
    glEnable(GL_TEXTURE_2D);

    glColor4f(colour_title.x, colour_title.y, colour_title.z, 1.0);

    FXFont font = fontmanager.grab("FreeSans.ttf", 22);

    font.dropShadow(true);
    font.alignTop(false);

    font.draw(10.0, display.height - 10.0, title.c_str());

    font.alignRight(true);
    font.alignTop(false);

    font.draw(display.width - 10.0, display.height - 10.0, subtitle.c_str());
}
Ejemplo n.º 2
0
Paddle::Paddle(vec2 pos, vec4 colour, std::string token, FXFont font) {
    this->token = token;

// TODO: fix colouring
//    this->token_colour = token.size() > 0 ? colourHash2(token) : vec3(0.5,0.5,0.5);
    this->token_colour = token.size() > 0 ? colourHash(token) : vec3(0.5,0.5,0.5);

    this->pos = pos;
    this->lastcol = colour;
    this->default_colour = colour;
    this->colour  = lastcol;
    this->width = 10;
    this->height = 50;
    this->target = 0;

    font.alignTop(true);
    font.alignRight(true);
    font.dropShadow(true);

    this->font = font;

    dest_y = -1;
}