Exemplo n.º 1
0
  public void draw(RenderHelper renderer) {
    Texture texture;
    if (m_pressed && !m_is_disabled) {
      texture = m_texture_pressed;
    } else {
      texture = m_texture_unpressed;
    }

    float[] default_color = m_color;
    if (m_is_disabled) {
      float[] font_color = m_item_font.getColor();
      for (int i = 0; i < 4; ++i) m_tmp_color[i] = font_color[i];
      m_item_font.setColor(m_color_disabled);
      m_color = m_color_disabled;
    }

    renderer.pushModelMat();
    renderer.modelMatTranslate(m_position.x, m_position.y, 0.f);
    renderer.modelMatScale(m_size.x, m_size.y, 0.f);

    drawTexture(renderer, texture);

    // Render font
    m_item_font.draw(renderer);

    if (m_is_disabled) {
      m_color = default_color;
      m_item_font.setColor(m_tmp_color);
    }

    renderer.popModelMat();
  }
  public void draw(RenderHelper renderer) {
    renderer.pushModelMat();
    renderer.modelMatTranslate(m_position.x, m_position.y, 0.f);
    renderer.modelMatScale(m_size.x, m_size.y, 0.f);

    drawTexture(renderer, m_texture);

    m_item_font.draw(renderer);

    renderer.popModelMat();
  }
Exemplo n.º 3
0
  public void draw(RenderHelper renderer) {
    renderer.pushModelMat();
    renderer.modelMatTranslate(m_position.x, m_position.y, 0.f);
    renderer.modelMatScale(m_size.x, m_size.y, 0.f);

    if (m_is_selected) drawTexture(renderer, m_selected_texture);
    else drawTexture(renderer, m_normal_texture);

    m_item_font.draw(renderer);

    renderer.popModelMat();
  }
Exemplo n.º 4
0
  public MenuItemString(
      Vector position,
      Vector size,
      Font2DSettings font_settings,
      String entry,
      TextureManager tex_manager) {

    super(position, size);
    m_item_font = new Font2D(tex_manager, m_size, font_settings, (int) (m_size.y * 0.5f));
    m_item_font.setString(entry);

    m_position_data = new VertexBufferFloat(VertexBufferFloat.sprite_position_data, 3);
    RenderHelper.initColorArray(0xffffffff, m_color);

    m_normal_texture = tex_manager.get(R.raw.texture_grey_unpressed_button);
    m_selected_texture = tex_manager.get(R.raw.texture_grey_pressed_button);
  }
Exemplo n.º 5
0
  public MenuItemButton(
      Vector position,
      Vector size,
      Font2DSettings font_settings,
      String font_string,
      TextureManager tex_manager) {
    super(position, size);

    m_item_font = new Font2D(tex_manager, size, font_settings, (int) Math.round(size.y * 0.7));
    m_item_font.setString(font_string);

    m_texture_pressed = tex_manager.get(R.raw.texture_main_menu_pressed_button, false);
    m_texture_unpressed = tex_manager.get(R.raw.texture_main_menu_unpressed_button, false);

    m_position_data = new VertexBufferFloat(VertexBufferFloat.sprite_position_data, 3);
    RenderHelper.initColorArray(0xffffffff, m_color);

    // disabled button color
    RenderHelper.initColorArray(0xff888888, m_color_disabled);
  }
Exemplo n.º 6
0
 public String getString() {
   return m_item_font.getString();
 }
Exemplo n.º 7
0
 public void setString(String str) {
   m_item_font.setString(str);
 }
 public void setString(String new_str) {
   m_text_input = new_str;
   m_item_font.setString(new_str);
 }