void CharacterSelect::run() {
	SDL_Event event;

	ready = false;
	cancel = false;

	init();

	frame = 0;

	while (main_.running && !ready && !cancel) {
		while(SDL_PollEvent(&event)) {
			main_.handle_event(&event);

			if(event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE) {
				cancel = true;
				break;
			}
			
			for(int i = 0; i < possible_players_; i++) {
				input[i]->handle_event(&event);
			}
		}

		process_cursors();

		for(int i = 0; i < possible_players_; i++) {
			if(player_joined[i]) {
				name[i] = Player::CHARACTERS[player_select[i]].name;
				file[i] = Player::CHARACTERS[player_select[i]].filename;

				playeranimation[i]->move();
			}
		}

		process_random_players();

		frame++;

		draw();

		int num_players = 0;
		ready = true;
		for(int i = 0; i < possible_players_; i++) {
			if(player_joined[i] && player_ready[i] && !flicker[i]) {
				++num_players;
			}
			if((player_joined[i] && !player_ready[i]) || flicker[i]) {
				ready = false;
			}
		}
		if(num_players < required_num_players_) ready = false;

		main_.flip();
	}

	clean_up();

	if(!ready)
		cancel = true;
}
Beispiel #2
0
/**
 * reiser4_load_cursors - attach cursors to inode
 * @inode: inode to load cursors to
 *
 * For each of cursors corresponding to @inode - attaches reiser4_file_fsdata
 * attached to cursor to inode's readdir list. This is done when inode is
 * loaded into memory.
 */
void reiser4_load_cursors(struct inode *inode)
{
	process_cursors(inode, CURSOR_LOAD);
}
Beispiel #3
0
/**
 * reiser4_kill_cursors - kill all inode cursors
 * @inode: inode to kill cursors of
 *
 * Frees all cursors for this inode. This is called when inode is destroyed.
 */
void reiser4_kill_cursors(struct inode *inode)
{
	process_cursors(inode, CURSOR_KILL);
}
Beispiel #4
0
/**
 * reiser4_dispose_cursors - removes cursors from inode's list
 * @inode: inode to dispose cursors of
 *
 * For each of cursors corresponding to @inode - removes reiser4_file_fsdata
 * attached to cursor from inode's readdir list. This is called when inode is
 * removed from the memory by memory pressure.
 */
void reiser4_dispose_cursors(struct inode *inode)
{
	process_cursors(inode, CURSOR_DISPOSE);
}