コード例 #1
0
ファイル: DecodeDlg.cpp プロジェクト: maiken2051/uudeview
void DecodeDlg::DecodePreview() 
{
	CString lfn;

	EngineSetup();

	decoder->PostThreadMessage(ENG_CLEAR, 1, 0);	// Clear any existing list (and reset control)

	m_DecodeGo.SetLabel(IDS_CANCELBUTTON);

	InfoClear();

	HourGlass(true);

	m_DecodeList.SetSel(-1, FALSE);			// Clear all selections

	int rmax = m_DecodeList.GetCount();

	if (rmax == 0)
		return;

	TransferOptions(&decoder->UD);						// Copy options to the control

	CWaitCursor wai;

	if (SHOW_DEBUG)
		deBox.Init(&debugPosn);

	CString cpath = CurrentOutput();

	for (int row=0; row < rmax; row++)		// Step through the whole list
	{
		m_DecodeList.GetText(row, lfn);		// Read the filename

		if (clipboardSet && lfn == clipboardString)
		{
			cFile.Close();				// Make sure the temp is closed

			decoder->PostThreadMessage(ENG_DECODE, row,
				(LPARAM) (strdup((const char *) cFile)));
		}
		else
			decoder->PostThreadMessage(ENG_DECODE, row,
				(LPARAM) (strdup((const char *) lfn)));
	}

	decoder->PostThreadMessage(ENG_LOAD, 0, 0);

}
void CUsingControllersView::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: Add your message handler code here
	// Do not call CView::OnPaint() for painting messages
	CUsingControllersDoc *Document = GetDocument();
	CEngine *Engine = ((CUsingControllersApp*)AfxGetApp())->m_Engine;
	if (Engine == NULL)
	  return;

	Ogre::Root *Root = Engine->GetRoot();

	if (m_First && Root != NULL)
    {
        m_First = false;
        EngineSetup();
    }

	if (Root != NULL)
    {
       Root->renderOneFrame();
	}
}
コード例 #3
0
void CSceneEditorView::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	CSceneEditorDoc *Document = GetDocument();
	CEngine *Engine = ((CSceneEditorApp*)AfxGetApp())->m_Engine;
	if (Engine == NULL)
	  return;

	m_Root = Engine->GetRoot();

	if (m_First && m_Root != NULL)
    {
        m_First = false;
        EngineSetup();
    }

	if (m_Root != NULL)
    {
		m_Root->startRendering();
	}

}
void CManualObjectView::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	CManualObjectDoc *Document = GetDocument();
	CEngine *Engine = ((CManualObjectApp*)AfxGetApp())->m_Engine;
	if (Engine == NULL)
	  return;

	Ogre::Root *Root = Engine->GetRoot();

	if (m_First && Root != NULL)
    {
        m_First = false;
        EngineSetup();
    }

	if (Root != NULL)
    {
       Root->renderOneFrame();
	}

}
void COrbitViewView::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	COrbitViewDoc *Document = GetDocument();
	CEngine *Engine = ((COrbitViewApp*)AfxGetApp())->m_Engine;
	if (Engine == NULL)
	  return;

	Ogre::Root *Root = Engine->GetRoot();

	if (m_First && Root != NULL)
    {
        m_First = false;
        EngineSetup();
    }

	if (Root != NULL)
    {
       Root->renderOneFrame();
	}	
	// Do not call CView::OnPaint() for painting messages
}
コード例 #6
0
ファイル: DecodeDlg.cpp プロジェクト: maiken2051/uudeview
void DecodeDlg::DecodeLaunch()
{
	LaunchDialog ld;

	int rmax = m_DecodeList.GetCount();

	if (rmax == 0)
		return;					// Nothing to do

	int scount = m_DecodeList.GetSelCount();	// Read number of selected items

	int *slist = (int *) _alloca(sizeof(int) * (scount + 1));	// Create the selection list
	int *eos = slist + scount;			// End

	m_DecodeList.GetSelItems(scount, slist);	// Read the selected items

	int *slp = slist;			// Point into the item list
	int *srchp;

	CFileName here, search, appname;

	CString here_ext;

	bool multi;					// Multiple

	int rc;

	if (!options[OPT_LNOPROMPT])
		while (scount > 0)
		{
			while (*slp == -1)		// Already handled
				slp++;				// Skip

			m_DecodeList.GetText(*slp, here.GetStr());	// Read a selected item's text

			here_ext = here.Ext();	// Read the extension

			multi = false;			// Start with multi off

			for (srchp=slp+1; srchp < eos; srchp++)
				if (*srchp != -1)
				{
					m_DecodeList.GetText(*srchp, search.GetStr());
					if (here_ext.CompareNoCase(search.Ext()) == 0)
					{
						multi = true;	// We've got more than one...
						break;
					}
				}

			rc = ld.GetLFN(here, multi, appname.GetStr(), launchList, &launchDir,
				&options[OPT_LNOPROMPT]);

			if (options[OPT_LNOPROMPT])
			{
				OptionButtonSet();
				break;				// User switched to no-prompt mode
			}

			switch (rc)
			{
				case IDCANCEL:		// Jump out
					return;

				case IDOK:
					multi = false;		// Only handle one
					break;

				case LDIAG_ALL:
					multi = true;		// Handle all
					break;
			}

			if (!EngineSetup())
				return;

			for (srchp=slp; srchp < eos; srchp++)
				if (*srchp != -1)
				{
					m_DecodeList.GetText(*srchp, search.GetStr());
					if (here_ext.CompareNoCase(search.Ext()) == 0)
					{
						struct Engine::EngineLaunch *ep = new struct Engine::EngineLaunch;
						MSG msg;

						ASSERT(ep != NULL);

						ep->app = appname;
						ep->filen = search;

						decoder->PostThreadMessage(ENG_LAUNCH, 0, (LPARAM) ep);

						m_DecodeList.SetSel(*srchp, FALSE);
						*srchp = -1;		// This one's been done
						scount--;			// One less selected

						if (!multi)			// Caller only wanted one 
							break;

						if (::PeekMessage(&msg, m_hWnd, ENG_DONE, ENG_DONE, PM_REMOVE)
								&& msg.wParam)
							break;			// Launch error
					}						// Ext match
				}							// Not already done

			slp++;							// At a minimum, advance 1
		}									// scount > 0, prompt mode

	if (options[OPT_LNOPROMPT] && EngineSetup())		// No prompt mode either initially or broke out from loop
		for (; slp < eos; slp++)
			if (*slp != -1)			// Hasn't been processed yet
			{
				m_DecodeList.GetText(*slp, search.GetStr());

				struct Engine::EngineLaunch *ep = new struct Engine::EngineLaunch;
				MSG msg;

				ASSERT(ep != NULL);

//				ep->app = appname;			// Don't set app name for straight launch
				ep->filen = search;

				decoder->PostThreadMessage(ENG_LAUNCH, 0, (LPARAM) ep);

				m_DecodeList.SetSel(*slp, FALSE);

				if (::PeekMessage(&msg, m_hWnd, ENG_DONE, ENG_DONE, PM_REMOVE)
						&& msg.wParam)
					break;			// Launch error

			}

}
コード例 #7
0
ファイル: UnitTesting.cpp プロジェクト: segrax/openfodder
bool cUnitTesting::RunTests(const std::string pCampaign) {
    bool Retry = false;
    g_Fodder->Game_Setup();

	if (g_Fodder->mStartParams->mUnitTesting && g_Fodder->mStartParams->mDemoPlayback) {
		g_Fodder->mStartParams->mSleepDelta = 0;
		g_Fodder->mParams->mSleepDelta = 0;
	}

    while (g_Fodder->mGame_Data.mMission_Current) {
        EngineSetup();
        setDemoName();

        std::string MissionTitle = getCurrentTestName();

        if (g_Fodder->mStartParams->mDemoRecord && !Retry) {
            if (g_ResourceMan->FileExists(g_Fodder->mStartParams->mDemoFile)) {
                g_Debugger->Notice("Test exists for " + MissionTitle + ", skipping");
                g_Fodder->mGame_Data.Phase_Next();
                continue;
            }
        }

        Retry = false;
        g_Debugger->TestStart(MissionTitle, g_Fodder->mStartParams->mCampaignName);

        if (g_Fodder->mStartParams->mDemoPlayback) {
            if (!g_Fodder->mStartParams->mDemoRecord) {
                if (!g_Fodder->Demo_Load()) {
                    g_Debugger->TestComplete(MissionTitle, g_Fodder->mStartParams->mCampaignName, "No test found", 0, eTest_Skipped);
                    g_Fodder->mGame_Data.Phase_Next();
                    continue;
                }
            }

            g_Fodder->mGame_Data.mDemoRecorded.playback();
        }

        // If demo is recording
        if (g_Fodder->mStartParams->mDemoRecord) {
            // And we have a resume cycle set
            if (g_Fodder->mStartParams->mDemoRecordResumeCycle) {
                g_Debugger->Notice("Resuming " + MissionTitle);
                g_Fodder->mParams->mSleepDelta = 0;
            }
            else {
                g_Fodder->mGame_Data.mDemoRecorded.clear();
                g_Debugger->Notice("Recording " + MissionTitle);
            }
        }

        // Reset demo status
		//g_Fodder->mParams->mSleepDelta = g_Fodder->mStartParams->mSleepDelta;
		g_Fodder->mParams->mDemoFile = g_Fodder->mStartParams->mDemoFile;
        g_Fodder->mParams->mDemoRecord = g_Fodder->mStartParams->mDemoRecord;
        g_Fodder->mParams->mDemoPlayback = g_Fodder->mStartParams->mDemoPlayback;
        g_Fodder->mParams->mAppVeyor = g_Fodder->mStartParams->mAppVeyor;
        // Keep game state
        g_Fodder->mGame_Data_Backup = g_Fodder->mGame_Data;

        // Run the phase
        auto missionStartTime = std::chrono::steady_clock::now();
        g_Fodder->Mission_Loop();
        auto missionDuration = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - missionStartTime);

        // If recording
        if (g_Fodder->mStartParams->mDemoRecord) {
            if (g_Fodder->mPhase_Complete) {
                g_Fodder->mGame_Data.mDemoRecorded.save();
            } else {

                Retry = true;
                // If the phase was aborted (ESC key), don't replay it.. start over
                if (!g_Fodder->mPhase_EscapeKeyAbort) {

                    // Less than 80 cycles, player can start over
                    if (g_Fodder->mGame_Data.mDemoRecorded.mTick > 80) {
                        g_Fodder->mStartParams->mDemoRecordResumeCycle = (g_Fodder->mGame_Data.mDemoRecorded.mTick - 80);
                        g_Fodder->mStartParams->mDemoPlayback = true;
                        
                        // Delete events occruing after resume cycle
                        g_Fodder->mGame_Data.mDemoRecorded.removeFrom(g_Fodder->mStartParams->mDemoRecordResumeCycle);
                        g_Fodder->mGame_Data_Backup.mDemoRecorded = g_Fodder->mGame_Data.mDemoRecorded;
                        // Disable video output for speed
                        g_Fodder->mStartParams->mDisableVideo = true;
                        g_Fodder->mStartParams->mDisableSound = true;
                    }
                }
                // Reset game to before start of phase
                g_Fodder->mGame_Data = g_Fodder->mGame_Data_Backup;
                continue;
            }
        }

        if (!g_Fodder->mPhase_Complete) {
            g_Debugger->TestComplete(MissionTitle, g_Fodder->mStartParams->mCampaignName, "Phase Failed", (size_t)missionDuration.count(), eTest_Failed);
            return false;
        }

        g_Debugger->TestComplete(MissionTitle, g_Fodder->mStartParams->mCampaignName, "Phase Complete", (size_t)missionDuration.count(), eTest_Passed);

        g_Fodder->mGame_Data = g_Fodder->mGame_Data_Backup;
        g_Fodder->mGame_Data.Phase_Next();
    }

    return true;
}