void CodeLiteLLDBApp::ShowCurrentFileLine(const LLDBCommand& command)
{
    wxPrintf("codelite-lldb: ShowCurrentFileLine called\n");
    if(m_target.GetProcess().IsValid() && m_target.GetProcess().GetState() == lldb::eStateStopped) {
        NotifyStopped();
    }
}
void CodeLiteLLDBApp::OpenCoreFile(const LLDBCommand& command)
{
    wxPrintf("codeite-lldb: debugging core file '%s'\n", command.GetCorefile());
    wxPrintf("codeite-lldb: executable file '%s'\n", command.GetExecutable());

    if(!InitializeLLDB(command)) {
        return;
    }

    lldb::SBProcess process = m_target.LoadCore(command.GetCorefile().mb_str(wxConvUTF8).data());
    if(!process.IsValid()) {
        wxPrintf("codeite-lldb: error loading core file '%s'\n", command.GetCorefile());
        NotifyExited();
        return;
    }

    // Launch the thread that will handle the LLDB process events
    m_lldbProcessEventThread =
        new LLDBProcessEventHandlerThread(this, m_debugger, m_target.GetProcess(), kDebugSessionTypeCore);
    m_lldbProcessEventThread->Start();

    // Notify codelite that the debugger started successfully
    NotifyStarted(kDebugSessionTypeCore);

    // In any case, reset the interrupt reason
    m_interruptReason = kInterruptReasonNone;

    // Since we are in 'core' session
    // immediately notify about 'stop'
    NotifyStopped();
}
Beispiel #3
0
void LLDBDebugger::OnTimer(wxTimerEvent& e)
{
    if ( m_debugger.IsValid() ) {
        lldb::SBEvent lldbEvent;
        if ( m_debugger.GetListener().WaitForEvent(0, lldbEvent) ) {
            if ( lldbEvent.IsValid() ) {
                lldb::StateType state = m_target.GetProcess().GetStateFromEvent( lldbEvent );
                switch ( state ) {
                case lldb::eStateStopped:
                    NotifyBacktrace();
                    NotifyStopped();
                    break;

                case lldb::eStateConnected:
                    break;

                case lldb::eStateLaunching:
                    break;

                case lldb::eStateRunning:
                    break;

                case lldb::eStateExited:
                    Cleanup();
                    NotifyExited();
                    break;
                default:
                    break;
                }
            }
        }
    }
}
void CodeLiteLLDBApp::SelectFrame(const LLDBCommand& command)
{
    wxPrintf("codelite-lldb: selecting frame %d\n", command.GetFrameId());
    if(CanInteract() && command.GetFrameId() != wxNOT_FOUND) {
        m_target.GetProcess().GetSelectedThread().SetSelectedFrame(command.GetFrameId());
        m_interruptReason = kInterruptReasonNone;
        NotifyStopped();
    }
}
Beispiel #5
0
void FrameRangeAnimator::Progress(timestamp_t currTime,bool scrolled,int xOff) {
	int oldFrameNo = sprite->GetFrame();

	if (state != ANIMATOR_FINISHED){
		//std::cout << currTime << " " << anim->GetDelay() << "\n";
			if (currTime > lastTime && currTime - lastTime >= anim->GetDelay()) {
				//std::cout << "Mpainw " <<  "\n";
				
				if (anim->getEndFrameNo() > anim->getStartFrameNo()){
					if (sprite->GetFrame() < anim->getEndFrameNo()){
						sprite->SetFrame(sprite->GetFrame() + 1);
					}
					else{
						sprite->SetFrame(anim->getStartFrameNo());
					}
				}
				else{
					if (sprite->GetFrame() > anim->getEndFrameNo()){
						sprite->SetFrame(sprite->GetFrame() - 1);
					}
					else{
						sprite->SetFrame(anim->getStartFrameNo());
					}
				}


				
				//std::cout << "Printed";

				if (!anim->GetContinuous()) {

					state = ANIMATOR_FINISHED;
					NotifyStopped();
				}
				else {
					lastTime += anim->GetDelay();
					//Progress(currTime); // Recursion (make it a loop)
				}
			}
			//if (oldFrameNo != sprite->GetFrame())
			if (sprite->getRepet() == false){
				Point r=sprite->Move(anim->GetDx(), anim->GetDy(), sprite->GetFrame(), oldFrameNo,scrolled,xOff);
				anim->SetDx(r.x);
				anim->SetDy(r.y);
				sprite->setRepet(true);
			}
			else sprite->setRepet(false);
			Point p;
			p.x = sprite->getPosX();
			p.y = sprite->getPosY();
			sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
			
	}
}
void CodeLiteLLDBApp::SelectThread(const LLDBCommand& command)
{
    wxPrintf("codelite-lldb: selecting thread %d\n", command.GetThreadId());
    if(CanInteract() && command.GetThreadId() != wxNOT_FOUND) {
        lldb::SBThread thr = m_target.GetProcess().GetThreadByID(command.GetThreadId());
        if(thr.IsValid()) {
            m_target.GetProcess().SetSelectedThread(thr);
            m_interruptReason = kInterruptReasonNone;
            NotifyStopped();
        }
    }
}
void TimerTickAnimator::Progress (timestamp_t currTime){
	DASSERT(tick);
	DASSERT(lastTime<=currTime);

	while (currTime > lastTime && currTime - lastTime >= tick->GetDelay()){
		
		tick->NotifyTickAction();
		lastTime += tick->GetDelay();
		if (++repetitions==tick->GetRepetitions()) {
			state = ANIMATOR_FINISHED;
			
			NotifyStopped();
			return;
		}
	}
}
Beispiel #8
0
/**
* Enalassei ta frames twn sprites kai ta typwnei

* currTime	:O xronos tou paixnidiou
* scrolled	:True an egine scroll ,false alliws
* xOff		:To xOff tou window
* mario_running:True an o mario trexei,false alliws
*/
animatorToStart FrameRangeAnimator::Progress(timestamp_t currTime, bool scrolled, int xOff, bool mario_running, bool gamePaused, Sprite* mario_sprite) {
	int oldFrameNo = sprite->GetFrame();
	animatorToStart who;
	who.pair.first = other_t;
	Point s;
	s.x = 0;
	s.y = 0;
	who.pair.second = s;
	if (state == ANIMATOR_RUNNING){
		if (sprite->getPosX() < -33){
			state = ANIMATOR_FINISHED;
			sprite->resetOldxOff();
		}
		if (!gamePaused)
		{
			if ((sprite->getType() != gm_t)){
				if (sprite->getRepet() == false){
					if (sprite->getType() == star_t){
						if (shroom_progressed < sprite->GetAnimFilm()->GetFrameBox(0).w){
							sprite->alterPosY(-1);
							shroom_progressed++;
						}
						else{
							anim->SetDy(0);
						}
					}
					if (sprite->getType() == coin_animator_t){
						if (shroom_progressed < 20){
							sprite->alterPosY(-1);
							shroom_progressed++;
							Point p;
							p.x = sprite->getPosX();
							p.y = sprite->getPosY();
							sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
							sprite->alterPosY(-1);
							p.x = sprite->getPosX();
							p.y = sprite->getPosY();
							sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
							sprite->alterPosY(-1);
							p.x = sprite->getPosX();
							p.y = sprite->getPosY();
							sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
						}
						else{
							shroom_progressed = 0;
							state = ANIMATOR_FINISHED;
							sprite->resetOldxOff();
						}
					}
					if (state != ANIMATOR_FINISHED){
						Point r = sprite->Move(anim->GetDx(), anim->GetDy(), sprite->GetFrame(), oldFrameNo, scrolled, xOff, mario_running, anim);

						anim->SetDx(r.x);
						anim->SetDy(r.y);
						sprite->setRepet(true);
						CollisionDetection(mario_sprite, sprite, currTime, &who);
					}
				}
				else sprite->setRepet(false);
				if ((sprite->getType() != gkt_t) || ((sprite->getType() == gkt_t) && (sprite->getRepetitions() == 2))){
					if (currTime > lastTime && currTime - lastTime >= anim->GetDelay()) {
						if (anim->getEndFrameNo() > anim->getStartFrameNo()){
							if (sprite->GetFrame() < anim->getEndFrameNo()){
								sprite->SetFrame(sprite->GetFrame() + 1);
							}
							else{
								sprite->SetFrame(anim->getStartFrameNo());
							}
						}
						else{

							if (sprite->GetFrame() > anim->getEndFrameNo()){
								sprite->SetFrame(sprite->GetFrame() - 1);
							}
							else{
								sprite->SetFrame(anim->getStartFrameNo());
							}
						}
						if (!anim->GetContinuous()) {

							state = ANIMATOR_FINISHED;
							NotifyStopped();
						}
						else {
							lastTime += anim->GetDelay();
						}
					}
				}
				if ((sprite->getType() == gkt_t) && (sprite->getRepetitions() == 1)){
					if (currTime - sprite->getTimeToAwake() > 7){
						sprite->SetFrame(3);
						anim->SetDx(1);
						anim->switchEnds();
						sprite->setRepet((short int)2);
					}
				}
				if ((sprite->getType() == gkt_t) && (sprite->getRepetitions() == 0)){

					
					Point p,r;
					for (int i = 0; i < 2; i++){
						p.x = sprite->getPosX();
						p.y = sprite->getPosY();

						r=sprite->Move(anim->GetDx(), anim->GetDy(), sprite->GetFrame(), oldFrameNo, scrolled, xOff, mario_running, anim);
						anim->SetDx(r.x);
						anim->SetDy(r.y);
						sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
						
					}
				}
			}
			else if(sprite->getType()==gm_t){/*Shroom case*/
				if ((anim->GetDx()==0)&&(currTime - lastTime >= 0.5)){
					if (shroom_progressed < sprite->GetAnimFilm()->GetFrameBox(0).w){
						sprite->Move(anim->GetDx(), anim->GetDy(), sprite->GetFrame(), oldFrameNo, scrolled, xOff, mario_running, anim);
						sprite->alterPosY(-1);
						shroom_progressed++;
					}
					else{
						shroom_progressed = 0;
						anim->SetDx(1);
						anim->SetDy(0);
					}
				}
				if (anim->GetDx() != 0){
					if (sprite->getRepet() == false){

						Point r = sprite->Move(anim->GetDx(), anim->GetDy(), sprite->GetFrame(), oldFrameNo, scrolled, xOff, mario_running, anim);

						anim->SetDx(r.x);
						anim->SetDy(r.y);
						sprite->setRepet(true);
						CollisionDetection(mario_sprite, sprite, currTime, &who);

					}
					else sprite->setRepet(false);
				}
			}/*End of shroom case*/
		
			Point p;
			p.x = sprite->getPosX();
			p.y = sprite->getPosY();
			sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
		}
	}
	if (state == ANIMATOR_STOPPED){
		if(currTime - lastTime <= 2){
			Point p = sprite->Move(0, 0, sprite->GetFrame(), oldFrameNo, scrolled, xOff, mario_running, anim);
			p.x = sprite->getPosX();
			p.y = sprite->getPosY();
			sprite->GetAnimFilm()->DisplayFrame(p, sprite->GetFrame());
		}
		else{
			sprite->SetFrame(0);
			state = ANIMATOR_FINISHED;
		}

	}
	return who;
}
Beispiel #9
0
void Animator::Stop(void) {
	if (!HasFinished()) {
		state = ANIMATOR_STOPPED;
		NotifyStopped();
	}
}