Ejemplo n.º 1
0
int ActionStack::addDraw(Player * player, int nb_cards)
{
    DrawAction * draw = NEW DrawAction(observer, mObjects.size(), player, nb_cards);
    addAction(draw);
    return 1;
}
Ejemplo n.º 2
0
  Response ToolButton::Draw (AbstractWindow* context)
  {
    AbstractWindow::shaders()->widget_inner_program()->use();

    if (is_down()) {

      glUniform1i(
          AbstractWindow::shaders()->location(Shaders::WIDGET_INNER_GAMMA), 0);
      glUniform1i(
          AbstractWindow::shaders()->location(Shaders::WIDGET_INNER_SHADED),
          context->theme()->tool().shaded);
      glUniform4fv(
          AbstractWindow::shaders()->location(Shaders::WIDGET_INNER_COLOR), 1,
          AbstractWindow::theme()->tool().inner_sel.data());

      glBindVertexArray(vao_[0]);
      glDrawArrays(GL_TRIANGLE_FAN, 0, outline_vertex_count(round_type()) + 2);

      AbstractWindow::shaders()->widget_outer_program()->use();

      glUniform2f(
          AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_OFFSET),
          0.f, 0.f);
      glUniform4fv(
          AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_COLOR), 1,
          AbstractWindow::theme()->tool().outline.data());

      glBindVertexArray(vao_[1]);
      glDrawArrays(GL_TRIANGLE_STRIP, 0,
                   outline_vertex_count(round_type()) * 2 + 2);

      if (emboss()) {
        glUniform4f(
            AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_COLOR),
            1.0f, 1.0f, 1.0f, 0.16f);
        glUniform2f(
            AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_OFFSET),
            0.f, -1.f);
        glDrawArrays(GL_TRIANGLE_STRIP, 0,
                     emboss_vertex_count(round_type()) * 2);
      }

    } else {

      if (hover_) {

        AbstractWindow::shaders()->widget_outer_program()->use();

        glUniform2f(
            AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_OFFSET),
            0.f, 0.f);
        glUniform4fv(
            AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_COLOR), 1,
            AbstractWindow::theme()->tool().outline.data());

        glBindVertexArray(vao_[1]);
        glDrawArrays(GL_TRIANGLE_STRIP, 0,
                     outline_vertex_count(round_type()) * 2 + 2);

        if (emboss()) {
          glUniform4f(
              AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_COLOR),
              1.0f, 1.0f, 1.0f, 0.16f);
          glUniform2f(
              AbstractWindow::shaders()->location(Shaders::WIDGET_OUTER_OFFSET),
              0.f, -1.f);
          glDrawArrays(GL_TRIANGLE_STRIP, 0,
                       emboss_vertex_count(round_type()) * 2);
        }

      }

    }

    DrawAction();

    return Finish;
  }