Exemple #1
0
	void StateEditorMode::EditorModeMouseActivity()
	{
		if(GetEvent()->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN)
		{
			switch(GetEvent()->mouse.button)
			{
				case 1:
					SetLeftMouseDown(true);
					break;
				case 2:
					SetRightMouseDown(true);
					SetRightMousePos(GetMouseCursorX(),GetMouseCursorY());
					GetMap()->SetOldMapXOffset(GetMap()->GetMapXOffset());
					GetMap()->SetOldMapYOffset(GetMap()->GetMapYOffset());
					
					break;
			}
		}
		if(GetEvent()->type == ALLEGRO_EVENT_MOUSE_BUTTON_UP)
		{
			switch(GetEvent()->mouse.button)
			{
				case 1:
					SetLeftMouseDown(false);
					break;
				case 2:
					SetRightMouseDown(false);
					break;
			}
		}
	}
Exemple #2
0
u32 SetYAMLSequenceFromMapping(char ***dest, char *key, ctr_yaml_context *ctx, bool StoreKey)
{
	if(*dest){
		fprintf(stderr,"[RSF ERROR] %s already set\n",key);
		ctx->error = YAML_MEM_ERROR;
		return 0;
	}

	u32 ActualCount = 0;
	u32 SlotCount = 0;
	char **tmp = *dest;
	if(!CheckMappingEvent(ctx)) return 0;
	SlotCount = 10;
	tmp = malloc((SlotCount+1)*sizeof(char*));
	if(!tmp){
		ctx->error = YAML_MEM_ERROR;
		return 0;
	}	
	memset(tmp,0,(SlotCount+1)*sizeof(char*));
	GetEvent(ctx);
	if(ctx->error || ctx->done) return 0;
	if(!EventIsScalar(ctx)){
		fprintf(stderr,"[RSF ERROR] '%s' requires a value\n",key);
		ctx->error = YAML_BAD_FORMATTING;
		return 0;
	}
	
	
	if(!GetYamlStringSize(ctx)) return 0;
	u32 InitLevel = ctx->Level;
	while(ctx->Level == InitLevel){
		if(ctx->error || ctx->done) return 0;
		if(ctx->IsKey == StoreKey){
			tmp[ActualCount] = malloc(GetYamlStringSize(ctx)+1);
			memset(tmp[ActualCount],0,GetYamlStringSize(ctx)+1);
			memcpy(tmp[ActualCount],GetYamlString(ctx),GetYamlStringSize(ctx));
			ActualCount++;
			if(ActualCount >= SlotCount){ // if Exceeding Ptr capacity, expand buffer
				SlotCount = SlotCount*2;
				char **tmp1 = malloc((SlotCount+1)*sizeof(char*)); // allocate new buffer
				if(!tmp1){
					ctx->error = YAML_MEM_ERROR;
					return 0;
				}	
				memset(tmp1,0,(SlotCount+1)*sizeof(char*));
				for(u32 i = 0; i < ActualCount; i++) tmp1[i] = tmp[i]; // Transfer ptrs
				free(tmp); // free original buffer
				tmp = tmp1; // transfer main ptr
			}
		}
		FinishEvent(ctx);
		GetEvent(ctx);
	}
	FinishEvent(ctx);
	*dest = tmp; // Give main ptr to location
	return ActualCount++; // return number of strings
}
Exemple #3
0
bool EventsList::Contains(const gd::BaseEvent & eventToSearch, bool recursive) const
{
    for (std::size_t i = 0;i<GetEventsCount();++i)
    {
        if ( &GetEvent(i) == &eventToSearch) return true;
        if ( recursive && GetEvent(i).CanHaveSubEvents() && GetEvent(i).GetSubEvents().Contains(eventToSearch) )
            return true;
    }

    return false;
}
Exemple #4
0
	void StateGameMode::MouseActivity(){


		if(GetEvent()->type == ALLEGRO_EVENT_MOUSE_AXES)
		{			
			SetMouseCursorPos(GetEvent()->mouse.x-10,GetEvent()->mouse.y-10);
		}


		

	}
