Esempio n. 1
0
static RenderStyle createFullScreenStyle()
{
    auto fullscreenStyle = RenderStyle::create();

    // Create a stacking context:
    fullscreenStyle.setZIndex(INT_MAX);

    fullscreenStyle.setFontDescription({ });
    fullscreenStyle.fontCascade().update(nullptr);

    fullscreenStyle.setDisplay(FLEX);
    fullscreenStyle.setJustifyContentPosition(ContentPositionCenter);
    fullscreenStyle.setAlignItemsPosition(ItemPositionCenter);
    fullscreenStyle.setFlexDirection(FlowColumn);
    
    fullscreenStyle.setPosition(FixedPosition);
    fullscreenStyle.setWidth(Length(100.0, Percent));
    fullscreenStyle.setHeight(Length(100.0, Percent));
    fullscreenStyle.setLeft(Length(0, WebCore::Fixed));
    fullscreenStyle.setTop(Length(0, WebCore::Fixed));
    
    fullscreenStyle.setBackgroundColor(Color::black);

    return fullscreenStyle;
}
Esempio n. 2
0
SODOctopus::SODOctopus(Panel* container, GridOctopus* gridO, Spell* s, SpellTarget* target)
	: OctopusBaby(int(gridO->getCellDimensions().x*1.5), int(gridO->getCellDimensions().y*5)), _grid(gridO), _spell(s), _target(target)
{	
	Texture t = (*ServiceLocator::getTextureManager())["SwordDestiny"];
	Point d = gridO->getCellDimensions() * 3;
	// compute ratio
	double ratiox = (double)d.x / t.getWidth();
	double ratioy = (double)d.y / t.getHeight();
	ratio = min(ratioy, ratiox);

	unsigned int n = target->getCell()->getNumber();
	Point cellCenter = gridO->getCellCenter(n);
	
	width = int(t.getWidth() * ratio);
	height = int(t.getHeight() * ratio);

	container->add(this);
	Point pos = toContainerCoordinates(gridO->toAbsoluteCoordinates(Point(cellCenter.x - width / 2, cellCenter.y - height - d.y/3)));

	ori_pos = pos;
	dst_pos = toContainerCoordinates(gridO->toAbsoluteCoordinates(Point(cellCenter.x - width / 2, cellCenter.y - height)));

	setPositionX((int)pos.x);
	setPositionY((int)pos.y);

	setBgColor(Color::TRANSPARENT);
	setActive(true);
	beginTime = TIMESERVICE->time();
	finishTime = beginTime + totalTime;

	setZIndex(gridO->getZIndexFromCell(n) + 1);
}
Esempio n. 3
0
ShrinkToFitShapeContainer::ShrinkToFitShapeContainer(KoShape *childShape, KoDocumentResourceManager *documentResources)
    : KoShapeContainer(*(new ShrinkToFitShapeContainerPrivate(this, childShape)))
{
    Q_UNUSED(documentResources);
    Q_D(ShrinkToFitShapeContainer);

    setPosition(childShape->position());
    setSize(childShape->size());
    setZIndex(childShape->zIndex());
    setRunThrough(childShape->runThrough());
    rotate(childShape->rotation());
    //setTransformation(childShape->transformation());

    if (childShape->parent()) {
        childShape->parent()->addShape(this);
        childShape->setParent(0);
    }

    childShape->setPosition(QPointF(0.0,0.0)); // since its relative to my position, this won't move it
    childShape->setSelectable(false); // our ShrinkToFitShapeContainer will handle that from now on

    d->model = new ShrinkToFitShapeContainerModel(this, d);
    addShape(childShape);

    QSet<KoShape*> delegates;
    delegates << childShape;
    setToolDelegates(delegates);

    KoTextShapeData* data = dynamic_cast<KoTextShapeData*>(childShape->userData());
    Q_ASSERT(data);
    KoTextDocumentLayout *lay = qobject_cast<KoTextDocumentLayout*>(data->document()->documentLayout());
    Q_ASSERT(lay);
    QObject::connect(lay, SIGNAL(finishedLayout()), static_cast<ShrinkToFitShapeContainerModel*>(d->model), SLOT(finishedLayout()));
}
Esempio n. 4
0
BlokItem::BlokItem(float w, float h,KGLEngine * parent)
        :KGLPhysicsItem(parent,KGLPhysicsItem::PolygonShape)
{
    createBox(w,h);
    setZIndex(LAYER_MIDDLE);
    m_willRemove=false;
    m_exploseSound=new KALSound(KGlobal::dirs()->findResourceDir("appdata", "data/sounds/") + "data/sounds/explosion.wav");
}
Esempio n. 5
0
/*!
 * \brief Replace the card to its expected position
 * \param animate Flag for animating the position update
 */
