Exemplo n.º 1
0
bool render_editor()
{
    cursor c = cursor_get();
    map_view v = view_get();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    update_view(v.x, v.y, v.zoom);
    /*update_cursor_data(&selected_map, &selected_tile_x, &selected_tile_y);*/
    bool can_place = cursor_in_bounds(c.selected_tile_x, c.selected_tile_y);

    mat4 t = ident;
    mat4 cursor_pos = ident;
    uint16_t tile_w = (TILE_WIDTH * v.zoom);
    uint16_t tile_h = (TILE_HEIGHT * v.zoom);
    if(tile_w == 0)
        tile_w = 1;
    if(tile_h == 0)
        tile_h = 1;
    mat4_translate(&cursor_pos, c.selected_tile_x * TILE_WIDTH + (c.selected_map % 3 * TILEMAP_DIMS * TILE_WIDTH), c.selected_tile_y * TILE_HEIGHT + (c.selected_map / 3 * TILEMAP_DIMS * TILE_HEIGHT), 0);
    draw_maps(t);
    if(can_place) {
        draw_single_tile(get_tileset_texture(), c.set_id, c.current_id, cursor_pos);
    }
    for(int i = 0; i < 3; ++i)
        for(int j = 0; j < 3; ++j) {
            mat4_translate(&t, TILEMAP_DIMS * TILE_WIDTH * i, TILEMAP_DIMS * TILE_HEIGHT * j, 0);
            draw_grid(t);
        }
    
    glFlush();

    return true;
}
Exemplo n.º 2
0
void calendar_click_long(ClickRecognizerRef recogniser, void* context)
{
    // Push on the agenda view
    window_stack_push(view_get(VIEW_AGENDA), 1);
}