Exemplo n.º 1
0
void keyboard_func (unsigned char key, int x, int y)
{
	switch (key)
	{
	case 'H':
	case 'h':
		menu_help();
		break;
		;;

	case 'Q':
	case 'q':
		exit(0);
		break;
		;;
	}
}
Exemplo n.º 2
0
void menu_func (int value)
{
	// variables used in the switch statement
	char filename[MAX_LINE];

	switch (value)
	{
	case M_QUIT:  // enum #0
		exit(0);
		break;



	case M_HELP:  // enum #1
		menu_help();
		break;



	case M_FILE_OPEN:   // enum #2
		if (!quietMode)
			cerr << "Open file (string - no spaces) : ";
		cin  >> filename;
		checkStream(cin);
		image_load(filename);
		break;


	case M_FILE_SAVE:   // enum #3
		if (!quietMode)
			cerr << "Save as (string - no spaces) : ";
		cin  >> filename;
		checkStream(cin);
		image_save(filename);
		break;


	case M_FILE_INFO:  // enum #4
		image_print_info();
		break;


	case M_FILE_REVERT:  // enum #5
		image_revert();
		break;

	case M_VIEW_PIXEL_VALUE: // enum #31
		{
			if (!currentImage) 
			{
				cerr << "Sorry, no image is loaded." << endl;
				break;
			}
			if (!quietMode)
			{
				cerr << "Current image width and height: " << currentImage->getWidth()-1 << " " 
					<< currentImage->getHeight()-1 << endl;
			}
			int x=getInt("x value of pixel to view");
			int y=getInt("y value of pixel to view");
			if (x<0 || x>=currentImage->getWidth() || y<0 || y>=currentImage->getHeight())
			{
				cerr << "Invalid pixel location." << endl;
				break;
			}
			cerr << "R: " << currentImage->getPixel(x,y,RED);
			cerr << ", G: " << currentImage->getPixel(x,y,GREEN);
			cerr << ", B: " << currentImage->getPixel(x,y,BLUE) << endl;
			break;
		}

	default:
		process_func(value);
	}
	return;
}
Exemplo n.º 3
0
MainFrame::MainFrame()
	: FrameBase(nullptr, wxID_ANY, "", "MainFrame", wxSize(800, 600))
	, m_aui_mgr(this)
	, m_sys_menu_opened(false)
{

#ifdef _DEBUG
	SetLabel(wxString::Format(_PRGNAME_ " git-" RPCS3_GIT_VERSION));
#else
	SetLabel(wxString::Format(_PRGNAME_ " " _PRGVER_));
#endif

	wxMenuBar& menubar(*new wxMenuBar());

	wxMenu& menu_boot(*new wxMenu());
	menubar.Append(&menu_boot, "Boot");
	menu_boot.Append(id_boot_game, "Boot game");
	menu_boot.Append(id_install_pkg, "Install PKG");
	menu_boot.AppendSeparator();
	menu_boot.Append(id_boot_elf, "Boot (S)ELF");

	wxMenu& menu_sys(*new wxMenu());
	menubar.Append(&menu_sys, "System");
	menu_sys.Append(id_sys_pause, "Pause")->Enable(false);
	menu_sys.Append(id_sys_stop, "Stop\tCtrl + S")->Enable(false);
	menu_sys.AppendSeparator();
	menu_sys.Append(id_sys_send_open_menu, "Send open system menu cmd")->Enable(false);
	menu_sys.Append(id_sys_send_exit, "Send exit cmd")->Enable(false);

	wxMenu& menu_conf(*new wxMenu());
	menubar.Append(&menu_conf, "Config");
	menu_conf.Append(id_config_emu, "Settings");
	menu_conf.Append(id_config_pad, "PAD Settings");
	menu_conf.AppendSeparator();
	menu_conf.Append(id_config_vfs_manager, "Virtual File System Manager");
	menu_conf.Append(id_config_vhdd_manager, "Virtual HDD Manager");

	wxMenu& menu_tools(*new wxMenu());
	menubar.Append(&menu_tools, "Tools");
	menu_tools.Append(id_tools_compiler, "ELF Compiler");
	menu_tools.Append(id_tools_memory_viewer, "Memory Viewer");
	menu_tools.Append(id_tools_rsx_debugger, "RSX Debugger");

	wxMenu& menu_help(*new wxMenu());
	menubar.Append(&menu_help, "Help");
	menu_help.Append(id_help_about, "About...");

	SetMenuBar(&menubar);

	// Panels
	m_game_viewer = new GameViewer(this);
	m_debugger_frame = new DebuggerPanel(this);
	ConLogFrame = new LogFrame(this);

	AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM);
	AddPane(ConLogFrame, "Log", wxAUI_DOCK_BOTTOM);
	AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT);
	
	// Events
	Connect( id_boot_game,			 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootGame) );
	Connect( id_install_pkg,		 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::InstallPkg) );
	Connect( id_boot_elf,			 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootElf) );

	Connect( id_sys_pause,           wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Pause) );
	Connect( id_sys_stop,            wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Stop) );
	Connect( id_sys_send_open_menu,	 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::SendOpenCloseSysMenu) );
	Connect( id_sys_send_exit,       wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::SendExit) );

	Connect( id_config_emu,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Config) );
	Connect( id_config_pad,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::ConfigPad) );
	Connect( id_config_vfs_manager,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::ConfigVFS) );
	Connect( id_config_vhdd_manager, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::ConfigVHDD) );

	Connect( id_tools_compiler,		 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenELFCompiler));
	Connect( id_tools_memory_viewer, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenMemoryViewer));
	Connect( id_tools_rsx_debugger,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenRSXDebugger));

	Connect( id_help_about,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::AboutDialogHandler) );

	Connect( id_update_dbg,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::UpdateUI) );

	m_app_connector.Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainFrame::OnKeyDown), (wxObject*)0, this);
	m_app_connector.Connect(wxEVT_DBG_COMMAND, wxCommandEventHandler(MainFrame::UpdateUI), (wxObject*)0, this);
}
Exemplo n.º 4
0
void menu_update(t_time t) {
    menu_render();

    
    if (menu_estado==MENU_ST_MENU) {
        if (t<menu_pilgrim_tt) {
            float alfa=(menu_pilgrim_tt-t)/menu_pilgrim_tt;
            menu_pilgrim_x=alfa*menu_pilgrim_x0+(1-alfa)*menu_pilgrim_xf;
            menu_pilgrim_y=alfa*menu_pilgrim_y0+(1-alfa)*menu_pilgrim_yf;
        } else {
            menu_pilgrim_x=menu_pilgrim_xf;
            menu_pilgrim_y=menu_pilgrim_yf;
        }
        if (t<menu_title_tt) {
            float alfa=(menu_title_tt-t)/menu_title_tt;
            menu_title_x=alfa*menu_title_x0+(1-alfa)*menu_title_xf;
            menu_title_y=alfa*menu_title_y0+(1-alfa)*menu_title_yf;
        } else {
            menu_title_x=menu_title_xf;
            menu_title_y=menu_title_yf;
        }
    } else if (menu_estado==MENU_ST_CREDITS) {
        if (t<menu_credits_tt) {
            float alfa=(menu_credits_tt-t)/menu_credits_tt;
            menu_credits_x=alfa*menu_credits_x0+(1-alfa)*menu_credits_xf;
            menu_credits_y=alfa*menu_credits_y0+(1-alfa)*menu_credits_yf;
        } else {
            menu_credits_x=menu_credits_xf;
            menu_credits_y=menu_credits_yf;
        }
        

    } else if (menu_estado==MENU_ST_HOF) {
        if (t<menu_hof_tt) {
            float alfa=(menu_hof_tt-t)/menu_hof_tt;
            menu_hof_x=alfa*menu_hof_x0+(1-alfa)*menu_hof_xf;
            menu_hof_y=alfa*menu_hof_y0+(1-alfa)*menu_hof_yf;
        } else {
            menu_hof_x=menu_hof_xf;
            menu_hof_y=menu_hof_yf;
        }
        
        
    }
    
    
    
    if (menu_estado==MENU_ST_MENU) {
        if ( game_hit_pressed ) {
            if (persistence_total_played_games<MAX_GAMES_AUTO_SHOW_HELP) {
                menu_help(1);
            } else {
                game_start();
            }
        } else if (game_stop_pressed) {
            menu_help(0);
        } else if (game_esquivar_pressed) {
            menu_hof();
        } else if (game_salto_pressed) {
            menu_credits();
        } else if (game_other_pressed) {
            audio_switch_deactivate();
        }
    } else if (menu_estado==MENU_ST_CREDITS || menu_estado==MENU_ST_HOF) {
        
        if ( game_other_pressed ) {
            if (menu_estado==MENU_ST_HOF) {
                audio_stop_music();
                audio_start_music(AUDIO_MUSIC_MENU);
            }
            
            menu_init();
        }
        if ( game_other2_pressed ) {
            if (menu_estado==MENU_ST_HOF) {
//                if (gamecenter_enter_hof_or_achievments==0) {
//                    game_enter_gamecenter_hof=1;
//                    gamecenter_enter_hof_or_achievments=1;
//                } else {
//                    game_enter_gamecenter_achievments=1;
//                    gamecenter_enter_hof_or_achievments=0;
//                }
                game_enter_gamecenter_hof=1;
            }
        }
        if (game_stop_pressed) {
            if (menu_estado==MENU_ST_HOF) {
                game_enter_gamecenter_achievments=1;
            }
        }

#if PILGRIM_INCLUDE_WEBLINK
        if (menu_estado==MENU_ST_CREDITS && game_other2_pressed) {
            game_jump_to_weblink=1;
        }
#endif
            
    } else if (menu_estado==MENU_ST_RESULTS) {
        if ( game_other_pressed ) {
            if (game_highscore_pos!=-1) {
                menu_enter_hof();
            } else {
                menu_init();
            }
        }
    } else if (menu_estado==MENU_ST_HELP || menu_estado==MENU_ST_HELPSTART) {
        if (game_other_pressed) {
            menu_help_page+=1;
            if (menu_help_page==3) {
                if (menu_estado==MENU_ST_HELPSTART) {
                    game_start();
                } else {
                    menu_init();
                }
            }
        }
        if (game_other2_pressed) {
            menu_help_page-=1;
            if (menu_help_page==-1) {
                menu_init();
            }
        }

        
    } else if (menu_estado==MENU_ST_ENTERHOF) {
        if (game_highscore_name_entered) {
            game_highscore_name_entered=0;
            //highscore_print();
            //printf("nuevo record de %s\n",game_highscore_name);
            highscore_insert_name_pos(game_highscore_name, game_last_score, game_highscore_pos);
            //highscore_print();
            menu_hof();
        }
    }

    
        
}
Exemplo n.º 5
0
void menu_func (int value)
{
  switch (value)
  {
  case M_QUIT:  
    exit(0);
    break;

  case M_HELP:
    menu_help();
    break;

  case M_PRINT_CONFIG:
    cerr << *options << endl;
    break;

  case M_FILE_OPEN:
    menu_file_open();
    break;

  case M_FILE_RELOAD:
    menu_file_reload();
    break;

  case M_FILE_SAVE_IMAGE:
    menu_file_save_image();
    break;

  case M_FILE_SAVE_RAYFILE:
    menu_file_save_rayfile();
    break;

  case M_RENDER_RAYTRACE:
    menu_render_raytrace();
    break;

  case M_RENDER_JITTER:
    menu_render_jitter();
    break;

  case M_RENDER_SHADOWS:
    menu_render_shadows();
    break;

  case M_RENDER_RDEPTH:
    menu_render_rdepth();
    break;

  case M_RENDER_CLIMIT:
    menu_render_climit();
    break;

  case M_RENDER_SET_SIZE:
    menu_render_set_size();
    break;

  case M_OPTIONS_LIGHTING:
    options->lighting = !options->lighting;
    cerr << "Lights " << (options->lighting?"on":"off") << endl;
    glutPostRedisplay();
    break;

  case M_OPTIONS_TRANSFORMS:
    options->transforms = !options->transforms;
    cerr << "Transforms " << (options->transforms?"on":"off") << endl;
    glutPostRedisplay();
    break;

  case M_OPTIONS_TEXTURES:
    options->textures = !options->textures;
    cerr << "Textures " << (options->textures?"on":"off") << endl;
    glutPostRedisplay();
    break;


  case M_OPTIONS_BUMPMAPS:
    options->bumpMaps = !options->bumpMaps;
    cerr << "Bump maps " << (options->bumpMaps?"on":"off") << endl;
    glutPostRedisplay();
    break;

  case M_OPTIONS_TRANSPARENCY:
    options->transparency = !options->transparency;
    cerr << "Transparency " << (options->transparency?"on":"off") << endl;
    glutPostRedisplay();
    break;

  case M_OPTIONS_BACKFACE:
    options->backface = !options->backface;
    cerr << "Backface Culling " << (options->backface?"on":"off") << endl;
    glutPostRedisplay();
    break;

  default:
    break;
  }

  cerr << "done!" << endl;
}