void ChildAlias::mouseDown (const MouseEvent& e) { //if (e.mods.isLeftButtonDown()){ ((CabbageMainPanel*)(getTarget()->getParentComponent()))->setMouseState("down"); toFront (true); if (e.eventComponent == resizer) { } else { //added a constrainer so that components can't be dragged off-screen constrainer->setMinimumOnscreenAmounts(getHeight(), getWidth(), getHeight(), getWidth()); dragger.startDraggingComponent (this,e); } userAdjusting = true; startBounds = getBounds (); userStartedChangingBounds (); //get the bounds of each of the child components if we are dealing with a plant Component* c = (Component*) target.getComponent (); origBounds.clear(); for(int i=0;i<c->getNumChildComponents();i++){ origBounds.add(c->getChildComponent(i)->getBounds()); } //update dimensions int offX = getProperties().getWithDefault(var::identifier("plantX"), 0); int offY = getProperties().getWithDefault(var::identifier("plantY"), 0); ((CabbageMainPanel*)(getTarget()->getParentComponent()))->setIndex(index); ((CabbageMainPanel*)(getTarget()->getParentComponent()))->currentBounds.setBounds(getPosition().getX()-offX, getPosition().getY()-offY, getWidth(), getHeight()); ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:Down"); #ifdef Cabbage_Build_Standalone if(e.mods.isRightButtonDown()){ PopupMenu m; m.setLookAndFeel(&getParentComponent()->getLookAndFeel()); m.addItem(2, "Delete"); m.addItem(1, "Add to repository"); int choice = m.show(); if(choice==1){ this->getTopLevelComponent()->setAlwaysOnTop(false); AlertWindow alert("Add to Repository", "Enter a name and hit 'escape'", AlertWindow::NoIcon, this->getTopLevelComponent()); CabbageLookAndFeel basicLookAndFeel; alert.setLookAndFeel(&basicLookAndFeel); alert.setColour(TextEditor::textColourId, Colours::white); //alert.addTextBlock("Enter a name and hit 'escape'(The following symbols not premitted in names:"" $ % ^ & * ( ) - + )"); alert.addTextEditor("textEditor", "name", ""); alert.runModalLoop(); this->getTopLevelComponent()->setAlwaysOnTop(true); bool clashingNames=false; int result; String plantDir = appProperties->getUserSettings()->getValue("PlantFileDir", ""); Logger::writeToLog(plantDir); Array<File> tempfiles; StringArray plants; addFileToPpopupMenu(m, tempfiles, plantDir, "*.plant"); for(int i=0;i<tempfiles.size();i++){ Logger::outputDebugString(tempfiles[i].getFullPathName()); plants.add(tempfiles[i].getFileNameWithoutExtension()); } for(int i=0;i<plants.size();i++) if(plants[i]==alert.getTextEditorContents("textEditor")) clashingNames = true; if(clashingNames==true){ result = CabbageUtils::showYesNoMessage("Do you wish to overwrite the existing plant?", &getLookAndFeel()); if(result == 0) ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:AddingPlant:"+alert.getTextEditorContents("textEditor")); else showMessage("Nothing written to repository", &getLookAndFeel()); } else ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:AddingPlant:"+alert.getTextEditorContents("textEditor")); } else if(choice==2){ ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:delete:"); } } #endif }
void GroupReference::targetObjectDestroyLink() { // called from unlink() getTarget()->DelinkMember(this); }
//============================================================ // Tell our refTo (target) object that we have a link void HostileReference::targetObjectBuildLink() { getTarget()->AddHatedBy(this); }
void FollowerReference::targetObjectBuildLink() { getTarget()->addFollower(this); }
/* Returns Right Vector */ Vector Camera::getRight() { Vector right = crossProduct(getTarget(), this->up); right.normalize(); return right; }
void ActionEquip::executeImp (const Ptr& actor) { MWWorld::Ptr object = getTarget(); MWWorld::InventoryStore& invStore = actor.getClass().getInventoryStore(actor); std::pair <int, std::string> result = object.getClass().canBeEquipped (object, actor); // display error message if the player tried to equip something if (!result.second.empty() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr()) MWBase::Environment::get().getWindowManager()->messageBox(result.second); switch(result.first) { case 0: return; case 2: invStore.unequipSlot(MWWorld::InventoryStore::Slot_CarriedLeft, actor); break; case 3: invStore.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, actor); break; } // slots that this item can be equipped in std::pair<std::vector<int>, bool> slots_ = getTarget().getClass().getEquipmentSlots(getTarget()); // retrieve ContainerStoreIterator to the item MWWorld::ContainerStoreIterator it = invStore.begin(); for (; it != invStore.end(); ++it) { if (*it == object) { break; } } assert(it != invStore.end()); // equip the item in the first free slot for (std::vector<int>::const_iterator slot=slots_.first.begin(); slot!=slots_.first.end(); ++slot) { // if the item is equipped already, nothing to do if (invStore.getSlot(*slot) == it) return; // if all slots are occupied, replace the last slot if (slot == --slots_.first.end()) { invStore.equip(*slot, it, actor); break; } if (invStore.getSlot(*slot) == invStore.end()) { // slot is not occupied invStore.equip(*slot, it, actor); break; } } }
void RangedManager::executeMicro(const UnitVector & targets) { const UnitVector & rangedUnits = getUnits(); // figure out targets UnitVector rangedUnitTargets; for (size_t i(0); i<targets.size(); i++) { // conditions for targeting if (targets[i]->isVisible()) { rangedUnitTargets.push_back(targets[i]); } } // for each zealot BOOST_FOREACH(BWAPI::Unit * rangedUnit, rangedUnits) { // train sub units such as scarabs or interceptors //trainSubUnits(rangedUnit); // if the order is to attack or defend if (order.type == order.Attack || order.type == order.Defend) { // if there are targets if (!rangedUnitTargets.empty()) { // find the best target for this zealot BWAPI::Unit * target = getTarget(rangedUnit, rangedUnitTargets); /* if ( rangedUnit->getType().groundWeapon().maxRange() < target->getDistance(rangedUnit)) { if(rangedUnit->getType() == BWAPI::UnitTypes::Zerg_Lurker) { //BWAPI::Broodwar->printf("############# Lurker in distance: %d ###############", rangedUnit->getID()); LurkerBurrow(rangedUnit); } } */ // attack it kiteTarget(rangedUnit, target); } // if there are no targets else { // if we're not near the order position if (rangedUnit->getDistance(order.position) > 100) { // move to it smartAttackMove(rangedUnit, order.position); } } } if (Options::Debug::DRAW_UALBERTABOT_DEBUG) { BWAPI::Broodwar->drawLineMap(rangedUnit->getPosition().x(), rangedUnit->getPosition().y(), rangedUnit->getTargetPosition().x(), rangedUnit->getTargetPosition().y(), Options::Debug::COLOR_LINE_TARGET); } } }
bool Properties::hasStaticProperty( QString propertyName ) const { if ( getTarget() == nullptr ) return false; return ( getTarget()->metaObject( )->indexOfProperty( propertyName.toLatin1( ) ) != -1 ); }
llvm_dsp_factory* FaustgenFactory::createFactoryFromSourceCode(FaustAudioPluginInstance* instance) { defaultCompileOptions(); // Prepare compile options std::string error; const char* argv[64]; memset(argv, 0, 64 * sizeof(char*)); jassert(fCompileOptions.size() < 64); for (auto opt = 0; opt < fCompileOptions.size(); opt++) { argv[opt] = (char*) fCompileOptions.getReference(opt).toRawUTF8(); } argv[fCompileOptions.size()] = 0; // NULL terminated argv llvm_dsp_factory* factory = createDSPFactoryFromString(getTMPName().toStdString(), fSourceCode.toStdString(), fCompileOptions.size(), argv, getTarget(), error, LLVM_OPTIMIZATION); if (factory) { return factory; } else { if (fUpdateInstance == instance) { instance->highlightON(error); } LOG("Invalid Faust code or compile options:" + error); return 0; } }
IRCTargetType IRCRoom::getType() const { return getTarget()->getType(); }
shared_ptr<IRCSession> IRCRoom::getSession() const { return getTarget()->getSession(); }
std::string IRCRoom::getName() const { return getTarget()->getName(); }
bool Ammo::perform( Action a, const Target& t ) { switch ( a ) { case aPolymorph: form = Random::randint( ammoStats::numAmmo ); image.val.color = ammoStats::AmmoStats[form].color; return Item::perform(a, t); case aFire: { // We now just mark the bullet as fired, to ensure it disappears: fired = true; // This code should no longer be called, thus: /* Point3d me=getlocation(), target = t->getlocation(); int acc = ammoStats::AmmoStats[form].accuracy; int scatter = (acc * max( abs((me-target).getx()), abs((me-target).gety()) ) ) / 10; scatter = scatter / 2-scatter; // Multiple attacks: int numslugs = ammoStats::AmmoStats[form].numslugs; if (numslugs > 1) for (int slugs = 1; slugs < numslugs; slugs++) { Target slug = clone(); target = t->getlocation() + Point3d( Random::randint(scatter),Random::randint(scatter), 0 ); Target parent = getTarget(tg_parent); assert(!!parent); parent->perform(aContain,slug); FlightPath::Option flight_opt; flight_opt.object = slug; flight_opt.start = me; flight_opt.delta = Point3d( target-me ).toPoint(); FlightPath::create( flight_opt ); } // Make sure that at least this bullet hits the target: target = t->getlocation();// + Point( Random::randint(scatter),Random::randint(scatter) ); Target tMe = Target(THIS); FlightPath::Option flight_opt; flight_opt.object = tMe; flight_opt.start = me; flight_opt.delta = Point3d( target-me ).toPoint(); FlightPath::create( flight_opt ); */ return true; } case aRestack: if (fired) { Cloud::Option cloud_opt; Target my_parent = getTarget(tg_parent); // Sometimes this can fail. No memory leak caused, // though I should find the cause when I can. //assert(!!my_parent); if (!my_parent) { // May have negative effect on grenade use. // In any case, fail gracefully & don't tell the player: //Message::add("Ammo::perform(aRestack) failure."); return false; } switch (ammoStats::AmmoStats[form].effect) { case ae_smoke: if (my_parent != NULL) { cloud_opt.material = m_smoke; my_parent->perform( aContain, Cloud::create(cloud_opt) ); } break; case ae_gas: if (my_parent != NULL) { cloud_opt.material = m_poison; my_parent->perform( aContain, Cloud::create(cloud_opt) ); } break; case ae_explode: { // Grenades must soon be rewritten // to acommodate for the new global positioning. /* Point loc = getlocation().toPoint(), cursor = Screen::cursorat(); // All grenade rounds have an explosion radius of 2 int radius = 2, gx = loc.getx(), gy = loc.gety(), x, y; bool **los; los = new bool *[radius*2+1]; for (int i = 0; i < radius*2+1; ++i) los[i] = new bool[radius*2+1]; // xa = max(x-radius,0), xb = min(x+radius,(int)(map_width-1)), // ya = max(y-radius,0), yb = min(y+radius,(int)(map_height-1)); Level &lev = getlevel(); Rectangle lev_border = lev.getBorder(); Target deliverer = getTarget(tg_controller); Attack dam( 6, DiceRoll(4,3), CombatValues(dam_burn,+10), deliverer, THIS, "grenaded" ); Screen::Buffer restore; restore.setSize( Rectangle(max(gx-radius+1,lev_border.getxa()+1)+Screen::mapxoff, max(gy-radius+1,lev_border.getya()+1)+Screen::mapyoff, min(gx+radius+1,lev_border.getxb()+1)+Screen::mapxoff, min(gy+radius+1,lev_border.getyb()+1)+Screen::mapyoff) ); for (y = -radius; y <= radius; ++y) for (x = -radius; x <= radius; ++x) { los[x+radius][y+radius] = false; if ( lev_border.contains( Point(gx+x,gy+y) ) ) { Path p; p.set( loc, loc+Point(x,y) ); p.calculate(); if ( p.hasLOS(lev) ) los[x+radius][y+radius] = true; } } Screen::hidecursor(); for (y = -radius; y <= radius; ++y) for (x = -radius; x <= radius; ++x) if (los[x+radius][y+radius] && lev.getTile( Point(gx+x,gy+y) )->getVal(attrib_visible)) LEVDRAW(gx+x,gy+y, Image(cRed,'*')); Screen::locate(cursor); Screen::showcursor(); Screen::nextFrame(); Screen::hidecursor(); for (y = -radius; y <= radius; ++y) for (x = -radius; x <= radius; ++x) if (los[x+radius][y+radius] && lev.getTile( Point(gx+x,gy+y) )->getVal(attrib_visible)) LEVDRAW(gx+x,gy+y, Image(cOrange,'*')); Screen::locate(cursor); Screen::showcursor(); Screen::nextFrame(); Screen::hidecursor(); for (y = -radius; y <= radius; ++y) for (x = -radius; x <= radius; ++x) if (los[x+radius][y+radius] && lev.getTile( Point(gx+x,gy+y) )->getVal(attrib_visible)) LEVDRAW(gx+x,gy+y, Image(cYellow,'*')); Screen::locate(cursor); Screen::showcursor(); Screen::nextFrame(); Screen::hidecursor(); restore.moveToScreen(); for (y = -radius; y <= radius; ++y) for (x = -radius; x <= radius; ++x) if (los[x+radius][y+radius]) lev.getTile( Point(gx+x,gy+y) )->takeDamage( dam ); Screen::locate(cursor); Screen::showcursor(); for (int i = 0; i < radius*2+1; ++i) delarr(los[i]); delarr(los); */ break; } default: break; } detach(); } else { return Item::perform(a, t); } return true; case aLand: if ( ammoStats::AmmoStats[form].type == bul_grenade ) { fired = true; } return Item::perform(a, t); case aAttack: { // If this slug was fired, make sure to give 'shooty' messages: String subject, object, hit_str = "hit~"; Target shooter; // If the bullet was fired you want the, "You shoot the frog." // message; otherwise you want a "The bullet hits the frog." message. if (fired) { shooter = getTarget(tg_controller); } else { shooter = THIS; } subject = Grammar::Subject(shooter, Grammar::det_definite); object = Grammar::Object(t, Grammar::det_definite); if (fired) { hit_str = "shoot~"; } bool t_was_alive = t->getVal(attrib_alive); t->takeDamage( getAttack() ); // If we have killed the target: if ( t->getVal(attrib_alive) != t_was_alive ) if (t->getVal(attrib_flesh_blood)) { hit_str = "kill~"; } else { hit_str = "destroy~"; } if ( RawTarget::getVal(attrib_visible) || t->getVal(attrib_visible) ) { Message::add( subject + " " + Grammar::plural(hit_str, 2 - shooter->getVal(attrib_plural), true, false) + " " + object + "." ); } return true; } default: return Item::perform(a, t); } }
void RandomGen::exec( Array< Sample > &samples ) { for ( int i = 0 ; i < outputsCount() ; ++i ) samples += ( Sample ){ getTarget( i ), qrand() / ( RAND_MAX / 2.0f ) - 1.0f }; }
void VBO::unbind() { if (!is_mapped) glBindBufferARB(getTarget(), 0); }
dsp* FaustgenFactory::createDSPAux(FaustAudioPluginInstance* instance) { dsp* dsp = nullptr; std::string error; String logStr; // Factory already allocated if (fDSPfactory) { dsp = fDSPfactory->createDSPInstance(); logStr << "Factory already allocated, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)"; goto end; } // Tries to create from bitcode if (fBitCode.length() > 0) { fDSPfactory = createFactoryFromBitcode(); if (fDSPfactory) { dsp = fDSPfactory->createDSPInstance(); logStr << "Compilation from bitcode succeeded, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)"; goto end; } } // Otherwise tries to create from source code if (fSourceCode.length() > 0) { fDSPfactory = createFactoryFromSourceCode(instance); if (fDSPfactory) { dsp = fDSPfactory->createDSPInstance(); logStr << "Compilation from source code succeeded, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)"; goto end; } } // Otherwise creates default DSP keeping the same input/output number fDSPfactory = createDSPFactoryFromString("default", DEFAULT_CODE, 0, 0, getTarget(), error, LLVM_OPTIMIZATION); jassert(fDSPfactory); if (fDSPfactory) { dsp = fDSPfactory->createDSPInstance(); logStr << "Allocation of default DSP succeeded, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)"; } end: LOG(logStr); jassert(dsp); // Prepare JSON JSONUI builder(dsp->getNumInputs(), dsp->getNumOutputs()); dsp->metadata(&builder); dsp->buildUserInterface(&builder); fJSON = String(builder.JSON()); //LOG(fJSON); return dsp; }
void RangedManager::executeMicro(const UnitVector & targets) { const UnitVector & rangedUnits = getUnits(); // figure out targets UnitVector rangedUnitTargets; for (size_t i(0); i<targets.size(); i++) { // conditions for targeting if (targets[i]->isVisible()) { rangedUnitTargets.push_back(targets[i]); } } // for each zealot BOOST_FOREACH(BWAPI::Unit * rangedUnit, rangedUnits) { // train sub units such as scarabs or interceptors //trainSubUnits(rangedUnit); // if the order is to attack or defend if (order.type == order.Attack || order.type == order.Defend || order.type == order.Tanks || order.type == order.Vultures || order.type == order.Goliaths || order.type == order.Marines) { // if there are targets if (!rangedUnitTargets.empty()) { // find the best target for this zealot BWAPI::Unit * target = getTarget(rangedUnit, rangedUnitTargets); // attack it if (!rangedUnit->getType() == BWAPI::UnitTypes::Terran_Siege_Tank_Tank_Mode) { kiteTarget(rangedUnit, target); } else { smartPositionAndDefend(rangedUnit,order.position); } } // if there are no targets else { // if we're not in range of the position if (rangedUnit->getDistance(order.position) > rangedUnit->getInitialType().groundWeapon().maxRange()) { //unsiege tanks if they're sieged if (rangedUnit->getType() == BWAPI::UnitTypes::Terran_Siege_Tank_Siege_Mode) { rangedUnit->unsiege(); } // move to it if (! (order.type == order.Defend)) { smartAttackMove(rangedUnit, order.position); } else { smartPositionAndDefend(rangedUnit,order.position); } } //else if we're in range and we're supposed to s else if (rangedUnit->getType() == BWAPI::UnitTypes::Terran_Siege_Tank_Tank_Mode) { rangedUnit->siege(); } } } if (Options::Debug::DRAW_UALBERTABOT_DEBUG) { BWAPI::Broodwar->drawLineMap(rangedUnit->getPosition().x(), rangedUnit->getPosition().y(), rangedUnit->getTargetPosition().x(), rangedUnit->getTargetPosition().y(), Options::Debug::COLOR_LINE_TARGET); } } }
void RTSCamera::animate(u32 elapsed) { bool movebymouse = false; f32 nRotX = rotX; f32 nRotY = rotY; f32 nZoom = currentZoom; vector3df translate(oldTarget); vector3df tvectX = Pos - Target; tvectX = tvectX.crossProduct(UpVector); tvectX.normalize(); // if(oldTarget.X != 0) // { // } //Zoom if (isMouseButtonDown(MOUSE_BUTTON_RIGHT) && isMouseButtonDown(MOUSE_BUTTON_LEFT)) { if (!zooming) { zoomStartX = MousePos.X; zoomStartY = MousePos.Y; zooming = true; nZoom = currentZoom; } else { f32 old = nZoom; nZoom += (zoomStartX - MousePos.X) * zoomSpeed * 100; // f32 targetMinDistance = 0.1f; // if (nZoom < targetMinDistance) // nZoom = targetMinDistance; if (nZoom < targetMinDistance) nZoom = targetMinDistance; else if (nZoom > targetMaxDistance) nZoom = targetMaxDistance; if (nZoom < 0) nZoom = old; } } else { if (zooming) { f32 old = currentZoom; currentZoom = currentZoom + (zoomStartX - MousePos.X ) * zoomSpeed; nZoom = currentZoom; if (nZoom < 0) nZoom = currentZoom = old; } zooming = false; } //We rotate in Editor with right mouse button if(isMouseButtonDown(MOUSE_BUTTON_RIGHT) && !isKeyDown(KEY_SHIFT) && !isKeyDown(KEY_LSHIFT) && !isKeyDown(KEY_RSHIFT)) { movebymouse = true; if (!rotating) { rotateStartX = MousePos.X; rotateStartY = MousePos.Y; rotating = true; //nRotX = rotX; //nRotY = rotY; } else { nRotX -= (rotateStartX - MousePos.X) * rotateSpeed * (f32)elapsed/500; nRotY -= (rotateStartY - MousePos.Y) * rotateSpeed * (f32)elapsed/500; rotX = nRotX;//rotX - (rotateStartX - MousePos.X) * rotateSpeed * (f32)elapsed/500; rotY = nRotY;//rotY - (rotateStartY - MousePos.Y) * rotateSpeed * (f32)elapsed/500; if(rotY < -350) { rotY = -350; nRotY = -350; } if(rotY > -280) { rotY = -280; nRotY = -280; } printf("PERA CAMERA:%f\n", rotY); } } else { if (rotating) { rotX = rotX - (rotateStartX - MousePos.X) * rotateSpeed * (f32)elapsed/500; rotY = rotY - (rotateStartY - MousePos.Y) * rotateSpeed * (f32)elapsed/500; nRotX = rotX; nRotY = rotY; } rotating = false; } //Translate if(isMouseButtonDown(MOUSE_BUTTON_RIGHT) && (isKeyDown(KEY_SHIFT) || isKeyDown(KEY_LSHIFT) || isKeyDown(KEY_RSHIFT))) { movebymouse = true; if (!translating) { translateStartX = MousePos.X; translateStartY = MousePos.Y; translating = true; } else { translate += tvectX * (translateStartX - MousePos.X) * translateSpeed * (f32)elapsed/100; translate.X += tvectX.Z * (translateStartY - MousePos.Y) * translateSpeed * (f32)elapsed/100; translate.Z -= tvectX.X * (translateStartY - MousePos.Y) * translateSpeed * (f32)elapsed/100; oldTarget = translate; } } else if (isKeyDown(KEY_KEY_W) || isKeyDown(KEY_UP) && !zooming && !isKeyDown(KEY_SHIFT) && !isKeyDown(KEY_LSHIFT) && !isKeyDown(KEY_RSHIFT)) { if (!translating) translating = true; else { vector3df movevector = getPosition() - getTarget(); movevector.Y = 0; movevector.normalize(); translate =getTarget() - movevector * translateSpeed * (f32)elapsed/100; oldTarget = translate; //setPosition(getPosition() - movevector * translateSpeed * (f32)elapsed/100); //setTarget(getTarget() - movevector * translateSpeed * (f32)elapsed/100); //updateAbsolutePosition(); } } else if (isKeyDown(KEY_KEY_S) || isKeyDown(KEY_DOWN) && !zooming && !isKeyDown(KEY_SHIFT) && !isKeyDown(KEY_LSHIFT) && !isKeyDown(KEY_RSHIFT)) { if (!translating) translating = true; else { vector3df movevector = getPosition() - getTarget(); movevector.Y = 0; movevector.normalize(); translate =getTarget() + movevector * translateSpeed * (f32)elapsed/100; oldTarget = translate; // setPosition(getPosition() + movevector * translateSpeed * (f32)elapsed/100); // setTarget(getTarget() + movevector * translateSpeed * (f32)elapsed/100); // updateAbsolutePosition(); } } else if (isKeyDown(KEY_KEY_A) || isKeyDown(KEY_LEFT) && !zooming && !isKeyDown(KEY_SHIFT) && !isKeyDown(KEY_LSHIFT) && !isKeyDown(KEY_RSHIFT)) { if (!translating) translating = true; else { /*translate += tvectX * (translateStartX - MousePos.X) * translateSpeed * (f32)elapsed/100; translate.X += tvectX.Z * (translateStartY - MousePos.Y) * translateSpeed * (f32)elapsed/100; translate.Z -= tvectX.X * (translateStartY - MousePos.Y) * translateSpeed * (f32)elapsed/100; */ //= translate; vector3df totargetvector = getPosition() - getTarget(); totargetvector.normalize(); vector3df crossvector = totargetvector.crossProduct(getUpVector()); vector3df strafevector = crossvector.normalize(); translate =getTarget() - strafevector * translateSpeed * (f32)elapsed/100; oldTarget = translate; //setPosition(getPosition() - strafevector * translateSpeed * (f32)elapsed/100); //setTarget(getTarget() - strafevector * translateSpeed * (f32)elapsed/100); //oldTarget = getTarget(); //updateAbsolutePosition(); } } else if (isKeyDown(KEY_KEY_D) || isKeyDown(KEY_RIGHT) && !zooming && !isKeyDown(KEY_SHIFT) && !isKeyDown(KEY_LSHIFT) && !isKeyDown(KEY_RSHIFT)) { if (!translating) translating = true; else { vector3df totargetvector = getPosition() - getTarget(); totargetvector.normalize(); vector3df crossvector = totargetvector.crossProduct(getUpVector()); vector3df strafevector = crossvector.normalize(); translate =getTarget() + strafevector * translateSpeed * (f32)elapsed/100; oldTarget = translate; //setPosition(getPosition() + strafevector * translateSpeed * (f32)elapsed/100); //setTarget(getTarget() + strafevector * translateSpeed * (f32)elapsed/100); //updateAbsolutePosition(); } } else { translating = false; /*moving camera when mouse on screen edges*/ /*if (!translating && !zooming && !rotating) { //Mouse Coordinates go from 0 to 1 on both axes if (MousePos.X < 0.05) //Up { vector3df totargetvector = getPosition() - getTarget(); totargetvector.normalize(); vector3df crossvector = totargetvector.crossProduct(getUpVector()); vector3df strafevector = crossvector.normalize(); setPosition(getPosition() - strafevector * translateSpeed); setTarget(getTarget() - strafevector * translateSpeed); updateAbsolutePosition(); } else if (MousePos.X > 0.95) //Down { vector3df totargetvector = getPosition() - getTarget(); totargetvector.normalize(); vector3df crossvector = totargetvector.crossProduct(getUpVector()); vector3df strafevector = crossvector.normalize(); setPosition(getPosition() + strafevector * translateSpeed); setTarget(getTarget() + strafevector * translateSpeed); updateAbsolutePosition(); } else if (MousePos.Y < 0.05) //Up { vector3df movevector = getPosition() - getTarget(); movevector.Y = 0; movevector.normalize(); setPosition(getPosition() - movevector * translateSpeed); setTarget(getTarget() - movevector * translateSpeed); updateAbsolutePosition(); } else if (MousePos.Y > 0.95) //Down { vector3df movevector = getPosition() - getTarget(); movevector.Y = 0; movevector.normalize(); setPosition(getPosition() + movevector * translateSpeed); setTarget(getTarget() + movevector * translateSpeed); updateAbsolutePosition(); } }*/ } //Set Position //if(movebymouse) //{ Target = translate; Pos.X = nZoom + Target.X; Pos.Y = Target.Y; Pos.Z = Target.Z; Pos.rotateXYBy(nRotY, Target); Pos.rotateXZBy(-nRotX, Target); //Correct Rotation Error UpVector.set(0,1,0); UpVector.rotateXYBy(-nRotY, core::vector3df(0,0,0)); UpVector.rotateXZBy(-nRotX+180.f, core::vector3df(0,0,0)); //} }
int32 HtmlTabCtrl::getCurSel() const { return hasID() ? conversions::from_wstring<int32>(getRequest()->getUrlParam(getTarget().to_wide())) : -1; }
void MapReference::targetObjectBuildLink() { // called from link() getTarget()->m_mapRefManager.insertFirst(this); getTarget()->m_mapRefManager.incSize(); }
void CC3ActionCCNodeSizeTo::update( float t ) { CCNode* tNode = (CCNode*)getTarget(); tNode->setContentSize( CCSizeMake(startSize_.width + (sizeChange_.width * t), startSize_.height + (sizeChange_.height * t)) ); }
void MapReference::targetObjectDestroyLink() { // called from unlink() if (isValid()) getTarget()->m_mapRefManager.decSize(); }
void FollowerReference::targetObjectDestroyLink() { getTarget()->removeFollower(this); }
void MapReference::sourceObjectDestroyLink() { // called from invalidate() getTarget()->m_mapRefManager.decSize(); }
void GroupReference::targetObjectBuildLink() { // called from link() getTarget()->LinkMember(this); }
image::GnashImage* Video::getVideoFrame() { // If this is a video from a NetStream_as object, retrieve a video // frame from there. if (_ns) { std::unique_ptr<image::GnashImage> tmp = _ns->get_video(); if (tmp.get()) _lastDecodedVideoFrame = std::move(tmp); } // If this is a video from a VideoFrame tag, retrieve a video frame // from there. else if (_embeddedStream) { // Don't try to do anything if there is no decoder. If it was // never constructed (most likely), we'll return nothing, // otherwise the last decoded frame. if (!_decoder.get()) { LOG_ONCE(log_error(_("No Video info in video definition"))); return _lastDecodedVideoFrame.get(); } const std::uint16_t current_frame = get_ratio(); #ifdef DEBUG_EMBEDDED_VIDEO_DECODING log_debug("Video instance %s need display video frame (ratio) %d", getTarget(), current_frame); #endif // If current frame is the same then last decoded // we don't need to decode more if (_lastDecodedVideoFrameNum >= 0 && _lastDecodedVideoFrameNum == current_frame) { #ifdef DEBUG_EMBEDDED_VIDEO_DECODING log_debug(" current frame == _lastDecodedVideoFrameNum (%d)", current_frame); #endif return _lastDecodedVideoFrame.get(); } // TODO: find a better way than using -1 to show that no // frames have been decoded yet. assert(_lastDecodedVideoFrameNum >= -1); std::uint16_t from_frame = _lastDecodedVideoFrameNum + 1; // If current frame is smaller then last decoded frame // we restart decoding from scratch if (current_frame < static_cast<size_t>(_lastDecodedVideoFrameNum)) { #ifdef DEBUG_EMBEDDED_VIDEO_DECODING log_debug(" current frame (%d) < _lastDecodedVideoFrameNum (%d)", current_frame, _lastDecodedVideoFrameNum); #endif from_frame = 0; } // Reset last decoded video frame number now, so it's correct // on early return (ie: nothing more to decode) _lastDecodedVideoFrameNum = current_frame; #ifdef DEBUG_EMBEDDED_VIDEO_DECODING log_debug(" decoding embedded frames from %d to %d " "for Video object %s", from_frame, current_frame, getTarget()); #endif const size_t frames = m_def->visitSlice( std::bind(std::mem_fn(&media::VideoDecoder::push), _decoder.get(), std::placeholders::_1), from_frame, current_frame); if (!frames) return _lastDecodedVideoFrame.get(); _lastDecodedVideoFrame = _decoder->pop(); } return _lastDecodedVideoFrame.get(); }
void GroupReference::sourceObjectDestroyLink() { // called from invalidate() getTarget()->DelinkMember(this); }
void VBO::bind() { if (!is_mapped) glBindBufferARB(getTarget(), vbo); }
//============================================================ // Tell our refTo (taget) object, that the link is cut void HostileReference::targetObjectDestroyLink() { getTarget()->RemoveHatedBy(this); }
void DirectXShader::compileShader(const std::shared_ptr<class DirectXRenderer>& renderer, DataChunk data, ID3DInclude* includes, const std::string& entryPoint, ShaderType type) { ComPtr<ID3D10Blob> errors; HRESULT hr = D3DCompile(data.data(), data.size(), "", NULL, includes, entryPoint.c_str(), getTarget(type), D3DCOMPILE_DEBUG | D3DCOMPILE_PREFER_FLOW_CONTROL | D3DCOMPILE_SKIP_OPTIMIZATION, 0, mBlob.getInitRef(), errors.getInitRef()); if (hr != S_OK) { log("%s", errors->GetBufferPointer()); runtimeCheck(false); } switch (type) { case ShaderType::Vertex: hr = renderer->getDevice()->CreateVertexShader(mBlob->GetBufferPointer(), mBlob->GetBufferSize(), nullptr, mVertexShader.getInitRef()); TB::runtimeCheck(hr == S_OK); break; case ShaderType::Pixel: hr = renderer->getDevice()->CreatePixelShader(mBlob->GetBufferPointer(), mBlob->GetBufferSize(), nullptr, mPixelShader.getInitRef()); TB::runtimeCheck(hr == S_OK); break; } }