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


C++ HandleEvent函数代码示例

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


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

示例1: onActivityEvent

 void onActivityEvent(int inVal)
 {
     __android_log_print(ANDROID_LOG_INFO, "NME", "Activity action %d", inVal);
     if (inVal==1 || inVal==2)
     {
         Event evt( inVal==1 ? etActivate : etDeactivate );
         HandleEvent(evt);
     }
 }
开发者ID:bbeaulant,项目名称:NME,代码行数:9,代码来源:AndroidFrame.cpp

示例2:

bool EdgeBarrierController::Impl::HandleEventCB(XEvent xevent, void* data)
{
  auto edge_barrier_controller = static_cast<EdgeBarrierController::Impl*>(data);
  int const xi2_opcode = edge_barrier_controller->xi2_opcode_;

  if (xevent.type != GenericEvent || xevent.xcookie.extension != xi2_opcode)
    return false;

  return edge_barrier_controller->HandleEvent(xevent);
}
开发者ID:foer,项目名称:linuxmuster-client-unity,代码行数:10,代码来源:EdgeBarrierController.cpp

示例3: e

// == OIS INPUT ==
bool Client::mouseMoved(const OIS::MouseEvent &arg) {
    if(!mGameStateManager.GetCurrentState()->GetGUI()->injectMouseMove(arg.state.X.abs, arg.state.Y.abs, arg.state.Z.abs)) {
        Event e("input:mouse:moved");
        e.WriteData(arg.state.buttonDown(OIS::MB_Left));
        e.WriteData(arg.state.buttonDown(OIS::MB_Right));
        e.WriteData(arg.state.X.rel);
        e.WriteData(arg.state.Y.rel);
        HandleEvent(e);
    }
}
开发者ID:opatut,项目名称:chars,代码行数:11,代码来源:Client.cpp

示例4: SDL_GetTicks

void Client::MainLoop(void)
{
    GLenum statusGL;
    SDL_Event event;
    Uint32 ticks0 = SDL_GetTicks(), ticks;
    float dt;
    char errorString[260];

    while (!done)
    {
#ifdef DEBUG
        // Check for openGL errors
        while ((statusGL = glGetError()) != GL_NO_ERROR)
        {
            GLErrorString(errorString, statusGL);
            fprintf (stderr, "GL Error during main loop: %s\n", errorString);
        }
#endif // DEBUG

        // Handle all events in queue
        SDL_Event event;
        while (SDL_PollEvent (&event)) {

            HandleEvent (&event);
        }

        while(SDLNet_UDP_Recv(udp_socket, fromServer))
        {
            if (fromServer->address.host == serverAddress.host &&
                fromServer->address.port == serverAddress.port)
            {
                if(pScene)
                    pScene->OnServerMessage (fromServer->data, fromServer->len);
            }
        }

        // determine how much time passed since last iteration:
        ticks = SDL_GetTicks();
        dt = float(ticks - ticks0) / 1000;
        ticks0 = ticks;

        if (dt > 0.05f)
            dt = 0.05f;

        if (pScene)
        {
            pScene->Update (dt);
            pScene->Render ();
        }

        // Show whatever is rendered in the main window
        SDL_GL_SwapWindow (mainWindow);
    }
}
开发者ID:cbaakman,项目名称:game-templates,代码行数:54,代码来源:client.cpp

示例5: while

