void ShowfotoCoordinatesOverlay::slotEntered(const QModelIndex& index)
{
    AbstractWidgetDelegateOverlay::slotEntered(index);
    m_index = index;
    updatePosition();
}
示例#2
0
BBEditor::BBEditor( BBTrackContainer* tc ) :
	Editor(false),
	m_trackContainerView( new BBTrackContainerView(tc) )
{
	setWindowIcon( embed::getIconPixmap( "bb_track_btn" ) );
	setWindowTitle( tr( "Beat+Bassline Editor" ) );
	setCentralWidget(m_trackContainerView);

	setAcceptDrops(true);
	m_toolBar->setAcceptDrops(true);
	connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_trackContainerView, SLOT(dragEnterEvent(QDragEnterEvent*)));
	connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_trackContainerView, SLOT(dropEvent(QDropEvent*)));

	// TODO: Use style sheet
	if( ConfigManager::inst()->value( "ui",
					  "compacttrackbuttons" ).toInt() )
	{
		setMinimumWidth( TRACK_OP_WIDTH_COMPACT + DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT
			     + 2 * TCO_BORDER_WIDTH + 264 );
	}
	else
	{
		setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH
			     + 2 * TCO_BORDER_WIDTH + 264 );
	}


	m_playAction->setToolTip(tr( "Play/pause current beat/bassline (Space)" ));
	m_stopAction->setToolTip(tr( "Stop playback of current beat/bassline (Space)" ));

	m_playAction->setWhatsThis(
		tr( "Click here to play the current "
			"beat/bassline.  The beat/bassline is automatically "
			"looped when its end is reached." ) );
	m_stopAction->setWhatsThis(
		tr( "Click here to stop playing of current "
							"beat/bassline." ) );


	// Beat selector
	DropToolBar *beatSelectionToolBar = addDropToolBarToTop(tr("Beat selector"));

	m_bbComboBox = new ComboBox( m_toolBar );
	m_bbComboBox->setFixedSize( 200, 22 );
	m_bbComboBox->setModel( &tc->m_bbComboBoxModel );

	beatSelectionToolBar->addWidget( m_bbComboBox );


	// Track actions
	DropToolBar *trackAndStepActionsToolBar = addDropToolBarToTop(tr("Track and step actions"));


	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"),
						 Engine::getSong(), SLOT(addBBTrack()));
	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"),
						 m_trackContainerView, SLOT(addAutomationTrack()));

	QWidget* stretch = new QWidget(m_toolBar);
	stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	trackAndStepActionsToolBar->addWidget(stretch);


	// Step actions
	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"),
						 m_trackContainerView, SLOT(removeSteps()));
	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"),
						 m_trackContainerView, SLOT( addSteps()));
	trackAndStepActionsToolBar->addAction( embed::getIconPixmap( "step_btn_duplicate" ), tr( "Clone Steps" ),
						  m_trackContainerView, SLOT( cloneSteps() ) );

	connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ),
			m_trackContainerView, SLOT( updatePosition() ) );


	QAction* viewNext = new QAction(this);
	connect(viewNext, SIGNAL(triggered()), m_bbComboBox, SLOT(selectNext()));
	viewNext->setShortcut(Qt::Key_Plus);
	addAction(viewNext);

	QAction* viewPrevious = new QAction(this);
	connect(viewPrevious, SIGNAL(triggered()), m_bbComboBox, SLOT(selectPrevious()));
	viewPrevious->setShortcut(Qt::Key_Minus);
	addAction(viewPrevious);
}
示例#3
0
void ClientRenderModule::renderSingleFrame()
{
    int i,j,ii,jj;
    MapCell *m;

    /* local copy for share data */
    int px,py;		/* player position */
    int dir,life,attr;	/* player attributes */
    int x1,x2,y1,y2;	/* map coordinates */
    float pfx,pfy;		/* interpolated player position (for main player) */
    float pfx2,pfy2;	/* interpolated player position (for another player) */
    MapCell map[CLIENT_MATRIX_SIZE][CLIENT_MATRIX_SIZE];
    OglObject *player_model;/* type of player */

    /* create local copy for shared data */
    SDL_LockMutex(client_data->game_mutex);
    px = client_data->xpos;
    py = client_data->ypos;
    x1 = client_data->x1;
    x2 = client_data->x2;
    y1 = client_data->y1;
    y2 = client_data->y2;
    dir = client_data->dir;
    life = client_data->life;
    attr = client_data->attr;
    for ( i = 0; i < CLIENT_MATRIX_SIZE; i++ )
        for ( j = 0; j < CLIENT_MATRIX_SIZE; j++ )
            memcpy( &map[i][j], &client_data->map[i][j], sizeof(MapCell) );
    SDL_UnlockMutex(client_data->game_mutex);

    /* begin rendering */
    w.beginRender();

    /* get new player position */
    updatePosition(&pmd, px,py);
    pfx = pmd.pfx;
    pfy = pmd.pfy;

    /* set camera and lights */
    gluLookAt(pfx-4.0,6.0,pfy-4.0, 	/* position */
              pfx-0.5,0.0,pfy-0.5,	/* look at */
              0,1,0);		/* up direction */

    /* draw floor */
    for ( i = max( 0, px - MAX_CLIENT_VIEW ); i <= min( client_data->mapx, px + MAX_CLIENT_VIEW ); i++ )
        for ( j = max( 0, py - MAX_CLIENT_VIEW ); j <= min( client_data->mapy, py + MAX_CLIENT_VIEW ); j++ )
            //for ( i = x1; i < x2; i++ )
            //	for ( j = y1; j < y2; j++ )
            wfloor->render(i,j);

    /* draw map */
    for ( i = x1; i < x2; i++ )
        for ( j = y1; j < y2; j++ )
        {
            ii = MAX_CLIENT_VIEW - ( px - i );
            jj = MAX_CLIENT_VIEW - ( py - j );
            m = &map[ii][jj];
            if ( m->terrain != 0 ) obstacle->render( i,j );
            if ( m->type == CELL_OBJECT ) resource->render( i,j, 0.3 + 0.1 * m->quantity );
            if ( m->type == CELL_PLAYER )
            {
                player_model = player[ m->p_attr % nplayer_models ];
                updatePositionForPlayer( m->id, i,j, &pfx2, &pfy2);
                if ( m->dir >= 0 )
                    player_model->render( pfx2,pfy2, 0.5 + 0.7 * m->life / 100, m->dir*90 );
                else
                    player_model->render( pfx2,pfy2, 0.5 + 0.7 * m->life / 100,
                                          -m->dir*90, -90);
            }
            if ( m->type == CELL_OBJ_PLAYER )
            {
                resource->render( i,j, 0.3 + 0.1 * m->quantity );

                player_model = player[ m->p_attr % nplayer_models ];
                updatePositionForPlayer( m->id, i,j, &pfx2, &pfy2);
                if ( m->dir >= 0 )
                    player_model->render( pfx2,pfy2, 0.5 + 0.7 * m->life / 100, m->dir*90 );
                else
                    player_model->render( pfx2,pfy2, 0.5 + 0.7 * m->life / 100,
                                          -m->dir*90, -90);
            }
        }

    /* draw player */
    player_model = player[ attr % nplayer_models ];
    if ( dir >= 0 )
        player_model->render( pfx,pfy, 0.5 + 0.7 * life / 100 , dir * 90 );
    else
        player_model->render( pfx,pfy, 0.5 + 0.7 * life / 100, -dir * 90, -90);

    /* get coordinates for the status area */
    SDL_Surface *screen = w.getScreen();
    SDL_Rect rect;
    rect.w = client_data->resx;
    rect.h = 40;
    rect.x = 0;
    rect.y = client_data->resy - rect.h;

    /* display status */
    SDL_FillRect( screen, &rect, SDL_MapRGB( screen->format, 0x00, 0x00, 0x00 ) );
    SDL_UpdateRect(screen, rect.x,rect.y, rect.w,rect.h);

    char sbuffer[256];
    SDL_WM_SetCaption( client_data->name, NULL);
    if ( client_data->state != PLAYING )
        sprintf(sbuffer, "%s", client_states[client_data->state]);
    else
        sprintf(sbuffer, "playing -> %s ( coord = %d,%d life = %d )",
                AI_state_names[client_data->purpose],
                px,py, life);
    font->render(rect.x + 9, rect.y + 2, sbuffer, screen);
    sprintf(sbuffer, "update interval: average = %.1lfms, last = %.1lfms, fps = %.1f",
            client_data->average_update_interval, client_data->last_update_interval,
            1000.0 / frame_render_interval );
    font->render(rect.x + 9, rect.y + 21, sbuffer, screen);
    SDL_UpdateRect(screen, rect.x,rect.y, rect.w,rect.h);

    /* finish frame rendering */
    updateMovementDataVectors();
    w.endRender();
}
示例#4
0
void NodeController::updateMotion(float timeSlice)
{
	updatePosition();
}
示例#5
0
EditPoint::EditPoint(BezierPoint *point, unsigned int type) : ScreenEntity() {
	this->point = point;
	this->type = type;
	processInputEvents = true;
	
	draggingPoint = NULL;
	dragging = false;

	controlHandle1 = new ScreenImage("Images/bezier_handle.png");
	controlHandle1->setPositionMode(ScreenEntity::POSITION_CENTER);
	
	controlHandle1->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
	controlHandle1->addEventListener(this, InputEvent::EVENT_MOUSEUP);
	controlHandle1->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);	
	controlHandle1->processInputEvents = true;
	controlHandle1->setWidth(30);
	controlHandle1->setHeight(30);
		
	addChild(controlHandle1);
	
	controlHandle2 = new ScreenImage("Images/bezier_handle.png");
	controlHandle2->setPositionMode(ScreenEntity::POSITION_CENTER);
	controlHandle2->processInputEvents = true;
	
	controlHandle2->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
	controlHandle2->addEventListener(this, InputEvent::EVENT_MOUSEUP);
	controlHandle2->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);	
	controlHandle2->setWidth(30);
	controlHandle2->setHeight(30);
	
	addChild(controlHandle2);
	
	
	pointHandle = new ScreenImage("Images/bezier_point.png");
	pointHandle->processInputEvents = true;
	pointHandle->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
	pointHandle->addEventListener(this, InputEvent::EVENT_MOUSEUP);
	pointHandle->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);	
	pointHandle->setPositionMode(ScreenEntity::POSITION_CENTER);
	pointHandle->setWidth(30);
	pointHandle->setHeight(30);

	
	if(type == TYPE_START_POINT) {
		controlHandle1->visible = false;
		controlHandle1->enabled = false;		
		connectorLine1 = NULL;
	} else {
		connectorLine1 = new ScreenLine(pointHandle, controlHandle1);
		addChild(connectorLine1);
		connectorLine1->setColorInt(39, 212, 255, 128);
		connectorLine1->setLineWidth(2.0);
		connectorLine1->lineSmooth = true;
	}
	
	
	if(type == TYPE_END_POINT) {
		controlHandle2->visible = false;
		controlHandle2->enabled = false;		
		connectorLine2 = NULL;
	} else {
		connectorLine2 = new ScreenLine(pointHandle, controlHandle2);
		addChild(connectorLine2);
		connectorLine2->setColorInt(39, 212, 255, 128);
		connectorLine2->setLineWidth(2.0);
		connectorLine2->lineSmooth = true;
	}	
	
	CoreServices::getInstance()->getCore()->getInput()->addEventListener(this, InputEvent::EVENT_MOUSEMOVE);
	
	addChild(pointHandle);	
	
	updatePosition();
}
void AnimatedSprite::setRotation(double angle)
{
    _angle = angle;
    updatePosition();
}
示例#7
0
void ArcBallCamera::updateAzimuth(float a_val)
{
  m_azimuth -= a_val;
  m_azimuth = (int)m_azimuth % 360;
  updatePosition();
}
示例#8
0
void SsScene2901LocationButtonLight::show() {
	playSound(0);
	setVisible(true);
	updatePosition();
}
示例#9
0
void ArrowItem::setData(const QJsonObject& c)
{
    mData = c;
    updatePosition();
}
示例#10
0
void BoardWidget::mouseMoveEvent( QMouseEvent* pEvent )
{
    if ((!gettingMove && !editMode) || !mbDown) return;

    int pos = positionOf( pEvent->x(), pEvent->y() );
    if (pos == oldPos) return;
    oldPos = pos;

    if (editMode) {
	int f = fieldOf(pos);
	if (field[f] != Board::out && field[f] != editColor) {
	    if      (editColor == Board::color1) field[f] = Board::color1bright;
	    else if (editColor == Board::color2) field[f] = Board::color2bright;
	    else if (field[f] == Board::color1)  field[f] = Board::color1bright;
	    else if (field[f] == Board::color2)  field[f] = Board::color2bright;

	    if (renderMode) updatePieces();
	    update();
	}
	return;
    }

    if (!startValid) {
	/* We haven't a valid move yet. Check if we are over a valid start */

	startValid = isValidStart(pos, (pEvent->button() == Qt::MidButton));
	qDebug() << "Start pos " << pos << " is valid: " << startValid;
	//    actMove.print();

	if (!startValid) return;
	startPos = oldPos = pos;

	showStart(actMove,1);
	startShown = true;

	QString tmp;
	actValue = - board.calcEvaluation();
	tmp = tr("Board value: %1").arg(actValue);
	emit updateSpy(tmp);
	return;
    }

    /* restore board */
    updatePosition();
    startShown = false;

    if (isValidEnd(pos)) {
	//    actMove.print();

	board.playMove(actMove);
	int v = board.calcEvaluation();
	board.takeBack();

	QString tmp;
	tmp.sprintf("%+d", v-actValue);
	QString str = QString("%1 : %2").arg(actMove.name()).arg(tmp);
	emit updateSpy(str);

	showMove(actMove,3);
	setCursor(*arrow[shownDirection]);
    }
    else {
	QString tmp;

	setCursor(Qt::CrossCursor);
	if (pos == startPos) {
	    showStart(actMove,1);
	    startShown = true;
	    tmp = tr("Board value: %1").arg(actValue);
	}
	else {

	    if (renderMode) updatePieces();
	    update();
	}
	emit updateSpy(tmp);
    }
}
bool MovementAdapterWorkerTerrainCursor::frameStarted(const Ogre::FrameEvent& event)
{
	updatePosition();
	return true;
}
void MovementAdapterWorkerTerrainCursor::update()
{
	updatePosition(true);
}
void FunctionHintProposalWidget::updateContent()
{
    d->m_hintLabel->setText(d->m_model->text(d->m_currentHint));
    d->m_numberLabel->setText(tr("%1 of %2").arg(d->m_currentHint + 1).arg(d->m_totalHints));
    updatePosition();
}
示例#14
0
void GameSprite::update(float dt)
{
	time_ += dt;
	updateLogic();
	updatePosition();
}
示例#15
0
void BaseObject::update(Screen* screen)
{
	updateSpeed();
	updatePosition();
}
示例#16
0
void SsScene2901LocationButton::update() {
	updatePosition();
	if (_countdown1 != 0 && (--_countdown1) == 0) {
		setVisible(false);
	}
}
void CallOutBox::childBoundsChanged (Component*)
{
    updatePosition (targetArea, availableArea);
}
示例#18
0
void SsScene2901LocationButtonLight::hide() {
	setVisible(false);
	updatePosition();
}
示例#19
0
 void TransparentScrollBar::updatePos()
 {
     updatePosition();
 }
