Esempio n. 1
0
void Munizione::onTick()
{
    MyAllegro* m =dynamic_cast<MyAllegro*>(MyAllegro::getInstance());
    if(tick%m->getSpeed()==0)
    {
         if(checkColpito())
        {
            hit=false;
        }
         else
         {
            if(direzione == DESTRA)
                posizioneX+=velocita;
            else
                posizioneX-=velocita;

            angle += velocitaRotazione;
            

            setLeftTopCorner(Point(posizioneX-getWidth()/2,posizioneY-getHeight()/2));

            setAngle(angle);
         }
    }
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
// Function: refresh()
//-----------------------------------------------------------------------------
void AddressSpaceGapItem::refresh() 
{
    if (addrPosition_ == AddressSpaceGapItem::ALIGN_LEFT) {
        setLeftTopCorner(start_);
        if (end_ != start_)
        {
            setLeftBottomCorner(end_);
        }
        else
        {
            VisualizerItem::setLeftBottomCorner("");
        }
    }

    else {
        setRightTopCorner(start_);
        if (end_ != start_)
        {
            setRightBottomCorner(end_);
        }
        else
        {
            VisualizerItem::setRightBottomCorner("");
        }
    }

    setOverlappingTop(start_);
    setOverlappingBottom(end_);

    VisualizerItem::reorganizeChildren();
}
Esempio n. 3
0
//-----------------------------------------------------------------------------
// Function: setOverlappingTop()
//-----------------------------------------------------------------------------
void AddressSpaceGapItem::setOverlappingTop(quint64 const& address)
{
    firstFreeAddress_ = address;

    if (addrPosition_ == AddressSpaceGapItem::ALIGN_LEFT)
    {
        setLeftTopCorner(firstFreeAddress_);

        if (firstFreeAddress_ == lastFreeAddress_){        
            VisualizerItem::setLeftBottomCorner("");
        }
        else
        {
            setLeftBottomCorner(lastFreeAddress_);
        }
    }

    else //if (addrPosition == AddressSpaceGapItem::ALIGN_RIGHT)
    {
        setRightTopCorner(firstFreeAddress_);

        if (firstFreeAddress_ == lastFreeAddress_){        
            VisualizerItem::setRightBottomCorner("");
        }
        else
        {
            setRightBottomCorner(lastFreeAddress_);
        }
    }
}
//-----------------------------------------------------------------------------
// Function: setOverlappingTop()
//-----------------------------------------------------------------------------
void AddressSpaceVisualizationItem::setOverlappingTop(quint64 const& address)
{
    firstFreeAddress_ = address;
    setLeftTopCorner(firstFreeAddress_);

    if (firstFreeAddress_ == lastFreeAddress_){        
        VisualizerItem::setLeftBottomCorner("");
    }
}
Esempio n. 5
0
//-----------------------------------------------------------------------------
// Function: refresh()
//-----------------------------------------------------------------------------
void FieldGapItem::refresh()
{
	QString startStr = QString::number(start_);
	VisualizerItem::setRightTopCorner(startStr);

	QString endStr = QString::number(end_);
	setLeftTopCorner(endStr);
    setToolTip("<b>" + getName() + "</b> [" + endStr + ".." + startStr + "]");

	VisualizerItem::reorganizeChildren();
}
Esempio n. 6
0
//-----------------------------------------------------------------------------
// Function: FieldGraphItem::updateDisplay()
//-----------------------------------------------------------------------------
void FieldGraphItem::updateDisplay()
{
    setName(field_->getName());

    quint64 leftBound = getLastAddress();
    quint64 rightBound = getOffset();

    setLeftTopCorner(QString::number(leftBound));
    setRightTopCorner(QString::number(rightBound));

    setDisplayOffset(leftBound);
    setDisplayLastAddress(rightBound);
    setToolTip("<b>" + getName() + "</b> [" + QString::number(leftBound) + ".." + 
        QString::number(rightBound) + "]");
}
Esempio n. 7
0
Munizione::Munizione(Personaggio* p, Personaggio** en, const unsigned enSize, unsigned v, Peso pe, Direzione d,VelocitaRotazione vr,const char* n)
        :Sprite(n,Point(p->getX()+ p->getFirePositionX(), p->getY() + p->getFirePositionY())), 
        proprietario(p),
        bersagli(en),
        bersagliSize(enSize),
        velocita(v),
        posizioneX(p->getX()+ p->getFirePositionX()),
        posizioneY(p->getY() + p->getFirePositionY()),
        angle(0),
        hit(true),
        peso(pe),
        direzione(d),
        velocitaRotazione(vr),
        nome(n),
        tick(0)
    {
    
        switch(peso)
            {
                case HEAVY:
                    incrementoY = 1;
                    break;
                case MEDIUM:
                    incrementoY = 2;
                break;
                case LIGHT:
                    incrementoY = 3;
                break;
                default:
                    break;
            }
        
        //Uno strano baco mi impedisce di inizializzare la posizione utilizzando
        //la width e la height della immagine nella lista di inizializzazione
        posizioneX+= getWidth()/2;
        posizioneY+=getHeight()/2;
        
        setLeftTopCorner(Point(posizioneX,posizioneY));
    }
Esempio n. 8
0
//-----------------------------------------------------------------------------
// Function: FieldGapItem::setDisplayOffset()
//-----------------------------------------------------------------------------
void FieldGapItem::setDisplayOffset(quint64 const& address)
{
    firstFreeAddress_ = address;
    setLeftTopCorner(QString::number(firstFreeAddress_));
}