本文整理汇总了C++中HandleEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ HandleEvent函数的具体用法?C++ HandleEvent怎么用?C++ HandleEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HandleEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: while
void GMApplication::Run()
{
bool quit = false;
SDL_Event e;
FrameTimer.start();
int oldticks = 0;
fps.start();
while( !quit )
{
//Handle events on queue
while( SDL_PollEvent( &e ) != 0 )
{
if( e.type == SDL_QUIT )
{
quit = true;
}
HandleEvent(e);
}
int tick = FrameTimer.getTicks();
Update((float)(tick - oldticks)/1000.f);
SDL_SetRenderDrawColor( Renderer, 0x00, 0x00, 0x00, 0xff);
SDL_RenderClear( Renderer );
Draw((float)(tick - oldticks)/1000.f);
SDL_RenderPresent( Renderer );
framecount++;
if (fps.getTicks() > 1000)
{
int FPS = framecount / (tick/1000.f);
if (Settings::Debug)
{
std::stringstream _fpstitle;
_fpstitle << Title << " FPS: " << FPS;
SDL_SetWindowTitle(Window,_fpstitle.str().c_str());
}
else
SDL_SetWindowTitle(Window, Title.c_str());
fps.start();
}
oldticks = tick;
}
}
开发者ID:GreenMist-Studios,项目名称:GreenMist,代码行数:51,代码来源:GMApplication.cpp
示例17: OnTouch
void OnTouch(int inType,double inX, double inY, int inID, float sizeX, float sizeY)
{
if (mSingleTouchID==NO_TOUCH || inID==mSingleTouchID || mMultiTouch)
{
EventType type = (EventType)inType;
if (!mMultiTouch)
{
switch(inType)
{
case etTouchBegin: type = etMouseDown; break;
case etTouchEnd: type = etMouseUp; break;
case etTouchMove : type = etMouseMove; break;
case etTouchTap: return; break;
}
}
Event mouse(type, inX, inY);
if (mSingleTouchID==NO_TOUCH || inID==mSingleTouchID || !mMultiTouch)
mouse.flags |= efPrimaryTouch;
if (inType==etTouchBegin)
{
if (mSingleTouchID==NO_TOUCH)
mSingleTouchID = inID;
mouse.flags |= efLeftDown;
mDownX = inX;
mDownY = inY;
}
else if (inType==etTouchEnd)
{
if (mSingleTouchID==inID)
mSingleTouchID = NO_TOUCH;
}
else if (inType==etTouchMove)
{
mouse.flags |= efLeftDown;
}
mouse.value = inID;
mouse.sx = sizeX;
mouse.sy = sizeY;
//if (inType==etTouchBegin)
//ELOG("DOWN %d %f,%f (%s) %f,%f", inID, inX, inY, (mouse.flags & efPrimaryTouch) ? "P":"S", sizeX, sizeY );
//if (inType==etTouchEnd)
//ELOG("UP %d %f,%f (%s) %f,%f", inID, inX, inY, (mouse.flags & efPrimaryTouch) ? "P":"S", sizeX, sizeY );
HandleEvent(mouse);
}
}
开发者ID:madrazo,项目名称:openfl-native-p8,代码行数:51,代码来源:AndroidFrame.cpp
示例18: MyPrivateEventProc
static pascal void MyPrivateEventProc( const NavEventCallbackMessage callbackSelector,
NavCBRecPtr callbackParms,
NavCallBackUserData callbackUD )
{
switch ( callbackSelector )
{
case kNavCBEvent:
{
switch (callbackParms->eventData.eventDataParms.event->what)
{
case updateEvt:
case activateEvt:
HandleEvent(callbackParms->eventData.eventDataParms.event);
break;
}
}
break;
case kNavCBUserAction:
{
if ( callbackParms->userAction == kNavUserActionOpen )
{
// This is an open files action, send an AppleEvent
NavReplyRecord reply;
OSStatus status;
status = NavDialogGetReply( callbackParms->context, &reply );
if ( status == noErr )
{
SendOpenAE( reply.selection );
NavDisposeReply( &reply );
}
}
}
break;
case kNavCBTerminate:
{
if ( callbackParms->context == gOpenFileDialog )
{
NavDialogDispose( gOpenFileDialog );
gOpenFileDialog = NULL;
}
// if after dismissing the dialog SimpleText has no windows open (so Activate event will not be sent) -
// call AdjustMenus ourselves to have at right menus enabled
if (FrontWindow() == nil) AdjustMenus(nil, true, false);
}
break;
}
}
开发者ID:fruitsamples,项目名称:SimpleText,代码行数:51,代码来源:NavigationServicesSupport.c
示例19: HandleEvent
void GUIMgr::Update(a_uint64 t_diff)
{
/**/
if(m_veEvents.empty() || m_vwWidget.empty())
return;
for(a_uint32 i = 0; i < m_veEvents.size(); i++)
{
HandleEvent(m_veEvents[i]);
}
m_veEvents.clear();
}
开发者ID:Agamand,项目名称:AgmdEngine,代码行数:14,代码来源:GUIMgr.cpp
示例20: abs
bool InputEventController::OnMouseMoved(const SDL_MouseMotionEvent& evt)
{
int x = evt.xrel;
int y = evt.yrel;
int ax = abs(x);
int ay = abs(y);
if (ax > 0)
HandleEvent(HashMouseAxisEvent(AXIS_X, (x > 0) ? 1 : 0), ax);
if (ay > 0)
HandleEvent(HashMouseAxisEvent(AXIS_Y, (y > 0) ? 1 : 0), ay);
// For some events (e.g. mouse wheel), we want to pass the mouse position
// but the SDL event doesn't pass it along. So, we just keep track of the
// last recorded mouse position and use that.
mousePos.x = evt.x;
mousePos.y = evt.y;
(*actions.ui.mouseMoved)(mousePos);
return true;
}
开发者ID:HoverRace,项目名称:HoverRace,代码行数:23,代码来源:Controller.cpp
注:本文中的HandleEvent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论