当前位置: 首页>>代码示例>>C++>>正文


C++ OnExit函数代码示例

本文整理汇总了C++中OnExit函数的典型用法代码示例。如果您正苦于以下问题:C++ OnExit函数的具体用法?C++ OnExit怎么用?C++ OnExit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OnExit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _T

bool EViacamApp::OnInit()
{     	
	// Call default behaviour
	if (!wxApp::OnInit()) return false;

/* ////@begin EViacamApp initialisation */
	// Remove the comment markers above and below this block
	// to make permanent changes to the code.

#if wxUSE_XPM
	wxImage::AddHandler(new wxXPMHandler);
#endif
#if wxUSE_LIBPNG
	wxImage::AddHandler(new wxPNGHandler);
#endif
#if wxUSE_LIBJPEG
	wxImage::AddHandler(new wxJPEGHandler);
#endif
#if wxUSE_GIF
	wxImage::AddHandler(new wxGIFHandler);
#endif		
/* ////@end EViacamApp initialisation */

// Set up globals
#ifndef NDEBUG
	// Assume project runs from src/ 
	eviacam::SetDataDir(wxGetCwd() + _T("/../doc/"));
#else
	eviacam::SetDataDir(wxStandardPaths::Get().GetDataDir());
#endif
	
	// Initialize sockets support
	// Note: (Workaround for implementation limitation for wxWidgets up to 2.5.x) 
	// If you want to use sockets or derived classes such as wxFTP in a secondary 
	// thread, call wxSocketBase::Initialize() (undocumented) from the main thread 
	// before creating any sockets - in wxApp::OnInit for example. 
	// See http://wiki.wxwidgets.org/wiki.pl?WxSocket or 
	// http://www.litwindow.com/knowhow/knowhow.html for more details.
	wxSocketBase::Initialize();

	m_pController= new CViacamController();
	assert (m_pController);
	if (!m_pController->Initialize()) 
	{
		OnExit();
		return false;
	}
	else return true;
}
开发者ID:rkvsraman,项目名称:eviacam,代码行数:49,代码来源:eviacamapp.cpp

示例2: DllMain

BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
            OnStartup();
            break;

        case DLL_PROCESS_DETACH:
            OnExit();
            break;
    }

    return TRUE;
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:15,代码来源:exchndl64.c

示例3: OnExit

