コード例 #1
0
ファイル: Adventure.c プロジェクト: BlackLamb/MiniDungeon
void AdventureWindowAppear(Window *window)
{
	INFO_LOG("Back to the adventure.");
	DEBUG_LOG("Adventure appear floor %d",GetCurrentFloor());
	MenuAppear(window);
	ShowMainWindowRow(0, "Floor", UpdateFloorText());
	adventureWindow = window;
	UpdateCharacterHealth();
	UpdateCharacterLevel();
	SetUpdateDelay();
	adventureWindowVisible = true;
}
コード例 #2
0
ファイル: MiniDungeon.c プロジェクト: BlackLamb/MiniDungeon
void focus_handler(bool in_focus) {
	hasFocus = in_focus;
	if(hasFocus)
	{
		UpdateClock();
		SetUpdateDelay();
		INFO_LOG("Gained focus.");
	}
	else
	{
		INFO_LOG("Lost focus.");
	}
}
コード例 #3
0
void CPageDisplay::Initialize()
{
	// Set all of the status bars to all managers.
	for ( int i = 0; i < NUM_STATUS_BARS; i++ )
	{
 		barcharts[i].results = theApp.manager_list.results;
		barcharts[i].name = theApp.manager_list.name;
		barcharts[i].manager = NULL;
		barcharts[i].worker = NULL;
	}

	// Init all display thingies.
	selected_button = 0;
	theApp.pView->OnMDisplay( MDisplayOpsSubmenuID, MDisplayOpsIOPS );

	selected_button = 1;
	theApp.pView->OnMDisplay( MDisplayMBsSubmenuID, MDisplayMBsMBPS );

	selected_button = 2;
	theApp.pView->OnMDisplay( MDisplayAvgSubmenuID, MDisplayAvgIO );

	selected_button = 3;
	theApp.pView->OnMDisplay( MDisplayMaxSubmenuID, MDisplayMaxIO );

	selected_button = 4;
	theApp.pView->OnMDisplay( MDisplayCPUSubmenuID, MDisplayCPUUtilization );

	selected_button = 5;
	theApp.pView->OnMDisplay( MDisplayErrSubmenuID, MDisplayErrIO );

	SetUpdateDelay( 0 );

	SetWhichPerf( WHOLE_TEST_PERF );

	Reset();
}
コード例 #4
0
//
// Load the settings of the page from a file.
//
BOOL CPageDisplay::LoadConfig( const CString& infilename )
{
	long version;
	CString key, value;
	ICF_ifstream infile(infilename);

	version = infile.GetVersion();
	if (version == -1)
		return FALSE;
	if ( !infile.SkipTo("'RESULTS DISPLAY") )
		return TRUE;	// no results display to restore (this is OK)

	while (1)
	{
		if ( !infile.GetPair(key, value) )
		{
			ErrorMessage("File is improperly formatted.  Expected results "
				"display data or \"END results display\".");
			return FALSE;
		}

		if ( key.CompareNoCase("'END results display") == 0 )
		{
			break;
		}
		else if ( key.CompareNoCase("'Update Frequency,Update Type") == 0 )
		{
			int update_frequency;
			CString update_type;

			if ( !ICF_ifstream::ExtractFirstInt(value, update_frequency) )
			{
				ErrorMessage("Error while reading file.  "
					"\"Update frequency\" should be specified as an integer value.");
				return FALSE;
			}

			update_type = value;
			update_type.TrimRight();

			SetUpdateDelay( update_frequency );

			if ( update_type.CompareNoCase("LAST_UPDATE") == 0 )
				SetWhichPerf( LAST_UPDATE_PERF );
			else if ( update_type.CompareNoCase("WHOLE_TEST") == 0 )
				SetWhichPerf( WHOLE_TEST_PERF );
			else
			{
				ErrorMessage("File is improperly formatted.  In RESULTS "
					"DISPLAY section, Update Frequency was not followed by "
					"an appropriate Update Type string.");
				return FALSE;
			}
		}
		else if ( key.Left((int)(strlen("'Bar chart"))).CompareNoCase("'Bar chart") == 0 )
		{
			int bar_number;
			CString bar_item;

			if ( !ICF_ifstream::ExtractFirstInt(key, bar_number) )
			{
				ErrorMessage("Error while reading file.  "
					"\"Bar chart\" should be followed by an integer value.");
				return FALSE;
			}

			bar_item = key;
			bar_item.TrimLeft();
			bar_item.TrimRight();

			if ( bar_number < 1 || bar_number > NUM_STATUS_BARS )
			{
				ErrorMessage( "Invalid bar chart number in RESULTS DISPLAY "
					"section.  Ignoring this bar setting." );
				continue;
			}

			bar_number--;	// convert from one-based to zero-based index

			if ( bar_item.CompareNoCase("statistic") == 0 )
			{
				SelectStatisticByName( bar_number, value );
			}
			else if ( bar_item.CompareNoCase("manager ID, manager name") == 0 )
			{
				CString mgr_name;
				int mgr_id;

				if ( !ICF_ifstream::ExtractFirstInt(value, mgr_id) )
				{
					ErrorMessage("Error while reading file.  "
						"Expected a manager ID integer after \"manager ID, manager name\""
						"comment in RESULTS DISPLAY section.");
					return FALSE;
				}

				mgr_name = value;

				SelectManagerByName( bar_number, mgr_name, mgr_id );
			}
			else if ( bar_item.CompareNoCase("worker ID, worker name") == 0 )
			{
				CString wkr_name;
				int wkr_id;

				if ( !ICF_ifstream::ExtractFirstInt(value, wkr_id) )
				{
					ErrorMessage("Error while reading file.  "
						"Expected a worker ID integer after \"worker ID, worker name\""
						"comment in RESULTS DISPLAY section.");
					return FALSE;
				}

				wkr_name = value;

				SelectWorkerByName( bar_number, wkr_name, wkr_id );
			}
			else
			{
				CString str;
				str.Format("%d",bar_number);
				ErrorMessage( "Invalid bar chart item name \""
					+ bar_item + "\" for bar #" + str 
					+ " in RESULTS DISPLAY section.  Ignoring this bar "
					+ "setting." );
				continue;
			}
		}
		else
		{
			ErrorMessage("File is improperly formatted.  RESULTS DISPLAY "
				"section contained an unrecognized \"" + key + "\" comment.");
			return FALSE;
		}
	}

	infile.close();

	// Update the GUI with the values read in from the file.
	UpdateData( FALSE );

	return TRUE;
}