Exemplo n.º 1
0
void tweaks_gui() {
//	SDL_Event ev;
    u32 keys; 
	int action;
	
	set_mpx_string();
	set_mpy_string();
	set_paddle_sensitivity_string();
	set_paddle_adjust_string();
	set_lightgun_cycles_string();
	set_lightgun_scanlines_string();
	
	exit_tweaks = 0;
	while( !exit_tweaks ) {
		status_timer = 0;

		sprintf(msg, "Controller Tweaks");
		draw_gui(tweaks_gui_items, tweaks_current);
		
//		SDL_WaitEvent(&ev);	/* TODO: respond to SDL_QUIT events */
		hidScanInput();
		while(!hidKeysHeld()) hidScanInput();
		keys = hidKeysHeld();
		action = gui_navigation(keys); //&ev);
		if(action == GUI_NO_ACTION) continue;
		
		tweaks_current = gui_handle_action(action, &exit_tweaks, tweaks_gui_items, tweaks_current);
	}
}
Exemplo n.º 2
0
void sound_gui() {
//	SDL_Event ev;
    u32 keys; 
	int action;
	
	set_yesno_string(quiet_data, quiet);
	set_dsp_string();
	set_sq_string();
	
	exit_sound = 0;
	while( !exit_sound ) {
		status_timer = 0;

		sprintf(msg, "Sound Options");
		draw_gui(sound_gui_items, sound_current);
		
//		SDL_WaitEvent(&ev);	/* TODO: respond to SDL_QUIT events */
		hidScanInput();
		while(!hidKeysHeld()) hidScanInput();
		keys = hidKeysHeld();
		action = gui_navigation(keys); //&ev);
		if(action == GUI_NO_ACTION) continue;
		
		sound_current = gui_handle_action(action, &exit_sound, sound_gui_items, sound_current);
	}
}
Exemplo n.º 3
0
void interface_gui() {
	SDL_Event ev;
	int action;
	
	set_yesno_string(enable_keyboard_data, KeyboardEnabled);
	set_yesno_string(enable_mouse_data, MouseEnabled);
	set_yesno_string(enable_joystick_data, UserJoystickEnabled);
	set_yesno_string(enable_stelladaptor_data, StelladaptorEnabled);
	set_yesno_string(show_fps_data, ShowLineCount);
	set_yesno_string(mouse_rude_data, MouseRude);
	set_yesno_string(grab_input_data, GrabInput);
	set_theme_string();
	
	exit_interface = 0;
	while( !exit_interface ) {
		status_timer = 0;

		sprintf(msg, "Interface Options");
		draw_gui(interface_gui_items, interface_current);
		
		SDL_WaitEvent(&ev);	/* TODO: respond to SDL_QUIT events */
		action = gui_navigation(&ev);
		if(action == GUI_NO_ACTION) continue;
		
		interface_current = gui_handle_action(action, &exit_interface, interface_gui_items, interface_current);
	}
}
Exemplo n.º 4
0
int file_selector(char *result) {
	SDL_Event ev;
	int picked = 0;
//	int max_width = tiawidth/FONT_WIDTH;
	int max_height = MaxLines/FONT_HEIGHT; //-1;
	int k = 0;

	if (PaletteNumber != UserPaletteNumber)
	{
		PaletteNumber = UserPaletteNumber;
		gui_SetVideoMode();
	}
	clrscr();

	/* filesread is a global that gets updated by get_list */
	if (first_filelist) 
	{
		get_file_list();
		first_filelist = 0;
	}

	while(!picked) {
		int action;

		window_line = draw_file_list(curfile, window_line, max_height-2);
		SDL_WaitEvent(&ev);

		action = gui_navigation( &ev );

//		if(action == GUI_NO_ACTION)
//			continue;

		switch(action) 
		{
		char type;

		case GUI_EXIT_GUI:
			clrscr();
			return 0; /* abort */

		case GUI_ACTIVATE_SEC:
			match = 0;
			curfile++;
			if(curfile == filesread) curfile = 0;
			clrscr();
			type = file_list[curfile][strlen(file_list[curfile])-1];
			if(type == '/')	/* if it's a dir, cd to it and get new file list. */
			{
				if (chdir(file_list[curfile]) == 0)
				{
					curfile = 0;
					get_file_list();
				}
			} 
			else		/* if it's a file, return it */
			{
				strcpy(result, file_list[curfile]);
				picked = 1;
			}
			break;
		
		
		case GUI_ACTIVATE_PRI:
			match = 0;
			clrscr();
			type = file_list[curfile][strlen(file_list[curfile])-1];
			if(type == '/')	/* if it's a dir, cd to it and get new file list. */
			{
				if (chdir(file_list[curfile]) == 0)
				{
					curfile = 0;
					get_file_list();
				}
			} 
			else		/* if it's a file, return it */
			{
				strcpy(result, file_list[curfile]);
				picked = 1;
			}
			break;

		case GUI_UP:
			match = 0;
			curfile--;
			if(curfile < 0) curfile = filesread - 1;
			break;

		case GUI_DOWN:
			match = 0;
			curfile++;
			if(curfile == filesread) curfile = 0;
			break;

		case GUI_PAGEDOWN:
			match = 0;
			if(filesread > max_height-1) {
				curfile += max_height-1;
				if(curfile >= filesread)
					curfile = 0;
				window_line = curfile;
				clrscr();
			}
			break;

		case GUI_PAGEUP:
			match = 0;
			if(filesread > max_height-1) {
				curfile -= max_height-1;
				if(curfile < 0)
					curfile = filesread-1;
				window_line = curfile;
				clrscr();
				break;
			}

		case GUI_HOME:
			match = 0;
			curfile = 0;
			window_line = 0;
			clrscr();
			break;

		case GUI_END:
			match = 0;
			curfile = filesread-1;
			window_line = curfile;
			clrscr();
			break;
			
		case GUI_RANDOM:
			match = 0;
			curfile = rand() % filesread;
			window_line = curfile;
			type = file_list[curfile][strlen(file_list[curfile])-1];
			
			while (type == '/')	/* if it's a dir, find another file */
			{
				curfile = rand() % filesread;
				window_line = curfile;
				type = file_list[curfile][strlen(file_list[curfile])-1];
			} 
			
			
			
			clrscr();
			break;


		default:
			if(ev.type == SDL_KEYDOWN)
			{
				k = ev.key.keysym.sym;
				curfile = window_line = find_next_rom(curfile, k);
			}
			break;
		}

		SDL_WM_SetCaption(file_list[curfile], file_list[curfile]);

	}
	
	return picked;
}