void paths_create() {
    for (int i = 0; i < NUM_WEDGES; i++) {
        if (s_paths[i]) {
            gpath_destroy(s_paths[i]);
        }

        GPathInfo path_info = (GPathInfo) {
            .num_points = 3,
             .points = s_points[i]
        };
        s_paths[i] = gpath_create(&path_info);
        gpath_move_to(s_paths[i], s_center);
    }
}

void paths_destroy() {
    for (int i = 0; i < NUM_WEDGES; i++) {
        gpath_destroy(s_paths[i]);
    }
}

Layer* forecast_create(GRect window_bounds) {
    s_center = grect_center_point(&window_bounds);
    init_points();
    paths_create();
    s_canvas_layer = layer_create(window_bounds);
    //layer_add_child(s_canvas_layer, textlayer_create());
    layer_set_update_proc(s_canvas_layer, draw_forecast);

    static Layer* icons_layer;
    icons_layer = forecast_icons_create(window_bounds);
    layer_add_child(s_canvas_layer, icons_layer);

    return s_canvas_layer;
}
Exemple #2
0
void menubar_create(menubar_t *m)
{
	memset(m,0,sizeof(menubar_t));

	m->info.type = G_MENUBAR;
	m->info.x = 0;
	m->info.y = 0;
	m->info.w = 256;
	m->info.h = 14;
	m->info.draw = (drawfunc_t)menubar_draw;
	m->info.event = (eventfunc_t)menubar_event;

	//this needs to be configurable, passed thru in a struct
	menu_create(&m->menus[0],"\x1",4,recentitems);
	menu_create(&m->menus[1],"Game",m->menus[0].info.x + m->menus[0].info.w + 4,gameitems);
	menu_create(&m->menus[2],"Config",m->menus[1].info.x + m->menus[1].info.w + 4,configitems);
	menu_create(&m->menus[3],"Cheat",m->menus[2].info.x + m->menus[2].info.w + 4,miscitems);
	menu_create(&m->menus[4],"Debug",m->menus[3].info.x + m->menus[3].info.w + 4,debugitems);
	button_create(&m->buttons[0],"x",(256 - 9) - 3,3,click_quit);
	button_create(&m->buttons[1],"\x9",(256 - 33) - 1,3,click_minimize);
	button_create(&m->buttons[2],"\x8",(256 - 21) - 3,3,click_togglefullscreen);
	load_create(&m->load);
	video_create(&m->video);
	input_create(&m->input);
	gui_input_create(&m->guiinput);
	sound_create(&m->sound);
	devices_create(&m->devices);
	palette_create(&m->palette);
	options_create(&m->options);
	mappers_create(&m->mappers);
	paths_create(&m->paths);
	supported_mappers_create(&m->supported_mappers);
	rom_info_create(&m->rom_info);
	tracer_create(&m->tracer);
	memory_viewer_create(&m->memory_viewer);
	nt_create(&m->nametable_viewer);
	pt_create(&m->patterntable_viewer);
	about_create(&m->about);

	m->menus[0].click = click_recent;
	m->menus[1].click = click_game;
	m->menus[2].click = click_config;
	m->menus[3].click = click_debug;
	m->menus[4].click = click_misc;
	m->menus[0].user = m;
	m->menus[1].user = m;
	m->menus[2].user = m;
	m->menus[3].user = m;
	m->menus[4].user = m;

	//'hack' to update the 'freeze data' caption
	click_freezedata();
	click_freezedata();
}
void forecast_queue_refresh() {
    needs_refresh = true;
    paths_destroy();
    paths_create();
    forecast_update();
}