Exemple #5
0
//_____________________________________
Bool_t KVINDRAReconIdent::Analysis(void)
{
   //For each event we:
   //     perform primary event identification and calibration and fill tree

   fEventNumber = GetEvent()->GetNumber();
   if (GetEvent()->GetMult() > 0) {
      GetEvent()->IdentifyEvent();
      GetEvent()->CalibrateEvent();
   }
   fIdentTree->Fill();
   return kTRUE;
}
Exemple #6
0
	void StateEditorMode::KeyPress(){
		if(GetEvent()->type == ALLEGRO_EVENT_KEY_UP)
		{
			switch(GetEvent()->keyboard.keycode)
			{
				case ALLEGRO_KEY_ESCAPE:						
					SetStateDirection(EnumDLL::STATEDIRECTION::PUSH);
					SetNextState(new StateEditorMenu());
					break;
			}
		}
		editorOverLayController_->KeyBoardActivity(GetEvent());
	}
//-----------------------------------------------------------------------------
// Purpose: 
// Output : const char
//-----------------------------------------------------------------------------
const char *CChoreoEventWidget::GetLabelText( void )
{
	static char label[ 256 ];
	if ( GetEvent()->GetType() == CChoreoEvent::EXPRESSION )
	{
		sprintf( label, "%s : %s", GetEvent()->GetParameters(), GetEvent()->GetParameters2() );
	}
	else
	{
		strcpy( label, GetEvent()->GetParameters() );
	}

	return label;
}
Exemple #8
0
void SetBoolYAMLValue(bool *dest, char *key, ctr_yaml_context *ctx)
{
	GetEvent(ctx);
	if(ctx->error || ctx->done) return;
	if(!EventIsScalar(ctx)){
		fprintf(stderr,"[RSF ERROR] '%s' requires a value\n",key);
		ctx->error = YAML_BAD_FORMATTING;
		return;
	}
	if(!GetYamlStringSize(ctx)){
		fprintf(stderr,"[RSF ERROR] '%s' requires a value\n",key);
		ctx->error = YAML_BAD_FORMATTING;
		return;
	}
	
	if(casecmpYamlValue("true",ctx))
		*dest = true;
	else if(casecmpYamlValue("false",ctx))
		*dest = false;
	else{
		fprintf(stderr,"[RSF ERROR] Invalid '%s'\n",key);
		ctx->error = YAML_BAD_FORMATTING;
	}
	
	return;
	
}
Exemple #9
0
void SetSimpleYAMLValue(char **dest, char *key, ctr_yaml_context *ctx, u32 size_limit)
{
	if(*dest){
		fprintf(stderr,"[RSF ERROR] Item '%s' is already set\n",key);
		ctx->error = YAML_MEM_ERROR;
		return;
	}

	GetEvent(ctx);
	if(ctx->error || ctx->done) return;
	if(!EventIsScalar(ctx)){
		fprintf(stderr,"[RSF ERROR] '%s' requires a value\n",key);
		ctx->error = YAML_BAD_FORMATTING;
		return;
	}
	if(!GetYamlStringSize(ctx)) return;
	
	u32 size = GetYamlStringSize(ctx);
	if(size > size_limit && size_limit) size = size_limit;
	

	char *tmp = *dest;
	tmp = malloc(size+2);
	if(!tmp) {
		ctx->error = YAML_MEM_ERROR;
		return;
	}
	memset(tmp,0,size+2);
	memcpy(tmp,GetYamlString(ctx),size);	
	
	//printf("Setting %s to %s (size of %d)\n",key,GetYamlString(ctx),size);
	//printf("Check: %s & %x\n",tmp,tmp);
	*dest = tmp;
	
}
Exemple #10
0
bool WizardApp::SetString( const wchar_t* lpSection, const wchar_t* lpKey, const wchar_t* lpValue )
{
	std::wstring strCurValue;
	GetString(lpSection, lpKey, strCurValue, L"{EA93CC4C-E460-4465-AEC9-57F2A8A348E1}");

	bool changed = false;
	if (lpValue != NULL)
	{
		if (strCurValue != lpValue)
		{
			changed = true;
		}
	}
	else
	{
		if (!strCurValue.empty())
		{
			changed = true;
		}
	}

	if (changed)
	{
		::WritePrivateProfileString(lpSection, lpKey, lpValue, m_strConfig.c_str());

		GetEvent()->FireConfigChange(lpSection, lpKey, lpValue);
	}

	return true;
}
void CChoreoGlobalEventWidget::DrawLabel( CChoreoWidgetDrawHelper& drawHelper, COLORREF clr, int x, int y, bool right )
{
	CChoreoEvent *event = GetEvent();
	if ( !event )
		return;

	int len = drawHelper.CalcTextWidth( "Arial", 9, FW_NORMAL, va( "%s", event->GetName() ) );

	RECT rcText;
	rcText.top = y;
	rcText.bottom = y + 10;
	rcText.left = x - len / 2;
	rcText.right = rcText.left + len;

	if ( !right )
	{
		drawHelper.DrawColoredTextCharset( "Marlett", 9, FW_NORMAL, SYMBOL_CHARSET, clr, rcText, "3" );
		OffsetRect( &rcText, 8, 0 );
		drawHelper.DrawColoredText( "Arial", 9, FW_NORMAL, clr, rcText, va( "%s", event->GetName() ) );
	}
	else
	{
		drawHelper.DrawColoredText( "Arial", 9, FW_NORMAL, clr, rcText, va( "%s", event->GetName() ) );
		OffsetRect( &rcText, len, 0 );
		drawHelper.DrawColoredTextCharset( "Marlett", 9, FW_NORMAL, SYMBOL_CHARSET, clr, rcText, "4" );
	}
}
Exemple #12
0
void CalendarMgr::AppendEventsToCalendarPacketForPlayer(WorldPacket &data, Player *pPlayer)
{
   // TODO: There's gotta be a better way to do this
   size_t p_counter = data.wpos();
   uint32 counter = 0;
   data << uint32(counter);
   std::set<uint64> alreadyAdded;
   for (CalendarInviteMap::iterator itr = _inviteMap.begin(); itr != _inviteMap.end(); ++itr)
   {
       CalendarInvite invite = itr->second;
	   if (invite.target_guid == pPlayer->GetGUID())
       {
           if (alreadyAdded.find(invite.id) == alreadyAdded.end())
           {
               CalendarEvent *m_event = GetEvent(invite.id);
               data << uint64(m_event->id);                // event ID
               data << m_event->name;                      // event title
               data << uint32(m_event->type);              // event type
               data << uint32(m_event->time);              // event time as time bit field
               data << uint32(m_event->flags);             // event flags
               data << uint32(m_event->dungeonID);         // dungeon ID
               data.appendPackGUID(m_event->creator_guid); // creator guid
               alreadyAdded.insert(invite.id);
               counter++;
           }
       }
   }
   data.put<uint32>(p_counter, counter);             // update number of invites
}
Exemple #13
0
/*
===============
idEventLoop::RunEventLoop
===============
*/
int idEventLoop::RunEventLoop( bool commandExecution )
{
	sysEvent_t	ev;
	
	while( 1 )
	{
	
		if( commandExecution )
		{
			// execute any bound commands before processing another event
			cmdSystem->ExecuteCommandBuffer();
		}
		
		ev = GetEvent();
		
		// if no more events are available
		if( ev.evType == SE_NONE )
		{
			return 0;
		}
		ProcessEvent( ev );
	}
	
	return 0;	// never reached
}
Exemple #14
0
static void Flash()
{
#if 0               // FIXME
    FILE *animf;
    TEvent e;

    VVF_DrawFrame = DrawFlash;
    animf = GetAnimFile("flash");
    do {GetEvent(&e);} while (e.What != evNothing);
    DoneTimer();
    PlayVVF(animf);
    InitTimer();
    do {GetEvent(&e);} while (e.What != evNothing);
    fclose(animf);
#endif
}
Exemple #15
0
void MainLoop(Display *display)
{
    Event *e = NULL;
    while ((e = GetEvent(display))) {
        callbacks_call(display->callbacks, display, e);
    }
}
Exemple #16
0
static void nacl_processevents(int wait, int* mx, int* my, int* mb, int* k) {
  static unsigned int mousebuttons = 0;
  static unsigned int mousex = 100;
  static unsigned int mousey = 0;
  static int iflag = 0; /* FIXEM*/

  struct PpapiEvent* event = GetEvent(wait);
  if (event != NULL) {
    /* only support mouse events for now */
    switch (event->type) {
      default:
        break;
      case PP_INPUTEVENT_TYPE_MOUSEDOWN:
        mousebuttons |= ButtonToMask(event->button);
        break;
      case PP_INPUTEVENT_TYPE_MOUSEUP:
        mousebuttons &= ~ButtonToMask(event->button);
        break;
      case PP_INPUTEVENT_TYPE_MOUSEMOVE:
        mousex = event->position.x;
        mousey = event->position.y;
        break;
    }
    free(event);
  }

  *mx = mousex;
  *my = mousey;
  *mb = mousebuttons;
  *k = iflag;
}
void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
{
    CalendarEvent* calendarEvent = GetEvent(invite.GetEventId());
    time_t statusTime = invite.GetStatusTime();
    bool hasStatusTime = statusTime != 946684800;   // 01/01/2000 00:00:00

    ObjectGuid invitee = invite.GetInviteeGUID();
    Player* player = ObjectAccessor::FindConnectedPlayer(invitee);

    uint8 level = player ? player->getLevel() : sCharacterCache->GetCharacterLevelByGuid(invitee);

    WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (4) + 1);
    data << invitee.WriteAsPacked();
    data << uint64(invite.GetEventId());
    data << uint64(invite.GetInviteId());
    data << uint8(level);
    data << uint8(invite.GetStatus());
    data << uint8(hasStatusTime);
    if (hasStatusTime)
        data.AppendPackedTime(statusTime);
    data << uint8(invite.GetSenderGUID() != invite.GetInviteeGUID()); // false only if the invite is sign-up

    if (!calendarEvent) // Pre-invite
    {
        if (Player* playerSender = ObjectAccessor::FindConnectedPlayer(invite.GetSenderGUID()))
            playerSender->SendDirectMessage(&data);
    }
    else
    {
        if (calendarEvent->GetCreatorGUID() != invite.GetInviteeGUID()) // correct?
            SendPacketToAllEventRelatives(data, *calendarEvent);
    }
}
void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid /*remover*/)
{
    CalendarEvent* calendarEvent = GetEvent(eventId);

    if (!calendarEvent)
        return;

    CalendarInviteStore::iterator itr = _invites[eventId].begin();
    for (; itr != _invites[eventId].end(); ++itr)
        if ((*itr)->GetInviteId() == inviteId)
            break;

    if (itr == _invites[eventId].end())
        return;

    SQLTransaction trans = CharacterDatabase.BeginTransaction();
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
    stmt->setUInt64(0, (*itr)->GetInviteId());
    trans->Append(stmt);
    CharacterDatabase.CommitTransaction(trans);

    if (!calendarEvent->IsGuildEvent())
        SendCalendarEventInviteRemoveAlert((*itr)->GetInviteeGUID(), *calendarEvent, CALENDAR_STATUS_REMOVED);

    SendCalendarEventInviteRemove(*calendarEvent, **itr, calendarEvent->GetFlags());

    // we need to find out how to use CALENDAR_INVITE_REMOVED_MAIL_SUBJECT to force client to display different mail
    //if ((*itr)->GetInviteeGUID() != remover)
    //    MailDraft(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody())
    //        .SendMailTo(trans, MailReceiver((*itr)->GetInvitee()), calendarEvent, MAIL_CHECK_MASK_COPIED);

    delete *itr;
    _invites[eventId].erase(itr);
}
bool CChoreoChannel::GetSortedCombinedEventList( char const *cctoken, CUtlRBTree< CChoreoEvent * >& events )
{
	events.RemoveAll();

	int i;
	// Sort items
	int c = GetNumEvents();
	for ( i = 0; i < c; i++ )
	{
		CChoreoEvent *e = GetEvent( i );
		Assert( e );
		if ( e->GetType() != CChoreoEvent::SPEAK )
			continue;

		if ( e->GetCloseCaptionType() == CChoreoEvent::CC_DISABLED )
			continue;

		// A master with no slaves is not a combined event
		if ( e->GetCloseCaptionType() == CChoreoEvent::CC_MASTER &&
			 e->GetNumSlaves() == 0 )
			 continue;

		char const *token = e->GetCloseCaptionToken();
		if ( Q_stricmp( token, cctoken ) )
			continue;

		events.Insert( e );
	}

	return ( events.Count() > 0 ) ? true : false;
}
	FMOD::Studio::EventInstance* SoundManager::GetSound( std::string eventID )
	{
		FMOD::Studio::EventInstance* tempInstance(nullptr);
//		ERRCHECK( GetEvent( eventID )->createInstance( &tempInstance ) );
		GetEvent( eventID )->createInstance( &tempInstance );
		return tempInstance;
	}