示例#20
0
文件: lien.cpp 项目: gthom/gapQBE
 void Lien::calculeCoordonnees()
 {
     updatePosition();
 }
示例#21
0
NodeController::NodeController(NodeAttachment& attachment) :
	mAttachment(attachment)
{
	mAttachment.getAttachedEntity().Moved.connect(sigc::mem_fun(*this, &NodeController::entity_Moved));
	updatePosition();
}
示例#22
0
void NodeInstanceView::variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
{
    updatePosition(propertyList);
    nodeInstanceServer()->changePropertyValues(createChangeValueCommand(propertyList));
}
示例#23
0
Ogre::Vector3 Animation::runAnimation(float duration)
{
    Ogre::Vector3 movement(0.0f);
    AnimStateMap::iterator stateiter = mStates.begin();
    while(stateiter != mStates.end())
    {
        AnimState &state = stateiter->second;
        const NifOgre::TextKeyMap &textkeys = state.mSource->mTextKeys;
        NifOgre::TextKeyMap::const_iterator textkey(textkeys.upper_bound(state.mTime));

        float timepassed = duration * state.mSpeedMult;
        while(state.mPlaying)
        {
            float targetTime;

            if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
                goto handle_loop;

            targetTime = state.mTime + timepassed;
            if(textkey == textkeys.end() || textkey->first > targetTime)
            {
                if(mNonAccumCtrl && stateiter->first == mAnimationTimePtr[0]->getAnimName())
                    updatePosition(state.mTime, targetTime, movement);
                state.mTime = std::min(targetTime, state.mStopTime);
            }
            else
            {
                if(mNonAccumCtrl && stateiter->first == mAnimationTimePtr[0]->getAnimName())
                    updatePosition(state.mTime, textkey->first, movement);
                state.mTime = textkey->first;
            }

            state.mPlaying = (state.mTime < state.mStopTime);
            timepassed = targetTime - state.mTime;

            while(textkey != textkeys.end() && textkey->first <= state.mTime)
            {
                handleTextKey(state, stateiter->first, textkey);
                textkey++;
            }

            if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
            {
            handle_loop:
                state.mLoopCount--;
                state.mTime = state.mLoopStartTime;
                state.mPlaying = true;

                textkey = textkeys.lower_bound(state.mTime);
                while(textkey != textkeys.end() && textkey->first <= state.mTime)
                {
                    handleTextKey(state, stateiter->first, textkey);
                    textkey++;
                }

                if(state.mTime >= state.mLoopStopTime)
                    break;
            }

            if(timepassed <= 0.0f)
                break;
        }

        if(!state.mPlaying && state.mAutoDisable)
        {
            mStates.erase(stateiter++);
            resetActiveGroups();
        }
        else
            ++stateiter;
    }

    for(size_t i = 0;i < mObjectRoot->mControllers.size();i++)
        mObjectRoot->mControllers[i].update();

    // Apply group controllers
    for(size_t grp = 0;grp < sNumGroups;grp++)
    {
        const std::string &name = mAnimationTimePtr[grp]->getAnimName();
        if(!name.empty() && (stateiter=mStates.find(name)) != mStates.end())
        {
            const Ogre::SharedPtr<AnimSource> &src = stateiter->second.mSource;
            for(size_t i = 0;i < src->mControllers[grp].size();i++)
                src->mControllers[grp][i].update();
        }
    }

    if(mSkelBase)
    {
        // HACK: Dirty the animation state set so that Ogre will apply the
        // transformations to entities this skeleton instance is shared with.
        mSkelBase->getAllAnimationStates()->_notifyDirty();
    }

    updateEffects(duration);

    return movement;
}