void Card::updatePosition(bool animate)
{
    if (animate) {
        animatePosition(mParent->getChildPosition());
    } else {
        setPosition(mParent->getChildPosition());
        setZIndex(mParent->getZIndex() + 1);
    }
}
void PlayerOctopus::update()
{
    if (isActive() && _character)
    {
        // update position based on cell

        //LOGINFO << "Position: " << getPosition() << endl;
        if (!real_cell)
            teleport(real_cell = _character->getCell());
        else if (!move_wanted)
        {
            teleport(real_cell = destination_cell);
            moving = false;
            pathNext();
        }
        else if (real_cell != destination_cell && _land_time + move_delay < TIMESERVICE->time())
        {
            //LOGINFO << "Moving" << endl;

            // delta time in milliseconds
            Uint32 dt = (TIMESERVICE->time() - movement_begin);

            Point origin_pos = toContainerCoordinates(_grid->toAbsoluteCoordinates(_grid->getCellCenter(real_cell)));
            Point dest_pos = toContainerCoordinates(_grid->toAbsoluteCoordinates(_grid->getCellCenter(destination_cell)));
            Point delta = abs(origin_pos - dest_pos);
            Point middle = (origin_pos - dest_pos) / 2;

            Point step = ((dest_pos - origin_pos) * dt)/move_time;

            // jump
            Point jump(0, sqrt(pow(jump_height, 2) - (pow(jump_height,2) * abs(delta.y - step.y))/pow( delta.y, 2)));

            Point pos = origin_pos + step - jump;
            Point newPos = pos + getPadding();


            step = abs(step);
            if (step.x >= delta.x && step.y >= delta.y)
            {
                //LOGINFO << "Landing on new cell" << endl;
                newPos = dest_pos + getPadding();
                real_cell = destination_cell;

                moving = false;

                _grid->unmark(destination_cell->getNumber());
                pathNext();
            }

            setPosition(newPos);
        }

        // update z-index
        setZIndex(_grid->getZIndexFromCell(destination_cell->getNumber()));
    }
}
/// KoTextOnShapeContainer
KoTextOnShapeContainer::KoTextOnShapeContainer(KoShape *childShape, KoResourceManager *documentResources)
    : KoShapeContainer(*(new KoTextOnShapeContainerPrivate(this)))
{
    Q_D(KoTextOnShapeContainer);
    Q_ASSERT(childShape);
    d->content = childShape;

    setSize(childShape->size());
    setZIndex(childShape->zIndex());
    setTransformation(childShape->transformation());
    if (childShape->parent()) {
        childShape->parent()->addShape(this);
        childShape->setParent(0);
    }

    childShape->setPosition(QPointF()); // since its relative to my position, this won't move it
    childShape->setSelectable(false);

    d->model = new KoTextOnShapeContainerModel(this, d);
    addShape(childShape);

    QSet<KoShape*> delegates;
    delegates << childShape;
    KoShapeFactoryBase *factory = KoShapeRegistry::instance()->get("TextShapeID");
    if (factory) { // not installed, thats too bad, but allowed
        d->textShape = factory->createDefaultShape(documentResources);
        Q_ASSERT(d->textShape); // would be a bug in the text shape;
        if (d->resizeBehavior == TextFollowsPreferredTextRect) {
            d->textShape->setSize(d->preferredTextRect.size());
        } else {
            d->textShape->setSize(size());
        }
        d->textShape->setTransformation(childShape->transformation());
        if (d->resizeBehavior == TextFollowsPreferredTextRect) {
            d->textShape->setPosition(d->preferredTextRect.topLeft());
        }
        KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(d->textShape->userData());
        Q_ASSERT(shapeData); // would be a bug in kotext
        shapeData->setVerticalAlignment(Qt::AlignVCenter);
        addShape(d->textShape);
        d->textShape->setZIndex(childShape->zIndex() + 1);
        d->textShape->setSelectable(false);
        delegates << d->textShape;
    } else {
        kWarning(30006) << "Text shape factory not found";
    }

    static_cast<KoTextOnShapeContainerModel*>(d->model)->lock = false;

    setToolDelegates(delegates);
}
Esempio n. 8
0
void Card::animatePosition(QPoint pos)
{
    mPosition = pos;
    setZIndex(100);

    QPropertyAnimation *animation = new QPropertyAnimation(mWidget, "pos");
    animation->setDuration(100);
    animation->setStartValue(mWidget->pos());
    animation->setEndValue(mPosition);
    animation->start(QAbstractAnimation::DeleteWhenStopped);

    QObject::connect(animation, SIGNAL(finished()), this, SLOT(resetZIndex()));

    if (mChild) {
        mChild->updatePosition(true);
    }
}
Esempio n. 9
0
void Card::resetZIndex()
{
    setZIndex(mParent->getZIndex() + 1);
}