Exemple #21
0
void ObjectBase::SerializeObject( ticpp::Element* serializedElement )
{
	ticpp::Element element( "object" );
	element.SetAttribute( "class", _STDSTR( GetClassName() ) );
	element.SetAttribute( "expanded", GetExpanded() );

	for ( unsigned int i = 0; i < GetPropertyCount(); i++ )
	{
		PProperty prop = GetProperty( i );
		ticpp::Element prop_element( "property" );
		prop_element.SetAttribute( "name", _STDSTR( prop->GetName() ) );
		prop_element.SetText( _STDSTR( prop->GetValue() ) );
		element.LinkEndChild( &prop_element );
	}

	for ( unsigned int i = 0; i < GetEventCount(); i++ )
	{
		PEvent event = GetEvent( i );
		ticpp::Element event_element( "event" );
		event_element.SetAttribute( "name", _STDSTR( event->GetName() ) );
		event_element.SetText( _STDSTR( event->GetValue() ) );
		element.LinkEndChild( &event_element );
	}

	for ( unsigned int i = 0 ; i < GetChildCount(); i++ )
	{
		PObjectBase child = GetChild( i );
		ticpp::Element child_element;
		child->SerializeObject( &child_element );
		element.LinkEndChild( &child_element );
	}

	*serializedElement = element;
}
Exemple #22
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_t2_instance(void)
{
	StatusType result_inst_0, result_inst_1, result_inst_3, result_inst_4, result_inst_5;
	EventMaskType result_inst_2;
	
	SCHEDULING_CHECK_INIT(1);
	result_inst_0 = ActivateTask(t1);
	SCHEDULING_CHECK_AND_EQUAL_INT(1,E_OK, result_inst_0);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = SetEvent(t1, Event1);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OK, result_inst_1);
		
	SCHEDULING_CHECK_INIT(3);
	result_inst_3 = GetEvent(t1,&result_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(3,Event1, result_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_3);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_4 = WaitEvent(Event2);
	SCHEDULING_CHECK_AND_EQUAL_INT(13,E_OK, result_inst_4);
	
	SCHEDULING_CHECK_INIT(14);
	result_inst_5 = TerminateTask();
	SCHEDULING_CHECK_AND_EQUAL_INT(14,E_OK, result_inst_5);
	
}
Exemple #23
0
void pgRule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);
		wxString def = GetFormattedDefinition();
		if (!def.IsEmpty())
		{
			int doPos = def.Find(wxT(" DO INSTEAD "));
			if (doPos > 0)
				def = def.Mid(doPos + 12).Strip(wxString::both);
			else
			{
				doPos = def.Find(wxT(" DO "));
				if (doPos > 0)
					def = def.Mid(doPos + 4).Strip(wxString::both);
			}
		}

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Event"), GetEvent());
		properties->AppendItem(_("Condition"), GetCondition());
		properties->AppendYesNoItem(_("Do instead?"), GetDoInstead());
		properties->AppendItem(_("Definition"), firstLineOnly(def));
		if (this->GetDatabase()->connection()->BackendMinimumVersion(8, 3))
			properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System rule?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_pretask_instance2(void)
{
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5;
	TaskType task_id;
	TaskStateType task_state;
	EventMaskType event_mask;
	AlarmBaseType alarm_base;
	TickType tik;
	
	SCHEDULING_CHECK_INIT(15);
	result_inst_1 = GetTaskID(&task_id);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(15,INVALID_TASK , task_id); 
	SCHEDULING_CHECK_AND_EQUAL_INT(15,E_OK , result_inst_1); 
	
	SCHEDULING_CHECK_INIT(16);
	result_inst_2 = GetTaskState(task_id, &task_state);
	SCHEDULING_CHECK_AND_EQUAL_INT(17,E_OS_ID , result_inst_2);
	
	SCHEDULING_CHECK_INIT(18);
	result_inst_3 = GetEvent(task_id,&event_mask);
	SCHEDULING_CHECK_AND_EQUAL_INT(19,E_OS_ID , result_inst_3);
	
	SCHEDULING_CHECK_INIT(20);
	result_inst_4 = GetAlarmBase(Alarm1, &alarm_base);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(20,OSMAXALLOWEDVALUE_Counter1, (int)(alarm_base.maxallowedvalue));
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(20,OSTICKSPERBASE_Counter1, (int)(alarm_base.ticksperbase));
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(20,OSMINCYCLE_Counter1, (int)(alarm_base.mincycle));
	SCHEDULING_CHECK_AND_EQUAL_INT(20,E_OK , result_inst_4);
	
	SCHEDULING_CHECK_INIT(21);
	result_inst_5 = GetAlarm(Alarm1,&tik);
	SCHEDULING_CHECK_AND_EQUAL_INT(21,E_OK , result_inst_5);
}
Exemple #25
0
void BriefGo(char *MissionName)
{
    SetConstants();
    LinksSeq[0] = (char*)memalloc(8);
    
    strcpy(LinksSeq[0], MissionName);
    
    BriefInit(LinksSeq[0]);

  DrawOnScreen(1);
  FadeIn(Palette, 0);
  
  int BriefEvent; 
    // -7: Exit, -4: Up, -3: Down, -2: PgUp, -1: PgDown, 1..n: Odkazy HT
    do {
      BriefEvent = BriefGetEvent();
      BriefHandleEvent(BriefEvent);
  } while (BriefEvent != -7);
  
    BriefDone();
    FadeOut(Palette, 0);
    {
        TEvent e;
        do {GetEvent(&e);} while (e.What != evNothing);
    }
}
Exemple #26
0
void EventProcessor::Run() //{{{
{
  DEBUG_TRACER;

  long timeToWait = -1;
  while( true )
  {
    EventPointer event;
    std::pair<bool,long int> needWait = GetMaxWaitTime();
    if( needWait.first )
      timeToWait = needWait.second;
    else
      timeToWait = -1;

    DBGOUT_DEBUG( Debug::Prefix() << "EventProcessor(" << GetID() << ")::Run needWait " << needWait.first << ", " << needWait.second << " timeToWait " << timeToWait << std:: endl );

    if( GetEvent( event, timeToWait ) == EventPresent )
    {
      OnEvent( event );

      if( event->ID() == EVENT_FINISH )
        break;
    }

    std::pair<bool,unsigned char> timer = GetNextTimer();
    DBGOUT_DEBUG( Debug::Prefix() << "EventProcessor(" << GetID() << ")::Run timer " << timer.first << ", " << static_cast<int>( timer.second ) << std:: endl );
    if( timer.first )
    {
      EventPointer ptr = EventPointer( new Event( TIMER_ELAPSED( timer.second ) ) );
      OnEvent( ptr );
    }
  }
} //}}}
Int32 MonkeyActivityEvent::InjectEvent(
    /* [in] */ IIWindowManager *iwm,
    /* [in] */ IIActivityManager *iam,
    /* [in] */ Int32 verbose)
{
    AutoPtr<IIntent> intent = GetEvent();
    if(verbose > 0) {
        String uriString;
        intent->ToUri(0, &uriString);
        PFL_EX(":Switch: %s", uriString.string());
    }

    if (mAlarmTime != 0) {
        AutoPtr<IBundle> args;
        CBundle::New((IBundle**)&args);
        args->PutInt64(String("alarmTime"), mAlarmTime);
        intent->PutExtras(args);
    }

    Int32 status = 0;
    String nullStr;
    ECode ec = iam->StartActivity(NULL, intent, nullStr, NULL, nullStr, 0,
        0, nullStr, NULL, NULL, &status);
    if(FAILED(ec))
        return IMonkeyEvent::INJECT_FAIL;

    return IMonkeyEvent::INJECT_SUCCESS;
}
void MainWindow::handleEvents()
{
	sf::Event ev;
	while( GetEvent(ev) )
	{
		// Close the window
		if( ev.Type == sf::Event::Closed
		|| (ev.Type == sf::Event::KeyPressed && ev.Key.Code == sf::Key::Escape) )
		{
			Close();
		}

		// Toggle rendering states
/*
		if( ev.Type == sf::Event::KeyPressed )
		{
			if( ev.Key.Code == sf::Key::Num1 )
				sceneManager.toggleRenderState(SceneManager::textures);
			if( ev.Key.Code == sf::Key::Num2 )
				sceneManager.toggleRenderState(SceneManager::wireframe);
			if( ev.Key.Code == sf::Key::Num3 )
				sceneManager.toggleRenderState(SceneManager::points);
		}
*/
	}
}
void ThreadCommand::PopBuffer::Execute()
{
    ThreadCommand* command = toCommand();
    OVR_ASSERT(command);
    command->Execute();
    if (NeedsWait())
        GetEvent()->PulseEvent();
}
//------------------------------------------------------------------------------------
bool AdapterMMOClient::Work()
{
  //дать квант времени и транслировать события в игровой движок
  mClient->Work();
  nsEvent::TEvent* pEvent = GetEvent();
  while(pEvent)
  {
    // конвертация из событий модуля в события прототипа
    PrototypeMMOBaseEvent* pProtoEvent = 
      mConverter->Work((nsMMOEngine::TBaseEvent*)pEvent->pContainer->GetPtr());
    // трансляция события
    AddEventWithoutCopy(pProtoEvent, pEvent->time_ms);
    delete pEvent;
    pEvent = GetEvent();
  }
  return true;
}