Exemplo n.º 1
0
void Scene::update() {
	if (player) {
		updateObject(*player);
	}
	
	for(auto &object : m_objects) updateObject(object);
}
Exemplo n.º 2
0
/**
 * Processes queue events
 */
static void processObjEvent(UAVObjEvent * ev)
{
    UAVObjMetadata metadata;
    UAVObjUpdateMode updateMode;
    FlightTelemetryStatsData flightStats;
    int32_t retries;
    int32_t success;

    if (ev->obj == 0) {
        updateTelemetryStats();
    } else if (ev->obj == GCSTelemetryStatsHandle()) {
        gcsTelemetryStatsUpdated();
    } else {
        // Only process event if connected to GCS or if object FlightTelemetryStats is updated
        FlightTelemetryStatsGet(&flightStats);
        // Get object metadata
        UAVObjGetMetadata(ev->obj, &metadata);
        updateMode = UAVObjGetTelemetryUpdateMode(&metadata);
        if (flightStats.Status == FLIGHTTELEMETRYSTATS_STATUS_CONNECTED || ev->obj == FlightTelemetryStatsHandle()) {
            // Act on event
            retries = 0;
            success = -1;
            if (ev->event == EV_UPDATED || ev->event == EV_UPDATED_MANUAL || ((ev->event == EV_UPDATED_PERIODIC) && (updateMode != UPDATEMODE_THROTTLED))) {
                // Send update to GCS (with retries)
                while (retries < MAX_RETRIES && success == -1) {
                    success = UAVTalkSendObject(uavTalkCon, ev->obj, ev->instId, UAVObjGetTelemetryAcked(&metadata), REQ_TIMEOUT_MS);	// call blocks until ack is received or timeout
                    ++retries;
                }
                // Update stats
                txRetries += (retries - 1);
                if (success == -1) {
                    ++txErrors;
                }
            } else if (ev->event == EV_UPDATE_REQ) {
                // Request object update from GCS (with retries)
                while (retries < MAX_RETRIES && success == -1) {
                    success = UAVTalkSendObjectRequest(uavTalkCon, ev->obj, ev->instId, REQ_TIMEOUT_MS);	// call blocks until update is received or timeout
                    ++retries;
                }
                // Update stats
                txRetries += (retries - 1);
                if (success == -1) {
                    ++txErrors;
                }
            }
            // If this is a metaobject then make necessary telemetry updates
            if (UAVObjIsMetaobject(ev->obj)) {
                updateObject(UAVObjGetLinkedObj(ev->obj), EV_NONE);	// linked object will be the actual object the metadata are for
            }
        }
        if((updateMode == UPDATEMODE_THROTTLED) && !UAVObjIsMetaobject(ev->obj)) {
            // If this is UPDATEMODE_THROTTLED, the event mask changes on every event.
            updateObject(ev->obj, ev->event);
        }
    }
}
Exemplo n.º 3
0
ObjectWidget::ObjectWidget(const SceneObject& object, QWidget* parent) : DockWidget(object, parent),
  objectRenderer(Document::document->getSimulation(), object.name.toAscii().constData()), objectGlWidget(0),
  showSensorsAct(0), showDrawingsAct(0)
{
  connect(Document::document, SIGNAL(updatedSceneGraph()), this, SLOT(updateObject()));
  connect(Document::document, SIGNAL(restoreLayoutSignal()), this, SLOT(restoreLayout()));
  connect(Document::document, SIGNAL(writeLayoutSignal()), this, SLOT(writeLayout()));
  connect(Document::document, SIGNAL(updateViewsSignal()), this, SLOT(updateView()));
  updateObject();
}
Exemplo n.º 4
0
void LevelOneScreen::update(){
	
	checkInput();

	//Update the player and monsters.
	updateObject();

	_camera.setPosition(_level->getCameraPos(_player->getPosition(),_screenSize, _camera.getScale()));
	_camera.update();

	if (_needToDrawGoal) {
		
		glm::vec2 centerPos = _player->calculatePositionInGrid();
		if (_level->getSymbol((int)centerPos.x, (int)centerPos.y) == '#') {
			_player->setReachedState(true);
			_currentState = MasaEngine::ScreenState::CHANGE_NEXT;
		}
	}

	if ((int)_monsters.size() == 0 && !_needToDrawGoal) {
		_needToDrawGoal = true;
		MasaEngine::SoundEffect openDoor = _audioEngine.loadSoundEffect("Sound/openDoor.ogg");
		openDoor.play();
	}

}
Exemplo n.º 5
0
void IconStorage::insertAutoIcon(QObject *AObject, const QString &AKey, int AIndex, int AAnimate, const QString &AProperty)
{
	IconStorage *oldStorage = FObjectStorage.value(AObject);
	if (oldStorage!=NULL && oldStorage!=this)
		oldStorage->removeAutoIcon(AObject);

	if (AObject!=NULL && !AKey.isEmpty())
	{
		IconUpdateParams *params;
		if (oldStorage!=this)
		{
			params = new IconUpdateParams;
			FObjectStorage.insert(AObject,this);
			FUpdateParams.insert(AObject,params);
		}
		else
		{
			params = FUpdateParams.value(AObject);
		}
		params->key = AKey;
		params->index = AIndex;
		params->prop = AProperty;
		params->animate = AAnimate;
		initAnimation(AObject,params);
		updateObject(AObject);
		connect(AObject,SIGNAL(destroyed(QObject *)),SLOT(onObjectDestroyed(QObject *)));
	}
	else if (AObject!=NULL)
	{
		removeAutoIcon(AObject);
	}
}
Exemplo n.º 6
0
void gProjectCore::updateObjects(const QString &host,const QString &dbName,const QStringList &selObjects,
                                 const gListSQlObjts &,gObjectDBType objType)
{
    QChar separator=QDir::separator();
    QDir dir(path+separator+name+separator+host+separator+dbName);
    dir.cd(getDirNameByObjType(objType));

    QStringList objFiles=dir.entryList(QStringList()<<"*.sql",QDir::Files,QDir::Name);
    objFiles.replaceInStrings(".sql","");
    for (int i=0;i<selObjects.count();i++){
        QString objName=selObjects.at(i);
        int index=objFiles.indexOf(objName);
        if (index>-1){
            updateObject(host,dbName,objName,objType);
            objFiles.removeAt(index);
        }else{
            gConnection *connection=connections.findDBByHostDB(host,dbName);
            if (!connection)
                return;

            QByteArray objText=connection->getObjText(objName,objType);
            QFile file(dir.path()+"/"+objName+".sql");
            if (file.open(QIODevice::WriteOnly)){
                file.write(objText);
                emit sigAddObj(host,dbName,objName,objType);
                file.close();
            }
        }
    }

    for (int i=0;i<objFiles.count();i++){
        removeObject(host,dbName,objFiles.at(i),objType);
    }
}
Exemplo n.º 7
0
Status Editor::setObject(Object* newObject)
{
    if (newObject == nullptr)
    {
        Q_ASSERT(false);
        return Status::INVALID_ARGUMENT;
    }

    if (newObject == mObject.get())
    {
        return Status::SAFE;
    }

    clearUndoStack();
    mObject.reset(newObject);

    for (BaseManager* m : mAllManagers)
    {
        m->load(mObject.get());
    }

    g_clipboardVectorImage.setObject(newObject);

    updateObject();

    if (mViewManager)
    {
        connect(newObject, &Object::layerViewChanged, mViewManager, &ViewManager::viewChanged);
    }

    emit objectLoaded();

    return Status::OK;
}
Exemplo n.º 8
0
/**
 * Register a new object, adds object to local list and connects the queue depending on the object's
 * telemetry settings.
 * \param[in] obj Object to connect
 */