bool
X11EventQueue::OnFileEvent(FileDescriptor fd, unsigned mask)
{
  while(XPending(display)) {
    XEvent event;
    XNextEvent(display, &event);
    HandleEvent(event);
  }

  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:11,代码来源:X11Queue.cpp

示例6: lock

void AsyncRequests::PullEventsInternal()
{
  // This is only called if the queue isn't empty.
  // So just flush the pipeline to get accurate results.
  g_vertex_manager->Flush();

  std::unique_lock<std::mutex> lock(m_mutex);
  m_empty.Set();

  while (!m_queue.empty())
  {
    Event e = m_queue.front();

    // try to merge as many efb pokes as possible
    // it's a bit hacky, but some games render a complete frame in this way
    if ((e.type == Event::EFB_POKE_COLOR || e.type == Event::EFB_POKE_Z))
    {
      m_merged_efb_pokes.clear();
      Event first_event = m_queue.front();
      const auto t = first_event.type == Event::EFB_POKE_COLOR ? EFBAccessType::PokeColor :
                                                                 EFBAccessType::PokeZ;

      do
      {
        e = m_queue.front();

        EfbPokeData d;
        d.data = e.efb_poke.data;
        d.x = e.efb_poke.x;
        d.y = e.efb_poke.y;
        m_merged_efb_pokes.push_back(d);

        m_queue.pop();
      } while (!m_queue.empty() && m_queue.front().type == first_event.type);

      lock.unlock();
      g_renderer->PokeEFB(t, m_merged_efb_pokes.data(), m_merged_efb_pokes.size());
      lock.lock();
      continue;
    }

    lock.unlock();
    HandleEvent(e);
    lock.lock();

    m_queue.pop();
  }

  if (m_wake_me_up_again)
  {
    m_wake_me_up_again = false;
    m_cond.notify_all();
  }
}
开发者ID:AdmiralCurtiss,项目名称:dolphin,代码行数:54,代码来源:AsyncRequests.cpp

示例7: while

void Demo::Loop() {

    while (Running)
    {
        // message processing loop
        while(SDL_PollEvent(&event)) {
            HandleEvent(&event);
        }

        Render();
    }
}
开发者ID:rusticmystic,项目名称:demo_sources,代码行数:12,代码来源:main.cpp

示例8: while

int CBPlatform::MessageLoop()
{
	bool done = false;

	while (!done)
	{
		SDL_Event event;
		while (SDL_PollEvent(&event))
		{
			HandleEvent(&event);
		}

		if(Game && Game->m_Renderer->m_Active && Game->m_Renderer->m_Ready)
		{

			Game->DisplayContent();
			Game->DisplayQuickMsg();

			Game->DisplayDebugInfo();
			Game->m_Renderer->SendRenderingHintSceneComplete();

			// ***** flip
			
			if(!Game->m_SuspendedRendering) Game->m_Renderer->Flip();
			if(Game->m_Loading) Game->LoadGame(Game->m_ScheduledLoadSlot);
		}
		if(Game->m_Quitting) break;

	}

	if(Game)
	{
		// remember previous window position
		/*
		if(Game->m_Renderer && Game->m_Renderer->m_Windowed)
		{
			if(!::IsIconic(Game->m_Renderer->m_Window))
			{
				int PosX = Game->m_Renderer->m_WindowRect.left;
				int PosY = Game->m_Renderer->m_WindowRect.top;
				PosX -= Game->m_Renderer->m_MonitorRect.left;
				PosY -= Game->m_Renderer->m_MonitorRect.top;

				Game->m_Registry->WriteInt("Video", "WindowPosX", PosX);
				Game->m_Registry->WriteInt("Video", "WindowPosY", PosY);
			}
		}
		*/

		SAFE_DELETE(Game);
	}
	return 0;
}
开发者ID:segafan,项目名称:wmelite_jankavan-julia-repo,代码行数:53,代码来源:PlatformSDL.cpp

示例9: SDL_IsTextInputActive

bool InputEventController::OnKeyPressed(const SDL_KeyboardEvent& arg)
{
	SDL_Keycode kc = arg.keysym.sym;
	auto textInputActive = SDL_IsTextInputActive();

	if (textInputActive) {
		SDL_Keycode nkc = kc;

		// Map numpad enter to the "normal" enter so action subscribers don't need to
		// check for both.
		if (nkc == SDLK_KP_ENTER)
			nkc = SDLK_RETURN;

		switch (nkc) {
			case SDLK_BACKSPACE:
			case SDLK_RETURN:
				// For now, key_t values are mapped directly to SDL keycodes for
				// convenience.
				(*actions.ui.control)(static_cast<TextControl::key_t>(nkc));
				break;
		}
	}

	// make left and right modifiers equal
	if (kc == SDLK_RSHIFT)
		kc = SDLK_LSHIFT;
	else if (kc == SDLK_RCTRL)
		kc = SDLK_LCTRL;
	else if (kc == SDLK_RGUI)
		kc = SDLK_LGUI;

	// Hotkeys are fired in addition to the normal bound action, but we don't
	// want to interfere with text input.
	if (!textInputActive) {
		auto iter = hotkeys.find(kc);
		if (iter != hotkeys.end()) {
			(*(iter->second))(1);
		}
	}

	auto hash = HashKeyboardEvent(kc);

	// Flip the meaning of menuNext if shift is held down.
	if (IsMapActive(ActionMapId::MENU) &&
		hash == actions.ui.menuNext->GetPrimaryTrigger() &&
		(SDL_GetModState() & KMOD_SHIFT))
	{
		hash = actions.ui.menuPrev->GetPrimaryTrigger();
	}

	HandleEvent(hash, 1);
	return true;
}
开发者ID:HoverRace,项目名称:HoverRace,代码行数:53,代码来源:Controller.cpp

示例10: main

void main()
{
	FATFS fs;
	FIL file;

	InitMCU();
	//VS_SinTest(0x74);
	VS_Init();

	if(disk_initialize(0))
		ConsoleWrite("Disk Initialization FAILED. :(\n");
	else
		ConsoleWrite("Disk Initialization Complete.\n");

	if(f_mount(0,&fs))
		ConsoleWrite("Mount FieSystem Failed\n");
	else
		ConsoleWrite("Mount FileSystem Success!\n");

	ConsoleWrite("Scaning Music Files...\n\n");
	if(scan_files("/",&(Player.TotalSongNum)))
		ConsoleWrite("Scan Files Failed\n");
	else{
		ConsoleWrite("\nScan Files Accomplished.\ntotal files: ");
		ConsolePutUInt (Player.TotalSongNum);
		ConsoleWrite ("\n\n");}

	if(scan_files_open (&file,"/",1))       // Start node to be scanned and opened
		ConsoleWrite("Open File Error\n");  //Playing mp3/track001.mp3 ... will apear in function		

	
	Player.currFile	= &file;
	Player.SongNum	= 1;
	Player.Status	= PS_PLAYING;
	Player.Mode		= SM_SONG;
	Player.Volume	= 170;
	Player.Bass		= 7;
	Player.Treble	= 0;

	VS_SetBassTreble(Player.Bass,Player.Treble);

	BufCnt = 0;
//	GenerateEvent(EV_BUFEMPTY);

	//Main loop
	while(1)
	{
		//Get system event
		Player.Event = GetEvent();
		//Handle Events
		HandleEvent();
	}
}
开发者ID:solokacher,项目名称:iCandle,代码行数:53,代码来源:player.c

示例11: HandleEvent

	bool SDLApplication::Update () {
		
		SDL_Event event;
		event.type = -1;
			
		if (active && (firstTime || SDL_WaitEvent (&event))) {
			
			firstTime = false;
			
			HandleEvent (&event);
			event.type = -1;
			if (!active)
				return active;
			
			if (SDL_PollEvent (&event)) {
				
				HandleEvent (&event);
				event.type = -1;
				
			}
			
			currentUpdate = SDL_GetTicks ();
			
			if (currentUpdate >= nextUpdate) {
				
				SDL_RemoveTimer (timerID);
				OnTimer (0, 0);
				
			} else if (!timerActive) {
				
				timerActive = true;
				timerID = SDL_AddTimer (nextUpdate - currentUpdate, OnTimer, 0);
				
			}
			
		}
		
		return active;
		
	}
开发者ID:GumbertGumbert,项目名称:lime,代码行数:40,代码来源:SDLApplication.cpp

示例12: EntryPointFunc

DllExport 
PF_Err 
EntryPointFunc (	
	PF_Cmd				cmd,
	PF_InData			*in_data,
	PF_OutData			*out_data,
	PF_ParamDef			*params[],
	PF_LayerDef			*output,
	void				*extra)
{
	PF_Err		err = PF_Err_NONE;
	
	try {
		switch (cmd) {

		case PF_Cmd_ABOUT:
			err = About(in_data, out_data, params, output);
			break;

		case PF_Cmd_GLOBAL_SETUP:
			err = GlobalSetup(	in_data, out_data, params, output);
			break;

		case PF_Cmd_PARAMS_SETUP:
			err = ParamsSetup(	in_data, out_data, params, output);
			break;

		case PF_Cmd_RENDER:
			err = Render(	in_data, out_data, params, output);
			break;

		case PF_Cmd_EVENT:
			err = HandleEvent(	in_data, out_data, params, output, reinterpret_cast<PF_EventExtra*>(extra));
			break;

		case PF_Cmd_ARBITRARY_CALLBACK:
			err = HandleArbitrary(	in_data, out_data, params, output, reinterpret_cast<PF_ArbParamsExtra*>(extra));
			break;
			
		case  PF_Cmd_SMART_PRE_RENDER:
			err = PreRender(in_data, out_data, reinterpret_cast<PF_PreRenderExtra*>(extra));
			break;

		case  PF_Cmd_SMART_RENDER:
			err = SmartRender(	in_data, out_data, reinterpret_cast<PF_SmartRenderExtra*>(extra));
			break;
		}
	} catch (PF_Err &thrown_err) {
		err = thrown_err;
	}
	return err;
}
开发者ID:KAndQ,项目名称:AEPlugins,代码行数:52,代码来源:ColorGrid.cpp

示例13: while

int OPLMIDIDevice::PlayTick()
{
	DWORD delay = 0;

	while (delay == 0 && Events != NULL)
	{
		DWORD *event = (DWORD *)(Events->lpData + Position);
		if (MEVT_EVENTTYPE(event[2]) == MEVT_TEMPO)
		{
			SetTempo(MEVT_EVENTPARM(event[2]));
		}
		else if (MEVT_EVENTTYPE(event[2]) == MEVT_LONGMSG)
		{ // Should I handle master volume changes?
		}
		else if (MEVT_EVENTTYPE(event[2]) == 0)
		{ // Short MIDI event
			int status = event[2] & 0xff;
			int parm1 = (event[2] >> 8) & 0x7f;
			int parm2 = (event[2] >> 16) & 0x7f;
			HandleEvent(status, parm1, parm2);
		}

		// Advance to next event.
		if (event[2] < 0x80000000)
		{ // Short message
			Position += 12;
		}
		else
		{ // Long message
			Position += 12 + ((MEVT_EVENTPARM(event[2]) + 3) & ~3);
		}

		// Did we use up this buffer?
		if (Position >= Events->dwBytesRecorded)
		{
			Events = Events->lpNext;
			Position = 0;

			if (Callback != NULL)
			{
				Callback(MOM_DONE, CallbackData, 0, 0);
			}
		}

		if (Events == NULL)
		{ // No more events. Just return something to keep the song playing
		  // while we wait for more to be submitted.
			return int(Division);
		}

		delay = *(DWORD *)(Events->lpData + Position);
	}
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:52,代码来源:music_opl_mididevice.cpp

示例14: HandleEvent

void wxAppConsoleBase::CallEventHandler(wxEvtHandler *handler,
                                        wxEventFunctor& functor,
                                        wxEvent& event) const
{
    // If the functor holds a method then, for backward compatibility, call
    // HandleEvent():
    wxEventFunction eventFunction = functor.GetMethod();

    if ( eventFunction )
        HandleEvent(handler, eventFunction, event);
    else
        functor(handler, event);
}
开发者ID:jonntd,项目名称:dynamica,代码行数:13,代码来源:appbase.cpp

示例15: HandleEvent

GUI_Status Window::EventLoop( void ) {
  SDL_Event event;
  GUI_Status rc;

  do {
    rc = view->FetchEvent( event );

    if ( (rc != GUI_QUIT) && (rc != GUI_ERROR) )
      rc = HandleEvent( event );
  } while ( rc == GUI_OK );

  return rc;
}
开发者ID:drodin,项目名称:Crimson,代码行数:13,代码来源:window.cpp


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