Пример #1
0
static void handle_window_unload(Window* window) {
  destroy_ui();
  gbitmap_destroy(bus_full);
  gbitmap_destroy(bus_limited);
  gbitmap_destroy(bus_available);
  gbitmap_destroy(bus_wheelchair_accessible);
}
Пример #2
0
void destroy_game(void) {
  destroy_blockmap(impl.bm);
  destroy_canvas(impl.cvs);
  destroy_canvas(impl.pnl);
  destroy_shapebuf(impl.sb);
  destroy_queue(impl.queue);
  destroy_ui();
}
Пример #3
0
static void handle_window_unload(Window* window) {
  app_timer_cancel(s_timer);
  text_layer_set_background_color(s_time, GColorClear);
  text_layer_set_text_color(s_time, GColorWhite);
  
  destroy_ui();
  s_time = NULL;
  s_timerActive = false;
}
Пример #4
0
PUSS_EXPORT void  puss_plugin_destroy(void* ext) {
	SearchTools* self = (SearchTools*)ext;
	if( self ) {
		destroy_ui(self);

		clear_search_results(self);
		g_object_unref(self->result_store);
		g_free(self);
	}
}
Пример #5
0
static void handle_window_unload(Window* window) {
  destroy_ui();
  
  gbitmap_destroy(s_res_charging);
  gbitmap_destroy(s_res_battery_20);
  gbitmap_destroy(s_res_battery_40);
  gbitmap_destroy(s_res_battery_60);
  gbitmap_destroy(s_res_battery_80);
  gbitmap_destroy(s_res_battery_100);
}
Пример #6
0
static void
openssl_shutdown(void)
{
	CONF_modules_unload(1);
	destroy_ui();
	OBJ_cleanup();
	EVP_cleanup();
	CRYPTO_cleanup_all_ex_data();
	ERR_remove_thread_state(NULL);
	ERR_free_strings();
}
Пример #7
0
static void handle_window_unload(Window* window) {
  if (get_backlight_on())
    light_enable(false);
  
  destroy_ui();
}
Пример #8
0
int main(int argc, char** argv)
{
    if(!glfwInit()) {
        error("Failed to intialize GLFW.");
        return 1;
    }

    GLFWwindow* win;
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    win = glfwCreateWindow(800, 600, "Halberd", NULL, NULL);
    if(!win) {
        error("Unable to create window.");
        return 1;
    }
    glfwSetFramebufferSizeCallback(win, sizeCallback);
    glfwMakeContextCurrent(win);

	glewExperimental = 1;
	if(glewInit() != GLEW_OK) {
        error("glewInit() failed.");
        glfwDestroyWindow(win);
        return 1;
    }
    glGetError(); // Because GLEW is silly. <http://stackoverflow.com/questions/20034615/why-does-glewinit-result-in-gl-invalid-enum-after-making-some-calls-to-glfwwin>
    GLuint VAO; // FIXME: Stupid Hack. <http://stackoverflow.com/questions/13403807/glvertexattribpointer-raising-gl-invalid-operation>
    glGenVertexArrays(1, &VAO);
    glBindVertexArray(VAO);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    init_graphics();
    update_camera(800, 600);
    init_input(win);
    init_player(0, 0);
    init_ui();
    init_settings();

    /*init_maps();*/
    // TODO: Figure out the correct way to start up
    /*get_tileset_id("Plains.png");*/
    /*load_maps("test");*/

    float delta = 0;
    glfwSetTime(0);
    do {
        delta = glfwGetTime();
        glfwSetTime(0);
        glfwPollEvents();

        if(!ui_present())
            update_player(delta);
        update_actors(delta);
        update_ui(delta);
        update_input_states(delta);

        render_game();

        glfwSwapBuffers(win);
    } while(!glfwWindowShouldClose(win) && get_input_state(4) != 2);

    destroy_player_actor();
    destroy_actors();
    /*destroy_maps();*/
    destroy_ui();
    destroy_graphics();
    cleanup_settings();

    glfwDestroyWindow(win);
    glfwTerminate();
    return 0;
}
Пример #9
0
void hide_qr(void) {
  window_stack_remove(qr_window, true);
  destroy_ui();
}
Пример #10
0
static void prv_handle_window_unload(Window* window) {
  persist_selected_stop(menu_layer_get_selected_index(s_menu).row);
  destroy_ui();
}
Пример #11
0
static void handle_window_unload(Window* window) {
  destroy_ui();
  
  text_layer_destroy(text_layer);
  scroll_layer_destroy(scroll_layer);
}
Пример #12
0
static void main_window_unload(Window *window) {
  destroy_ui();
}
Пример #13
0
static void handle_window_unload(Window* window) {
  destroy_ui();
}
Пример #14
0
static void handle_window_unload(Window* window) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "unload");
  destroy_ui();
}
Пример #15
0
static void handle_window_unload(Window* window) {
  destroy_ui();
  gbitmap_destroy(s_res_img_snooze);
}
Пример #16
0
static void handle_window_unload(Window* window) {
    destroy_ui();
    free(stats_data);
}
Пример #17
0
Файл: main.c Проект: needs/anko
int main(int argc, char **argv)
{
	world_t world;
	game_t game;
	double last_time = 0;
	double current_time = 0;
	float deltatime = 0;
	float sleep_time;

	if (config_from_file("anko.cfg", 1) == 2)
		return EXIT_FAILURE;
	if (config_from_args(argc, argv))
		return EXIT_FAILURE;

	if (!init())
		goto err_init;
	if (!new_game(&game, config.board_width, config.board_height, &config.gen_params, config.sim_speed * 1000))
		goto err_game;
	if (!create_world(&world, &game))
		goto err_world;
	if ((current_ui = init_ui_game(&world)) == NULL)
		goto err_ui;

	world_set_active_player(&world, add_player(&game, TEAM_BURNER));
	events_link_frame(&current_ui); // link window event to game ui frame
	glClearColor(0, 0, 0, 1);

	last_time = 0;
	while(!glfwWindowShouldClose(window)) {
	    current_time = glfwGetTime();
		deltatime = current_time - last_time;
		update_speed(deltatime);
		glfwPollEvents();

		// Update
		update_ui(current_ui, deltatime);
		update_world(&world);
		if (update_game(&game, deltatime * 1000))
			refresh_world(&world);
		if(should_quit)
			glfwSetWindowShouldClose(window, GL_TRUE);

		// Rendering
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		draw_ui(current_ui);
		font_swap_buffers();
		glfwSwapBuffers(window);

		// Update speed and sleep if necessary
		last_time = current_time;
		sleep_time = (current_time + MAX_MSPF - glfwGetTime()) * 1000 * 1000;
		if(sleep_time > 0)
			usleep(sleep_time);
	}

	destroy_ui(current_ui);
	game_over(&game);
	end_of_the_world(&world); // Tin tin tin
	terminate();

	return EXIT_SUCCESS;
err_ui:
	end_of_the_world(&world);
err_world:
	game_over(&game);
err_game:
	terminate();
err_init:
	return EXIT_FAILURE;
}
Пример #18
0
static void handle_window_unload(Window* window) {
  LOG_FUNC();
  destroy_ui();
}
Пример #19
0
static void handle_window_unload(Window* window) {
  APP_LOG(APP_LOG_LEVEL_INFO, "Unloading window");
  destroy_ui();
}
Пример #20
0
static void handle_window_unload(Window* window) {
  cancel_autohide();
  destroy_ui();
}
Пример #21
0
Файл: main.c Проект: bgee/twilc
int main() {
    setlocale(LC_ALL,"");

    clit_config *config = malloc(sizeof(clit_config));
    if(parse_config(config) == -1) {
        // first run
        int res = authorize(config);
        if(res == -1) {
            printf("Please retry.\n");
        }
        else
            printf("Authorization finished. Run the program again.\n");
        free(config);
        exit(0);
    }

    me = newuser();
    me->screen_name = config->screen_name;
    me->id = config->user_id;

    init_oauth(config->key,config->secret);
    free(config);

    init_mutex();
    raw_event_stream  =  new_raw_event_queue();

    printf("Loading the timelines....\n");
    if(init_timelines() == -1) {
        pthread_mutex_lock(&error_mutex);
        printf("Cannot load the timeline. Please check your network connection.\n");
        pthread_mutex_unlock(&error_mutex);
        goto exit_twilc;
    }

    initscr();
    curs_set(0);


    //if(has_colors() == FALSE)
    //goto exit_twilc;
    raw();
    keypad(stdscr,TRUE);
    noecho();
    start_color();

    move(0,0);
    refresh();

    if(init_ui() == -1)
        goto exit_twilc;

    start_userstream();
    wait_command(tl_win);


exit_twilc:

    destroy_ui();
    curs_set(1);
    endwin();

    destroy_mutex();
    for(int i = 0; i < TIMELINE_COUNT; ++i)
        destroy_timeline(timelines[i]);

    stop_userstream();
    pthread_mutex_lock(&event_buffer_mutex);
    destroy_raw_event_queue(raw_event_stream);
    raw_event_stream = NULL;
    pthread_mutex_unlock(&event_buffer_mutex);
    return 0;
}
Пример #22
0
static void handle_window_unload(Window* window) {
  battery_state_service_unsubscribe();
  tick_timer_service_unsubscribe();
  destroy_ui();
}
Пример #23
0
// called when leaving the app
static void handle_window_unload(Window* window) {
  app_timer_cancel(timer);
  destroy_ui();
}
Пример #24
0
static void handle_window_unload(Window* window) {
    destroy_ui();
    save_persistent_data();
}
Пример #25
0
static void prv_handle_window_unload(Window* window) {
  destroy_ui();
  free(s_times);
}
Пример #26
0
void synth_main()
{
	gfx_wave_render_initialise();
	gfx_envelope_render_initialise();

	create_settings();
	create_ui();

	gfx_event_initialise();
	gfx_initialise();

	patch_initialise();
	synth_initialise();
	configure_audio();
	configure_profiling();

	config_setting_t* piglow_config = config_lookup(&app_config, CFG_DEVICES_PIGLOW);
	if (piglow_config != NULL)
	{
		piglow_initialise(piglow_config);
	}

	waveform_initialise();
	gfx_register_event_global_handler(GFX_EVENT_BUFFERSWAP, process_buffer_swap);

	// Done after synth setup as this can load controller values into the synth
	configure_midi();

	int profiling = 0;

	int32_t last_timestamp = get_elapsed_time_ms();

	while (1)
	{
		int midi_controller_value;

		if (midi_controller_update_and_read(&exit_controller, &midi_controller_value))
		{
			break;
		}

		if (midi_controller_update_and_read(&screenshot_controller, &midi_controller_value))
		{
			static int screenshot_count = 0;
			char screenshot_name[64];
			sprintf(screenshot_name, "pithesiser-img-%03d.png", screenshot_count++);
			gfx_screenshot(screenshot_name);
		}

		process_midi_events();

		if (!profiling && midi_controller_update_and_read(&profile_controller, &midi_controller_value))
		{
			if (profile_file != NULL)
			{
				ProfilerStart(profile_file);
				profiling = 1;
			}
		}

		alsa_sync_with_audio_output();

		int32_t timestamp = get_elapsed_time_ms();
		process_audio(timestamp - last_timestamp);
		last_timestamp = timestamp;
	}

	if (profiling)
	{
		ProfilerStop();
	}

	synth_controllers_save(SETTINGS_FILE);
	patch_save();
	patch_deinitialise();
	piglow_deinitialise();
	gfx_deinitialise();
	destroy_ui();
	gfx_envelope_render_deinitialise();
	gfx_wave_render_deinitialise();
	mod_matrix_controller_deinitialise();
	alsa_deinitialise();
	midi_deinitialise();
	synth_deinitialise();
	config_destroy(&app_config);

	LOG_INFO("Done: %d xruns", alsa_get_xruns_count());
}
Пример #27
0
void window_unload(Window* window) {
  	destroy_ui();
}
Пример #28
0
static void prv_handle_window_unload(Window* window) {
  tick_timer_service_unsubscribe();
  prv_destroy_custom_ui();
  destroy_ui();
  persist_hiding_stop();
}
Пример #29
0
static void handle_window_unload(Window* window) {
  destroy_ui();
  hide_analog();
}