Exemple #1
0
bool Crawler::update(float dt, TileMap *map)
{
	if (inGravField)
	{
		animate(dt);
		return updateGravity(dt);
	}
	else if (frozen)
		updateFreeze(dt);
	else
	{
		animate(dt);
		updatePatrol(dt, map);

		if (onFire)
			return updateFlame(dt);

		if (isOffscreen())
		{
			despawn();
			return true;
		}
	}

	return false;
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    play_or_pause_ = true;
    selected_item_ = NULL;
    SceneContainer::viewer_reference_ = ui->viewer;

    this->setWindowTitle(QString("Animation Studio"));
    connect( ui->button_play, SIGNAL(clicked()), ui->viewer, SLOT(play()) );
    connect( ui->button_stop, SIGNAL(clicked()), ui->viewer, SLOT(stop()));
    connect( ui->button_stop, SIGNAL(clicked()), this, SLOT(stop()));

    connect(ui->button_play,SIGNAL(clicked()),this,SLOT(playPause()));

    connect(ui->viewer,SIGNAL(signalUpdateObjects()),this,SLOT(updateObjects()));

    connect( ui->timebar, SIGNAL(setSelectedFrame(int)), ui->viewer, SLOT(setCurrentFrame(int)));
    connect( ui->timebar, SIGNAL(setSelectedFrame(int)), this, SLOT(selectedFramePause()) );
    connect( ui->viewer, SIGNAL(currentFrame(int)), ui->timebar, SLOT(setCurrentFrame(int)));

    connect( ui->spin_frame_count, SIGNAL(valueChanged(int)), this, SLOT(updateFrameCount(int)));

    connect( ui->combo_velocity_control, SIGNAL(activated(int)), this, SLOT(updateSpeedControl(int)));

    connect( ui->combo_pos_interpolator, SIGNAL(activated(int)), this, SLOT(updatePositionInterpolation(int)));
    connect( ui->combo_ori_interpolator, SIGNAL(activated(int)), this, SLOT(updateOrientationInterpolation(int)));

    connect( ui->checkbox_freeze_pos, SIGNAL(clicked()), this, SLOT(updateFreeze()));
    connect( ui->checkbox_freeze_ori, SIGNAL(clicked()), this, SLOT(updateFreeze()));

    // Object 3D Manipulation

    connect( ui->line_edit_label, SIGNAL(textChanged(QString)), this, SLOT(updateSelectedLabel(QString)));

    connect( ui->add_keyframe_pos, SIGNAL(pressed()), this, SLOT(addPositionKeyframe()));
    connect( ui->add_keyframe_ori, SIGNAL(pressed()), this, SLOT(addOrientationKeyframe()));
    connect( ui->rem_keyframe_pos, SIGNAL(pressed()), this, SLOT(removePositionKeyframe()));
    connect( ui->rem_keyframe_ori, SIGNAL(pressed()), this, SLOT(removeOrientationKeyframe()));

    connect( ui->push_button_traj_pos, SIGNAL(toggled(bool)), this, SLOT(displayTrajectoryPosition(bool)));
    connect( ui->push_button_traj_ori, SIGNAL(toggled(bool)), this, SLOT(displayTrajectoryOrientation(bool)));

    //render
    connect( ui->checkbox_render_box, SIGNAL(toggled(bool)), this, SLOT(updateRenderBox(bool)) );
    connect( ui->checkBox_render_bones, SIGNAL(toggled(bool)), this, SLOT(updateRenderBones(bool)) );

    connect( ui->comboBox_shader, SIGNAL(currentIndexChanged(int)), ui->viewer, SLOT(setCurrentShader(int)) );

    //scene
    connect( ui->comboBox_scene, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCurrentScene(int)) );

    connect( ui->viewer, SIGNAL(updateSelected(int)), this, SLOT(setSelectedByID(int)) );

    //connect( ui->push_ikmode, SIGNAL(toggled(bool)), this, SLOT(setIKMode(bool)) );

    connect( ui->inverse, SIGNAL(currentIndexChanged(int)), this, SLOT(setInverse(int)) );

    connect(ui->tab_widget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));

    connect(ui->combo_end, SIGNAL(currentIndexChanged(int)), this, SLOT(setIKTarget()) );

    connect(ui->spinx, SIGNAL(valueChanged(double)), this, SLOT(changeGoal()) );
    connect(ui->spiny, SIGNAL(valueChanged(double)), this, SLOT(changeGoal()) );
    connect(ui->spinz, SIGNAL(valueChanged(double)), this, SLOT(changeGoal()) );

    connect(ui->save_orientations, SIGNAL(clicked()), this, SLOT(saveAngles()) ) ;

    connect(ui->spin_frame, SIGNAL(valueChanged(int)), this, SLOT(changeCurrentFrame(int)) );


    // interface
    this->showMaximized();

    play_icon = QIcon(QPixmap::fromImage(QImage(":/buttons/play.png")));
    pause_icon = QIcon(QPixmap::fromImage(QImage(":/buttons/pause.png")));
    stop_icon = QIcon(QPixmap::fromImage(QImage(":/buttons/stop.png")));
}