Пример #1
0
  void GameScreenManager::Init (const ScreenType& screenType)
  {
    for (const auto& it : screens_)
      it.second->Init ();

    SetCurrentScreen (screenType);
  }
Пример #2
0
bool intern initmonitor()
/***********************/
{
    WORD height, width;

    ScreenHandle = CreateScreen( uigetscreenname(),
                        DONT_CHECK_CTRL_CHARS | AUTO_DESTROY_SCREEN );
    if( ScreenHandle == -1 ) {
        return( FALSE );
    }
    SetCurrentScreen( ScreenHandle );

    SetPositionOfInputCursor( 0, 0 );
    HideInputCursor();

    DisplayScreen( ScreenHandle );

    if( UIData == NULL ) {
        UIData = &ui_data;
    }

    GetSizeOfScreen( &height, &width );

    UIData->height = (ORD) height;
    UIData->width  = (ORD) width;


/* IsColorMonitor doesn't seem to be working for NetWare 3.11 */
/* so we'll just assume a colour monitor for now. */

    if( IsColorMonitor( ) ){
        UIData->colour = M_CGA;
    } else {
        UIData->colour = M_MONO;
    } /* end if */

    return( TRUE );
}
Пример #3
0
void _FailMessage(const char* message, unsigned lineNum, const char * functionName, const char* sourceFileName)
{
	// This function shouldn't recurse
	static bool alreadyInThisFunction = false;
	if (alreadyInThisFunction)
		return;
	alreadyInThisFunction = true;

	sgp::dumpStackTrace(message);

	std::stringstream basicInformation;
	basicInformation << "Assertion Failure [Line " << lineNum;
	if (functionName) {
		basicInformation << " in function " << functionName;
	}
	basicInformation << " in file " << sourceFileName << "]";

	std::stringstream outputString;
	outputString << "{ " << GetTickCount() << " } " << basicInformation.str();

	//Build the output strings
	if( message )
		sprintf( gubAssertString, message );	
	else
		sprintf( gubAssertString, "" );

	//Output to debugger
	if (gfRecordToDebugger)
		OutputDebugString( outputString.str().c_str() );
	
	DbgMessage( TOPIC_GAME, DBG_LEVEL_1, outputString.str().c_str());

	//This will actually bring up a screen that prints out the assert message
	//until the user hits esc or alt-x.
	// WDS - Automatically try to save when an assertion failure occurs
	if (gGameExternalOptions.autoSaveOnAssertionFailure &&
		!alreadySaving) {
		sprintf( gubErrorText, "%s. Attempting to do a debug save as SaveGame%d.sav (this may fail)", basicInformation.str().c_str(), SAVE__ASSERTION_FAILURE );
	} else {
		sprintf( gubErrorText, "%s", basicInformation.str().c_str());
	}
	SetPendingNewScreen( ERROR_SCREEN );
	SetCurrentScreen( ERROR_SCREEN );

	// WDS - Automatically try to save when an assertion failure occurs
	if (gGameExternalOptions.autoSaveOnAssertionFailure &&
		!alreadySaving) {
		SaveGame( SAVE__ASSERTION_FAILURE, L"Assertion Failure Auto Save" );
	}

    MSG Message;
	while (gfProgramIsRunning)
	{
		if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
		{ // We have a message on the WIN95 queue, let's get it
			if (!GetMessage(&Message, NULL, 0, 0))
			{ // It's quitting time
				continue;
			}
			// Ok, now that we have the message, let's handle it
			TranslateMessage(&Message);
			DispatchMessage(&Message);      
		}
		else
		{ // Windows hasn't processed any messages, therefore we handle the rest
			GameLoop();        
			gfSGPInputReceived  =  FALSE;			
		}
	}

	alreadyInThisFunction = false;
	exit(0);
}
Пример #4
0
 void GameScreenManager::Run (const Time& dt, IDrawingContext& context)
 {
   SetCurrentScreen (currentScreen_->Run (dt, context));
 }