Пример #1
0
void EngineApp::SingleLoop( void )
   {
   static double fAppTime = 0.0;
   static double fAbsoluteTime = 0.0;
   static float  fElapasedTime = 0.0f;
   MsgProc();
   GetGlobalTimer()->GetTimeValues( &fAppTime, &fAbsoluteTime, &fElapasedTime );

   OnUpdateGame( fAppTime, fElapasedTime );

   OnFrameRender( fAppTime, fElapasedTime );
   }
Пример #2
0
//
// class GameCodeApp::PumpUntilMessage			- Chapter 10, page 295
//
int EngineApp::PumpUntilMessage( Uint32& eventEnd, Sint32& code )
{
   SDL_Event event;
	int currentTime = timeGetTime();
	for ( ;; )
	   {
      SDL_PumpEvents();
		if ( SDL_PeepEvents( &event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT ) > 0 )
		   {
         // it should be the event we want
			if ( event.type == eventEnd )
			   {
				SDL_PeepEvents( &event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT );
            eventEnd = event.user.type;
            code = event.user.code;
				break;
			   }
			else
			   {
            // Default processing
				MsgProc();
			   }
		   }
		else
		   {
			// Update the game views, but nothing else! ( actor & game logic state skipped ) 
			// Remember this is a modal screen.
			if ( m_pEngineLogic )
			   {
				double fAppTime = 0.0;
            double fAbsoluteTime = 0.0;
            float  fElapasedTime = 0.0f;
            GetGlobalTimer()->GetTimeValues( &fAppTime, &fAbsoluteTime, &fElapasedTime );
            m_pEngineLogic->VOnUpdate( fAppTime, fElapasedTime );
				OnFrameRender( fAppTime, fElapasedTime );
			   }
		   }
	}
	

	return 0;
}
Пример #3
0
//-------------------------------------------------------------------------------------------------
//      メインループです.
//-------------------------------------------------------------------------------------------------
void App::MainLoop()
{
    MSG msg = { 0 };

    while( WM_QUIT != msg.message )
    {
        auto gotMsg = PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE );

        if ( gotMsg )
        {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
        else
        {
            OnFrameMove();
            OnFrameRender();
        }
    }
}
Пример #4
0
void EngineApp::MainLoop( void )
   {
   double fAppTime = 0.0;
   double fAbsoluteTime = 0.0;
   float  fElapasedTime = 0.0f;
   while( true  )
      {
      MsgProc();
      if( !m_bIsRunning )
         {
         break;
         }
      GetGlobalTimer()->GetTimeValues( &fAppTime, &fAbsoluteTime, &fElapasedTime );

      OnUpdateGame( fAppTime, fElapasedTime );
      
      OnFrameRender( fAppTime, fElapasedTime );

      }

   OnClose();
   }
Пример #5
0
CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) : 
    wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN | wxBORDER_NONE)
{
    wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Overloaded Constructor Function Begin"));

    CSkinAdvanced*     pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();

    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));

    m_taskPanel = NULL;
    m_projPanel = NULL;
    m_oldWorkCount = 0;
    m_bNewNoticeAlert = false;
    m_bNoticesButtonIsRed = false;
    m_irefreshCount = 0;
    
	checkForNewNoticesTimer = new wxTimer(this, ID_SIMPLEMESSAGECHECKTIMER);
	checkForNewNoticesTimer->Start(5000); 

	dlgOpen = false;
    m_sSuspendString = _("Suspend");
    m_sResumeString = _("Resume");
    m_sSuspendButtonToolTip = _("Suspend Computing");
    m_sResumeButtonToolTip = _("Resume Computing");

	m_taskPanel = new CSimpleTaskPanel(this);
    m_projPanel = new CSimpleProjectPanel(this);

    // Box Sizer
    mainSizer = new wxBoxSizer(wxVERTICAL);
    mainSizer->AddSpacer(ADJUSTFORYDPI(68));
    mainSizer->Add(m_taskPanel, 1, wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_CENTER, SIDEMARGINS);
    mainSizer->AddSpacer(ADJUSTFORYDPI(8));
    mainSizer->Add(m_projPanel, 0, wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_CENTER, SIDEMARGINS);
    mainSizer->AddSpacer(ADJUSTFORYDPI(8));

	wxBoxSizer* buttonsSizer;
	buttonsSizer = new wxBoxSizer( wxHORIZONTAL );

	m_NoticesButton = new wxButton( this, ID_SGNOTICESBUTTON, _("Notices"), wxDefaultPosition, wxDefaultSize, 0 );
    m_NoticesButton->SetToolTip( _("Open a window to view notices from projects or BOINC"));
	buttonsSizer->Add( m_NoticesButton, 0, wxEXPAND | wxALIGN_LEFT, 0 );
    buttonsSizer->AddStretchSpacer();

    int suspendWidth, resumeWidth, y;
    GetTextExtent(m_sSuspendString, &suspendWidth, &y);
    GetTextExtent(m_sResumeString, &resumeWidth, &y);
    
    m_bIsSuspended = suspendWidth > resumeWidth;
    m_SuspendResumeButton = new wxButton( this, ID_SGSUSPENDRESUMEBUTTON, 
                            m_bIsSuspended ? m_sSuspendString : m_sResumeString,
                            wxDefaultPosition, wxDefaultSize, 0 );
    m_SuspendResumeButton->SetToolTip(wxEmptyString);
    
	buttonsSizer->Add( m_SuspendResumeButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
    buttonsSizer->AddStretchSpacer();

    m_HelpButton = new wxButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
	buttonsSizer->Add( m_HelpButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );

    wxString helpTip;
    helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str());
    m_HelpButton->SetToolTip(helpTip);

	mainSizer->Add( buttonsSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, 2 * SIDEMARGINS );
    mainSizer->AddSpacer(ADJUSTFORYDPI(10));

	SetSizer(mainSizer);
    Layout();
    
    mainSizer->Fit(GetParent());

    SetBackgroundBitmap();   

#ifdef __WXMAC__
    // Tell accessibility aids to ignore this panel (but not its contents)
    HIObjectSetAccessibilityIgnored((HIObjectRef)GetHandle(), true);
    
    if (compareOSVersionTo(10, 7) >= 0) {
        m_iRedRingRadius = 4;
    } else {
        m_iRedRingRadius = 12;
    }
#endif    

    m_SuspendResumeButton->Disable();

    OnFrameRender();

    wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Overloaded Constructor Function End"));
}