示例#1
0
void GodotSharpBuilds::BuildProcess::on_exit(int p_exit_code) {

	exited = true;
	exit_code = p_exit_code;
	build_tab->on_build_exit(p_exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR);
	build_instance.unref();

	if (exit_callback)
		exit_callback(exit_code);
}
示例#2
0
文件: service.c 项目: 520lly/bluez
static void path_unregister(void *data)
{
	struct service_adapter *serv_adapter = data;
	GSList *l, *next = NULL;

	for (l = serv_adapter->records; l != NULL; l = next) {
		struct record_data *user_record = l->data;

		next = l->next;

		g_dbus_remove_watch(connection, user_record->listener_id);
		exit_callback(connection, user_record);
	}

	g_free(serv_adapter);
}
示例#3
0
文件: service.c 项目: 520lly/bluez
static int remove_record(DBusConnection *conn, const char *sender,
			struct service_adapter *serv_adapter,
			dbus_uint32_t handle)
{
	struct record_data *user_record;

	DBG("remove record 0x%x", handle);

	user_record = find_record(serv_adapter, handle, sender);
	if (!user_record)
		return -1;

	DBG("listner_id %d", user_record->listener_id);

	g_dbus_remove_watch(conn, user_record->listener_id);

	exit_callback(conn, user_record);

	return 0;
}
示例#4
0
// Show and loop main menu
void show_menu_loop() {
    char *ip = "";
    FILE *han;
    SDL_Event event;
    int createserver = 0;
    SDL_Thread *ReadThread;
    //GConfClient *gcc = NULL;

    // Init GConf
    //g_type_init();
    //gcc = gconf_client_get_default();
    //createserver = gconf_client_get_bool(gcc, BATTLEGWELED_CREATESERVER, NULL);
    //ip = gconf_client_get_string(gcc, BATTLEGWELED_SERVERIP, NULL);

    // Single player
    if (!createserver && !strcmp(ip, "")) {
	han = fopen("/tmp/.battlegweled-save", "rb");
	if (han) {
		fread(&total_score, sizeof(int), 1, han);
		fread(&single_timer, sizeof(int), 1, han);
		fread(&timer_delay, sizeof(int), 1, han);
		fread(&score, sizeof(int), 1, han);
       		fread(nb_of_tiles, sizeof(nb_of_tiles), 1, han);
       		fread(matrix, BOARD_WIDTH * BOARD_HEIGHT, sizeof(int), han);
       		fclose(han);
       		new_game(true, GM_SINGLE, true);
    	} else new_game(true, GM_SINGLE, false); 
       	if (game_loop()) {
		flush_callback(0);
		quit_callback(0);
	} else exit_callback(0);
    } else {
	    int joined;
	    if (createserver) create_game();
	    else joined = join_game(ip);

            while (1) {

	        // If connected then start the game
	        if (ss == SS_CONNECTED) {
	            new_game(true, GM_MULTIPLAYER, false);
	            ReadThread = SDL_CreateThread(multi_player_loop, "ReadThread", NULL);
	            game_loop();
	            //SDL_KillThread(ReadThread);
                    SDL_WaitThread(ReadThread, NULL);
		    break;
                }

		if (ss == SS_ERROR || (SDL_PollEvent(&event) && ((event.key.state == SDL_PRESSED && (event.key.keysym.sym == SDLK_ESCAPE
			|| event.key.keysym.sym == SDLK_F4 || event.key.keysym.sym == SDLK_F5 || event.key.keysym.sym == SDLK_F6))
			|| event.type == SDL_QUIT || (event.type == SDL_MOUSEBUTTONDOWN && event.button.x >= BACK_OFFSETX
			&& event.button.y >= BACK_OFFSETY && event.button.x < BACK_OFFSETX2 && event.button.y < BACK_OFFSETY2)))) {
                        SDL_WaitThread(ThreadConnect, NULL);
                        SDL_WaitThread(ThreadAccept, NULL);
			//if (ThreadConnect) SDL_KillThread(ThreadConnect);
                        //if (ThreadAccept) SDL_KillThread(ThreadAccept);
			break;
                }

		// Update screen
        	draw_waiting_screen();
        }
	quit_callback(0);
    }
}
示例#5
0
static void kb_poll_events(void) {
    SDL_Event event;
    static float offset = SCREEN_WIDTH/1280.0f;
    int x, y;
    while (SDL_PollEvent(&event)) {
        switch (event.type) {  
            case SDL_MOUSEMOTION:
                kb_ui_inject_mouse(event.motion.x, event.motion.y);
                break;
            case SDL_MOUSEBUTTONUP:
                kb_ui_inject_mouse_button(event.button.button, false);
                break;
            case SDL_MOUSEBUTTONDOWN:
                if (event.button.y < 480 * (SCREEN_WIDTH/1280.f) || fullscreen_canvas) {
                    x = event.button.x;
                    y = event.button.y;
                    printf("Handling click on x = %d, y = %d\n", x, y);
                    if (fullscreen_canvas) {
                        x = x * 0.625f;
                        y = y * 0.625f;
                    } else {
                        x *= (1280.0f / SCREEN_WIDTH);
                        y *= (1280.0f / SCREEN_WIDTH);
                    }
                    printf("after scaling: %d, %d\n", x, y);
                    if (calibration_mode) {
                        handle_calibration_click(x, y);
                    } else {
                        select_reference_color(x, y);
                    }
                } else {
                    kb_ui_inject_mouse_button(event.button.button, true);
                }
                break;
            case SDL_KEYDOWN:
                switch (event.key.keysym.sym) {
                    case SDLK_ESCAPE:
                        exit_callback();
                    case SDLK_LEFT:
                        kb_images_scroll_left();
                        break;
                    case SDLK_RIGHT:
                        kb_images_scroll_right();
                        break;
                    case SDLK_e:
                        run_calibration_callback();
                        break;
                    case SDLK_f:
                        fullscreen_canvas = !fullscreen_canvas;
                        break;
                    case SDLK_c:
                        mask_rgb_clear_cont();
                        break;
                    case SDLK_b:
                        current_background++;
                        if (current_background >= (sizeof(backgrounds) / sizeof(uint8_t*)))
                            current_background = 0;
                        break;
                    default:
                        printf("Unknown key pressed.\n");
                        break;
                }
                break;
        }
    }
}