/// Handles an entity leaving the Trigger area.
void RPG_Trigger::ProcessExit(VisBaseEntity_cl* entity)
{
  // check if this entity is in inside the trigger.
  int foundIndex = m_insideEntities.Find(entity);

  if(foundIndex > -1)
  {
    m_insideEntities.RemoveAt(foundIndex);

    OnExit(entity);
    if(m_onExitSource)
      m_onExitSource->TriggerAllTargets();
    TriggerScriptEvent("OnExit", "*o", entity);
  }
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:16,代码来源:Trigger.cpp

示例4: OnExit

void KG3DAnimationTagContainer::Clear()
{
	OnExit();

	SAFE_RELEASE(m_pClip);
    for (size_t i = 0; i < m_vecTags.size(); i++)
    {
        SAFE_DELETE(m_vecTags[i].pTag)
    }

	m_vecTags.clear();
    m_szAnimationName[0] = '\0';
    m_bModifyFlag = FALSE;
	m_IsLoaded = FALSE;
}
开发者ID:1suming,项目名称:pap2,代码行数:15,代码来源:KG3DAnimationTagContainer.cpp

示例5: OnExit

// Handles left click in main menu
void CApp::MenuClick(int mX, int mY)
{
    if(mY > 157 && mY < 213 && mX > 204 && mX < 398)
    {
        AIenabled = true;
        GameState = GAME_STATE_RUNNING;
    }
    if(mY > 273 && mY < 329 && mX > 204 && mX < 398)
    {
        AIenabled = false;
        GameState = GAME_STATE_RUNNING;
    }
    if(mY > 410 && mY < 466 && mX > 204 && mX < 398)
        OnExit();
}
开发者ID:Fenixp,项目名称:Tic-Tac-Toe-SDL,代码行数:16,代码来源:CApp.cpp

示例6: main

//------------------------------------------------------------  main()
//
int main(int argc, char **argv)
{		
	
	if ( !(subject_name = Parser(argc, argv)) ) 		// Parsea la linea de comandos: 	parser.c
		exit (1);			
	
	OnInit();						//Inicializa todo lo inicializable: sdlgl_control.h	
	
	ExperimentSetup(); 				//Configura el experimento
	MainLoop();						//Lanza el experimento propiamente dicho
	ExperimentSave();				//Salva los resultados en un archivo
	
	OnExit();						//Cierra limpiamente todico: sdlgl_control.h
	
	return APPSUCCESS;
}
开发者ID:jorjuato,项目名称:IORExperiments,代码行数:18,代码来源:main.c

示例7: OnStartup

void CThread::Action()
{
  try
  {
    OnStartup();
  }
  catch (const XbmcCommons::UncheckedException &e)
  {
    e.LogThrowMessage("OnStartup");
    if (IsAutoDelete())
      return;
  }
  catch (...)
  {
    LOG(LOGERROR, "%s - thread %s, Unhandled exception caught in thread startup, aborting. auto delete: %d", __FUNCTION__, m_ThreadName.c_str(), IsAutoDelete());
    if (IsAutoDelete())
      return;
  }

  try
  {
    Process();
  }
  catch (const XbmcCommons::UncheckedException &e)
  {
    e.LogThrowMessage("Process");
  }
  catch (...)
  {
    LOG(LOGERROR, "%s - thread %s, Unhandled exception caught in thread process, aborting. auto delete: %d", __FUNCTION__, m_ThreadName.c_str(), IsAutoDelete());
  }

  try
  {
    OnExit();
  }
  catch (const XbmcCommons::UncheckedException &e)
  {
    e.LogThrowMessage("OnExit");
  }
  catch (...)
  {
    LOG(LOGERROR, "%s - thread %s, Unhandled exception caught in thread OnExit, aborting. auto delete: %d", __FUNCTION__, m_ThreadName.c_str(), IsAutoDelete());
  }
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:45,代码来源:Thread.cpp

示例8: switch

void CEvent::OnEvent(SDL_Event* Event)
{
  switch(Event->type) {
    case SDL_QUIT: 
      OnExit();			//funzione definita in game.h e implementata in game.cpp che setta a false la variabile running
      break;
      
    case SDL_KEYDOWN:
      if(Event->key.keysym.sym == SDLK_UP || Event->key.keysym.sym == SDLK_DOWN || Event->key.keysym.sym == SDLK_LEFT || Event->key.keysym.sym == SDLK_RIGHT )
	ArrowPressed(Event->key.keysym.sym);
      break;
    
    case SDL_KEYUP:
      if(Event->key.keysym.sym == SDLK_UP || Event->key.keysym.sym == SDLK_DOWN || Event->key.keysym.sym == SDLK_LEFT || Event->key.keysym.sym == SDLK_RIGHT )
	ArrowReleased();
      break;
  }
}
开发者ID:elrod,项目名称:moonlander-clone,代码行数:18,代码来源:Cevent.cpp

示例9: wxCHECK_RET

void wxEventLoop::Exit(int rc)
{
    wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") );

    m_exitcode = rc;
    m_shouldExit = true;

    OnExit();

    // all we have to do to exit from the loop is to (maybe) wake it up so that
    // it can notice that Exit() had been called
    //
    // in particular, we do *not* use PostQuitMessage() here because we're not
    // sure that WM_QUIT is going to be processed by the correct event loop: it
    // is possible that another one is started before this one has a chance to
    // process WM_QUIT
    ::PostMessage(NULL, WM_NULL, 0, 0);
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:18,代码来源:evtloop.cpp

示例10: while

int wxQtEventLoopBase::DoRun()
{
    int ret;

    // This is placed inside of a loop to take into account nested event loops
    while ( !m_shouldExit )
    {
        // This will print Qt warnins if app already started:
        // "QCoreApplication::exec: The event loop is already running"
        // TODO: check the loopLevel (nested) like in wxGTK
        ret = QCoreApplication::exec();
        // process pending events (if exec was started previously)
        // TODO: use a real new QEventLoop() ?
        QCoreApplication::processEvents();
    }
    OnExit();
    return ret;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:18,代码来源:evtloop.cpp

示例11: wxASSERT_MSG

void wxThread::Exit(ExitCode status)
{
    wxASSERT_MSG( This() == this,
                  _T("wxThread::Exit() can only be called in the context of the same thread") );

    if ( m_isDetached )
    {
        // from the moment we call OnExit(), the main program may terminate at
        // any moment, so mark this thread as being already in process of being
        // deleted or wxThreadModule::OnExit() will try to delete it again
        ScheduleThreadForDeletion();
    }

    // don't enter m_critsect before calling OnExit() because the user code
    // might deadlock if, for example, it signals a condition in OnExit() (a
    // common case) while the main thread calls any of functions entering
    // m_critsect on us (almost all of them do)
    OnExit();

    // delete C++ thread object if this is a detached thread - user is
    // responsible for doing this for joinable ones
    if ( m_isDetached )
    {
        // FIXME I'm feeling bad about it - what if another thread function is
        //       called (in another thread context) now? It will try to access
        //       half destroyed object which will probably result in something
        //       very bad - but we can't protect this by a crit section unless
        //       we make it a global object, but this would mean that we can
        //       only call one thread function at a time :-(
        DeleteThread(this);
        pthread_setspecific(gs_keySelf, 0);
    }
    else
    {
        m_critsect.Enter();
        m_internal->SetState(STATE_EXITED);
        m_critsect.Leave();
    }

    // terminate the thread (pthread_exit() never returns)
    pthread_exit(status);

    wxFAIL_MSG(_T("pthread_exit() failed"));
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:44,代码来源:threadpsx.cpp

示例12: switch

void cEvent::OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode)
{
    switch (sym)
    {
        case SDLK_ESCAPE:
        {
            OnExit();
            break;
        }
        case SDLK_RETURN:
        {
            if ((SDLK_RETURN) && ((mod & KMOD_ALT)))
            {
                sysToggleFullScreen();
            }
            break;
        }
    }
}
开发者ID:sdlSokoban,项目名称:sdlSokoban,代码行数:19,代码来源:cEvent.cpp

示例13: ScheduleExit

    // sets the "should exit" flag and wakes up the loop so that it terminates
    // soon
    void ScheduleExit( int rc = 0 )
    {
        wxCHECK_RET( IsInsideRun(), wxT("can't call ScheduleExit() if not running") );

        m_exitcode = rc;
        m_shouldExit = true;

        OnExit();

        // all we have to do to exit from the loop is to (maybe) wake it up so that
        // it can notice that Exit() had been called
        //
        // in particular, do *not* use here calls such as PostQuitMessage() (under
        // MSW) which terminate the current event loop here because we're not sure
        // that it is going to be processed by the correct event loop: it would be
        // possible that another one is started and terminated by mistake if we do
        // this
        WakeUp();
    }
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:21,代码来源:dialog_shim.cpp

示例14: UpperLeft

void CreditsWnd::Render() {
    if (!m_render)
        return;
    GG::Pt ul = UpperLeft(), lr = LowerRight();
    if (m_display_list_id == 0) {
        // compile credits
        m_display_list_id = glGenLists(1);
        glNewList(m_display_list_id, GL_COMPILE);
        DrawCredits(ul.x + m_cx, ul.y + m_cy, ul.x + m_cx + m_cw, ul.y + m_cy + m_ch, 255);
        glEndList();
    }
    //time passed
    int ticks_delta = GG::GUI::GetGUI()->Ticks() - m_start_time + m_scroll_offset;

    //draw background
    GG::FlatRectangle(ul, lr, GG::FloatClr(0.0f, 0.0f, 0.0f, 0.5f), GG::CLR_ZERO, 0);

    glPushAttrib(GL_ALL_ATTRIB_BITS);
    glPushMatrix();

    // define clip area
    glEnable(GL_SCISSOR_TEST);
    glScissor(Value(ul.x + m_cx), Value(GG::GUI::GetGUI()->AppHeight() - lr.y), m_cw, m_ch);

    // move credits
    glTranslatef(0, m_co - ticks_delta/40, 0);

    if (m_display_list_id != 0) {
        // draw credits using prepared display list
        // !!! in order for the display list to be valid, the font object (m_font) may not be destroyed !!!
        glCallList(m_display_list_id);
    } else {
        // draw credits directly
        DrawCredits(ul.x + m_cx, ul.y + m_cy, ul.x + m_cx + m_cw, ul.y + m_cy + m_ch, 255);
    }

    glPopMatrix();
    glPopAttrib();

    //check if we are done
    if (m_credits_height + m_ch < m_co + ticks_delta/40)
        OnExit();
}
开发者ID:mel-odious,项目名称:freeorion,代码行数:43,代码来源:IntroScreen.cpp

示例15: switch

//---------------------------------------------------------------------------
void CApp::OnEvent(SDL_Event *Event) {

    switch(Event->type) {

        case SDL_QUIT: {
            OnExit();
            break;
        }

        case SDL_KEYDOWN: {
            Snake->onEvent(Event);
            break;
        }

        default: {
            break;
        }
    }
}
开发者ID:rokusjar,项目名称:Had,代码行数:20,代码来源:CApp_OnEvent.cpp


注:本文中的OnExit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。