static void registerObject(UAVObjHandle obj)
{
	if (UAVObjIsMetaobject(obj)) {
		/* Only connect change notifications for meta objects.  No periodic updates */
		UAVObjConnectQueue(obj, priorityQueue, EV_MASK_ALL_UPDATES);
		return;
	} else {
		UAVObjMetadata metadata;
		UAVObjUpdateMode updateMode;
		UAVObjGetMetadata(obj, &metadata);
		updateMode = UAVObjGetTelemetryUpdateMode(&metadata);

		/* Only create a periodic event for objects that are periodic */
		if ((updateMode == UPDATEMODE_PERIODIC) ||
			(updateMode == UPDATEMODE_THROTTLED)) {
			// Setup object for periodic updates
			UAVObjEvent ev = {
				.obj    = obj,
				.instId = UAVOBJ_ALL_INSTANCES,
				.event  = EV_UPDATED_PERIODIC,
			};
			EventPeriodicQueueCreate(&ev, queue, 0);
		}

		// Setup object for telemetry updates
		updateObject(obj, EV_NONE);
	}
Exemplo n.º 9
0
void Object::mergeBoundingBox(const BoundingBox &box)
{
	int x1, y1, x2, y2;
	if( box.topLeft.getX() < lastImageTopLeftX) {
		x1 = box.topLeft.getX();
	} else {
		x1 = lastImageTopLeftX;
	}

	if( box.topLeft.getY() < lastImageTopLeftY) {
		y1 = box.topLeft.getY();
	} else {
		y1 = lastImageTopLeftY;
	}

	if( (box.topLeft.getX() + box.width) > (lastImageTopLeftX + lastImageWidth)) {
		x2 = (box.topLeft.getX() + box.width);
	} else {
		x2 = (lastImageTopLeftX + lastImageWidth);
	}

	if( (box.topLeft.getY() + box.height) > (lastImageTopLeftY + lastImageHeight)) {
		y2 = (box.topLeft.getY() + box.height);
	} else {
		y2 = (lastImageTopLeftY + lastImageHeight);
	}

	bool lastSeen = lastImageSeen;
	updateObject( x1, y1, (x2 - x1), (y2 - y1));
	lastImageSeen = lastSeen;
}
Exemplo n.º 10
0
void MeshInfo::on_chkDoubleSide_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 11
0
void MeshInfo::on_chkIlluminated_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 12
0
/**
 * Register a new object, adds object to local list and connects the queue depending on the object's
 * telemetry settings.
 * \param[in] obj Object to connect
 */
static void registerObject(UAVObjHandle obj)
{
	// Setup object for periodic updates
	addObject(obj);

	// Setup object for telemetry updates
	updateObject(obj);
}
Exemplo n.º 13
0
/**
 * Register a new object for periodic updates (if enabled)
 */
void Telemetry::registerObject(UAVObject* obj)
{
    // Setup object for periodic updates
    addObject(obj);

    // Setup object for telemetry updates
    updateObject(obj);
}
Exemplo n.º 14
0
void TweenInfo::on_chkPlayAtStart_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 15
0
void TweenInfo::on_cmbNextTweenBone_currentIndexChanged(int index)
{
    if (index > 0)
    {

    }
    updateObject();
}
Exemplo n.º 16
0
void MaterialInfo::on_txtAlphaTest_valueChanged(double arg1)
{
    if (arg1 > 0.0)
    {

    }
    updateObject();
}
Exemplo n.º 17
0
void MeshInfo::on_chkReflective_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 18
0
void MaterialInfo::on_rbDivide_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 19
0
void TweenInfo::on_chkAllwaysUpdate_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 20
0
void MaterialInfo::on_rbMultiply_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 21
0
void MaterialInfo::on_rbInvert_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 22
0
void MaterialVar_Matrix::on_txt_3_3_valueChanged(double arg1)
{
    if (arg1)
    {

    }
    updateObject();
}
Exemplo n.º 23
0
void MeshInfo::on_chkReceiveShadows_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 24
0
void MaterialInfo::on_cmbShader_currentIndexChanged(int index)
{
    if (index)
    {

    }
    updateObject();
}
Exemplo n.º 25
0
void MeshInfo::on_cmbMaterial_currentIndexChanged(int index)
{
    if (index)
    {

    }
    updateObject();
}
Exemplo n.º 26
0
void MaterialInfo::on_rbClamp1_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 27
0
void MeshInfo::on_chkGlow_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 28
0
void MaterialInfo::on_rbRepeat2_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}
Exemplo n.º 29
0
void MaterialInfo::on_cmbTexture2_currentIndexChanged(int index)
{
    if (index)
    {

    }
    updateObject();
}
Exemplo n.º 30
0
void TweenInfo::on_chkIgnoreTimeScale_toggled(bool checked)
{
    if (checked)
    {

    }
    updateObject();
}