Exemple #1
0
void Mesh::draw(const Params& params, int n_elements, int offset)
{
  if (n_elements == 0)
    return;

  Drawable::draw(params);

  GUI::GPUPipeline& gpu = GUI::GPUPipeline::instance();

  gpu.bind_shader_input(_verticies, "vertex");

  if (params.wireframe)
    draw_elements(_wireframe, GL_LINES, 6, n_elements, offset);
  else
    draw_elements(_filled, GL_TRIANGLES, 3, n_elements, offset);
}
Exemple #2
0
void UI::draw() {
    glActiveTexture(GL_TEXTURE0);

    shader->setSampler2D("texture", 0);
    shader->use();

    setIntensity(1.0f);
    setTextured(true);

    glDepthFunc(GL_LEQUAL);
    glEnable(GL_DEPTH_TEST);

    std::vector<UIElement*> draw_elements(elements);

    //draw elements by reverse zindex
    std::sort(draw_elements.begin(), draw_elements.end(), UIElement::reverse_zindex_sort);

    for(UIElement* e: draw_elements) {
        if(e->isVisible()) e->draw();
    }

    shader->unbind();

    glDisable(GL_DEPTH_TEST);
}
Exemple #3
0
inline void vertex_buffer_object<Ta, Te>::draw() const
{
    if( m_elements.is_valid() )
        draw_elements( 0, m_elements.count() );
    else
        draw_vertices( 0, m_vertices.count() );
}
Exemple #4
0
static void dialog_ok_cb(u8 state, void * data)
{
    (void)state;
    (void)data;
    guiObject_t *obj = (guiObject_t *)&gui->elem[lp->selected_for_move];
    draw_elements();
    if(obj && OBJ_IS_USED(obj))
        select_for_move((guiLabel_t *)obj);
}
Exemple #5
0
void PAGE_MainLayoutInit(int page)
{
     (void)page;
    memset(lp, 0, sizeof(*lp));
    BUTTON_RegisterCallback(&action,
          CHAN_ButtonMask(BUT_ENTER)
          | CHAN_ButtonMask(BUT_EXIT)
          | CHAN_ButtonMask(BUT_LEFT)
          | CHAN_ButtonMask(BUT_LEFT)
          | CHAN_ButtonMask(BUT_RIGHT)
          | CHAN_ButtonMask(BUT_UP)
          | CHAN_ButtonMask(BUT_DOWN),
          BUTTON_PRESS | BUTTON_LONGPRESS | BUTTON_PRIORITY, _action_cb, NULL);
    PAGE_ShowHeader(NULL);
    lp->long_press = 0;
    lp->newelem = 0;
    lp->selected_x = 0;
    const u16 color[5] = {
        RGB888_to_RGB565(0xaa, 0x44, 0x44),
        RGB888_to_RGB565(0x44, 0xaa, 0x44),
        RGB888_to_RGB565(0x44, 0x44, 0xaa),
        RGB888_to_RGB565(0x44, 0x44, 0x44),
        RGB888_to_RGB565(0x33, 0x33, 0x33),
        };
    for (int i = 0 ; i < 5; i++)
        gui->desc[i] = (struct LabelDesc){
            .font = 0,
            .font_color = 0xffff,
            .fill_color = color[i],
            .outline_color = 0,
            .style = LABEL_FILL};
    gui->desc[1].font = TINY_FONT.font; //Special case for trims
    GUI_CreateIcon(&gui->newelem, 32, 0, &icons[ICON_LAYOUT_ADD], add_dlg_cb, NULL);
    GUI_CreateIcon(&gui->editelem, 64, 0, &icons[ICON_LAYOUT_CFG], cfg_cb, NULL);
    GUI_SetHidden((guiObject_t *)&gui->editelem, 1);
    //GUI_CreateTextSelect(&gui->newelem, 36, 12, TEXTSELECT_96, newelem_press_cb, newelem_cb, NULL);
    GUI_CreateLabel(&gui->xlbl, 80+18, 9, NULL, TITLE_FONT, "X");
    GUI_CreateTextSelect(&gui->x, 88+18, 8, TEXTSELECT_64, NULL, xpos_cb, NULL);
    GUI_CreateLabel(&gui->ylbl, 164+16, 9, NULL, TITLE_FONT, "Y");
    GUI_CreateTextSelect(&gui->y, 172+16, 8, TEXTSELECT_64, NULL, ypos_cb, NULL);

    GUI_SelectionNotify(notify_cb);
    draw_elements();
    if (show_config_menu) {
        lp->selected_for_move = show_config_menu;
        show_config();
        show_config_menu = 0;
    }
}
void PAGE_MainLayoutEvent()
{
}
void PAGE_MainLayoutExit()
{
    BUTTON_UnregisterCallback(&action);
}
Exemple #6
0
void newelem_press_cb(guiObject_t *obj, const void *data)
{
    (void)obj;
    (void)data;
    int i = create_element();
    if (i >= 0) {
        draw_elements();
        select_for_move(&gui->elem[i]);
    }
}
Exemple #7
0
void PAGE_LayoutEditInit(int page)
{
    (void)page;
    PAGE_SetActionCB(_layaction_cb);
    lp->selected_x = 0;
    lp->selected_y = 0;
    for (int i = 0 ; i < 5; i++)
        gui->desc[i] = (struct LabelDesc){
            .font = MICRO_FONT.font,
            .font_color = 0xffff,
            .fill_color = 0x0000,
            .outline_color = 0xffff,
            .style = LABEL_SQUAREBOX,
        };
    gui->desc[1].style = LABEL_BRACKET; //Special case for trims

    struct LabelDesc micro = MICRO_FONT;
    struct LabelDesc rect = MICRO_FONT;
    micro.style = LABEL_LEFT;
    rect.fill_color = 0x0000;
    rect.outline_color = 0x0000;
    GUI_CreateRect(&gui->editelem, 41, 1, 9, 5, &rect);
    gui->editelem.CallBack = move_cb;
    GUI_CreateLabel(&gui->xlbl, 0,  1, NULL, micro, "X:");
    GUI_CreateLabelBox(&gui->x, 8, 1, 13, 6, &micro, pos_cb, NULL, (void *) 0L);
    GUI_CreateLabel(&gui->ylbl, 22, 1, NULL, micro, "Y:");
    GUI_CreateLabelBox(&gui->y, 30, 1, 9, 6, &micro, pos_cb, NULL, (void *) 1L);
    //gui->y must be the last element!
    GUI_SelectionNotify(notify_cb);

    draw_elements();
    if(OBJ_IS_USED(&gui->elem[0]))
        GUI_SetSelected((guiObject_t *)&gui->elem[0]);
}

static void xpos_cb(guiObject_t *obj, int dir, void *data)
{
    (void)obj;
    (void)data;
    if (lp->selected_for_move >= 0) {
        int x = GUI_TextSelectHelper(lp->selected_x, 0, LCD_WIDTH-lp->selected_w, dir, 1, 10, NULL);
        if (x != lp->selected_x) {
            lp->selected_x = x;
            move_elem();
        }
    }
}
Exemple #8
0
	void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLuint *indices) const
	{
		draw_elements(buffer, mode, count, indices_type::uint, indices);
	}
Exemple #9
0
	void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, const GLushort *indices) const
	{
		draw_elements(mode, count, indices_type::ushort, indices);
	}
Exemple #10
0
	void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
	{
		buffer_.bind(buffer::target::array);
		draw_elements(mode, count, type, indices, indices_buffer_offset);
	}