当前位置: 首页>>代码示例>>C++>>正文


C++ Position类代码示例

本文整理汇总了C++中Position的典型用法代码示例。如果您正苦于以下问题:C++ Position类的具体用法?C++ Position怎么用?C++ Position使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Position类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteSelection

void BreakBlockquoteCommand::doApply()
{
    if (endingSelection().isNone())
        return;
    
    // Delete the current selection.
    if (endingSelection().isRange())
        deleteSelection(false, false);
    
    // This is a scenario that should never happen, but we want to
    // make sure we don't dereference a null pointer below.    

    ASSERT(!endingSelection().isNone());
    
    if (endingSelection().isNone())
        return;
        
    VisiblePosition visiblePos = endingSelection().visibleStart();
    
    // pos is a position equivalent to the caret.  We use downstream() so that pos will 
    // be in the first node that we need to move (there are a few exceptions to this, see below).
    Position pos = endingSelection().start().downstream();
    
    // Find the top-most blockquote from the start.
    Element* topBlockquote = 0;
    for (ContainerNode* node = pos.node()->parentNode(); node; node = node->parentNode()) {
        if (isMailBlockquote(node))
            topBlockquote = static_cast<Element*>(node);
    }
    if (!topBlockquote || !topBlockquote->parentNode())
        return;
    
    RefPtr<Element> breakNode = createBreakElement(document());

    bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockquote);

    // If the position is at the beginning of the top quoted content, we don't need to break the quote.
    // Instead, insert the break before the blockquote, unless the position is as the end of the the quoted content.
    if (isFirstVisiblePositionInNode(visiblePos, topBlockquote) && !isLastVisPosInNode) {
        insertNodeBefore(breakNode.get(), topBlockquote);
        setEndingSelection(VisibleSelection(Position(breakNode.get(), 0), DOWNSTREAM));
        rebalanceWhitespace();   
        return;
    }
    
    // Insert a break after the top blockquote.
    insertNodeAfter(breakNode.get(), topBlockquote);

    // If we're inserting the break at the end of the quoted content, we don't need to break the quote.
    if (isLastVisPosInNode) {
        setEndingSelection(VisibleSelection(Position(breakNode.get(), 0), DOWNSTREAM));
        rebalanceWhitespace();
        return;
    }
    
    // Don't move a line break just after the caret.  Doing so would create an extra, empty paragraph
    // in the new blockquote.
    if (lineBreakExistsAtVisiblePosition(visiblePos))
        pos = pos.next();
        
    // Adjust the position so we don't split at the beginning of a quote.  
    while (isFirstVisiblePositionInNode(VisiblePosition(pos), nearestMailBlockquote(pos.node())))
        pos = pos.previous();
    
    // startNode is the first node that we need to move to the new blockquote.
    Node* startNode = pos.node();
        
    // Split at pos if in the middle of a text node.
    if (startNode->isTextNode()) {
        Text* textNode = static_cast<Text*>(startNode);
        if ((unsigned)pos.deprecatedEditingOffset() >= textNode->length()) {
            startNode = startNode->traverseNextNode();
            ASSERT(startNode);
        } else if (pos.deprecatedEditingOffset() > 0)
            splitTextNode(textNode, pos.deprecatedEditingOffset());
    } else if (pos.deprecatedEditingOffset() > 0) {
        Node* childAtOffset = startNode->childNode(pos.deprecatedEditingOffset());
        startNode = childAtOffset ? childAtOffset : startNode->traverseNextNode();
        ASSERT(startNode);
    }
    
    // If there's nothing inside topBlockquote to move, we're finished.
    if (!startNode->isDescendantOf(topBlockquote)) {
        setEndingSelection(VisibleSelection(VisiblePosition(Position(startNode, 0))));
        return;
    }
    
    // Build up list of ancestors in between the start node and the top blockquote.
    Vector<Element*> ancestors;    
    for (Element* node = startNode->parentElement(); node && node != topBlockquote; node = node->parentElement())
        ancestors.append(node);
    
    // Insert a clone of the top blockquote after the break.
    RefPtr<Element> clonedBlockquote = topBlockquote->cloneElementWithoutChildren();
    insertNodeAfter(clonedBlockquote.get(), breakNode.get());
    
    // Clone startNode's ancestors into the cloned blockquote.
    // On exiting this loop, clonedAncestor is the lowest ancestor
    // that was cloned (i.e. the clone of either ancestors.last()
    // or clonedBlockquote if ancestors is empty).
//.........这里部分代码省略.........
开发者ID:dslab-epfl,项目名称:warr,代码行数:101,代码来源:BreakBlockquoteCommand.cpp

示例2:

std::map<Switch, double> PerfectPathOptimizer::Score(const Position& position) {
  return lane_scores_[position.piece()][position.end_lane()];
}
开发者ID:joechin91,项目名称:helloworldopen2014,代码行数:3,代码来源:perfect_path_optimizer.cpp

示例3: Position

void StructureAgent::debug_showGoal()
{
	if (!isAlive()) return;

	int w = unit->getType().tileWidth() * 32 / 2;
	Broodwar->drawText(CoordinateType::Map, unit->getPosition().x() - w, unit->getPosition().y() - 10, unit->getType().getName().c_str());

	//Draw "is working" box
	int total = 0;
	int done = 0;
	string txt = "";
	Color cColor = Colors::Blue;
	int bar_h = 18;

	if (unit->isBeingConstructed())
	{
		total = unit->getType().buildTime();
		done = total - unit->getRemainingBuildTime();
		txt = "";
		bar_h = 8;
	}
	if (!unit->isBeingConstructed() && unit->getType().isResourceContainer())
	{
		total = unit->getInitialResources();
		done = unit->getResources();
		txt = "";
		cColor = Colors::Orange;
		bar_h = 8;
	}
	if (unit->isResearching())
	{
		total = unit->getTech().researchTime();
		done = total - unit->getRemainingResearchTime();
		txt = unit->getTech().getName();
	}
	if (unit->isUpgrading())
	{
		total = unit->getUpgrade().upgradeTime();
		done = total - unit->getRemainingUpgradeTime();
		txt = unit->getUpgrade().getName();
	}
	if (unit->isTraining())
	{
		if (unit->getTrainingQueue().size() > 0)
		{
			UnitType t = *(unit->getTrainingQueue().begin());
			total = t.buildTime();
			txt = t.getName();
			done = total - unit->getRemainingTrainTime();
		}
	}

	if (total > 0)
	{
		int w = unit->getType().tileWidth() * 32;
		int h = unit->getType().tileHeight() * 32;

		//Start 
		Position s = Position(unit->getPosition().x() - w/2, unit->getPosition().y() - 30);
		//End
		Position e = Position(s.x() + w, s.y() + bar_h);
		//Progress
		int prg = (int)((double)done / (double)total * w);
		Position p = Position(s.x() + prg, s.y() +  bar_h);

		Broodwar->drawBox(CoordinateType::Map,s.x(),s.y(),e.x(),e.y(),cColor,false);
		Broodwar->drawBox(CoordinateType::Map,s.x(),s.y(),p.x(),p.y(),cColor,true);

		Broodwar->drawText(CoordinateType::Map, s.x() + 5, s.y() + 2, txt.c_str());
	}

	if (!unit->isBeingConstructed() && unit->getType().getID() == UnitTypes::Terran_Bunker.getID())
	{
		int w = unit->getType().tileWidth() * 32;
		int h = unit->getType().tileHeight() * 32;

		Broodwar->drawText(CoordinateType::Map, unit->getPosition().x() - w / 2, unit->getPosition().y() - 10, unit->getType().getName().c_str());

		//Draw Loaded box
		Position a = Position(unit->getPosition().x() - w/2, unit->getPosition().y() - h/2);
		Position b = Position(a.x() + 94, a.y() + 6);
		Broodwar->drawBox(CoordinateType::Map,a.x(),a.y(),b.x(),b.y(),Colors::Green,false);

		if ((int)unit->getLoadedUnits().size() > 0)
		{
			Position a = Position(unit->getPosition().x() - w/2, unit->getPosition().y() - h/2);
			Position b = Position(a.x() + unit->getLoadedUnits().size() * 24, a.y() + 6);

			Broodwar->drawBox(CoordinateType::Map,a.x(),a.y(),b.x(),b.y(),Colors::Green,true);
		}
	}
}
开发者ID:Malow,项目名称:Project-MalRilTil,代码行数:92,代码来源:StructureAgent.cpp

示例4: Position

void servoboard_main::servoPlayButtonClicked(quint8 servoNumber, quint8 servoValue)
{
    Position *p = new Position();
    p->addServoPosition(servoNumber,servoValue);
    emit this->playPosition(p);
}
开发者ID:Wizard-of-Odd,项目名称:ServoControl,代码行数:6,代码来源:servoboard_main.cpp

示例5: Solve

int Solve (int nodeType, Position& board, int ply, int alpha, int beta, int depth) {

	// return score for terminal state
	if (board.HasWon(board.get_arrayOfBitboard((board.get_nPlies() - 1) & 1))) {
		return -WIN + ply;
	} else if (board.get_nPlies() == 42) {
		return DRAW;
	}

	// Mate distance pruning
	alpha = std::max (ply - WIN, alpha);
	beta = std::min (WIN - (ply + 1), beta);
	if (alpha >= beta) {
		return alpha;
	}

	TTEntry entry = TranspositionTable.probeTTable(board.get_key());
		
	if (entry.flag == EXACT
		|| entry.flag == L_BOUND && entry.evaluationScore >= beta
		|| entry.flag == U_BOUND && entry.evaluationScore <= alpha) {

		if (entry.evaluationScore >= beta) {
			updateKillers(entry.move, ply);
		}
		return entry.evaluationScore;
	}

	int hashMove = (entry.flag == L_BOUND && entry.evaluationScore < beta) ? entry.move : NO_MOVE;
	int bestScore = -INF;
	int movesMade = 0;
	bool raisedAlpha = false;
	MovePicker mPicker(board, ply, hashMove);
	int bestMove = NO_MOVE;
	
	for (int i=0; i < 7; i++) {
			
		int move = mPicker.getNextMove();
		
		if (move == NO_MOVE) {
			break;
		}

		board.MakeMove(move);
		int score = -Solve(NON_ROOT, board, ply + 1, -beta, -alpha, depth - 1);
		board.UnmakeMove();
		nodesVisited++;
		movesMade++;

		if (score >= beta) {
			TTEntry newEntry = {board.get_key(), L_BOUND, depth, score, move};
			TranspositionTable.storeTTable(board.get_key(), newEntry);
			updateKillers(move, ply);
			updateHistory(depth, ply, move);

			if (movesMade == 1) {
				fh1++;
			} else {
				fh++;
			}
			return score;
		} else if (score > bestScore) {
			bestScore = score;
			bestMove = move;
			if (score > alpha) {
				alpha = score;
				raisedAlpha = true;
			}
		} 
	}

	if (raisedAlpha) {
		TTEntry newEntry = {board.get_key(), EXACT, depth, alpha, bestMove};
		TranspositionTable.storeTTable(board.get_key(), newEntry);
	} else {
		TTEntry newEntry = {board.get_key(), U_BOUND, depth, bestScore, NO_MOVE};
		TranspositionTable.storeTTable(board.get_key(), newEntry);
	}
	
	return bestScore; 
}
开发者ID:abcus,项目名称:connect4_v2.5,代码行数:81,代码来源:Solve.cpp

示例6: mate1ply

// 利きのある場所への取れない近接王手からの3手詰め
Move Position::weak_mate_n_ply(int ply) const
{
	// 1手詰めであるならこれを返す
	Move m = mate1ply();
	if (m)
		return m;

	// 詰まない
	if (ply <= 1)
		return MOVE_NONE;

	Color us = side_to_move();
	Color them = ~us;
	Bitboard around8 = kingEffect(king_square(them));

	// const剥がし
	Position* This = ((Position*)this);

	StateInfo si;
	StateInfo si2;

	// 近接王手で味方の利きがあり、敵の利きのない場所を探す。
	for (auto m : MoveList<CHECKS>(*this))
	{
		// 近接王手で、この指し手による駒の移動先に敵の駒がない。
		Square to = to_sq(m);
		if ((around8 & to)

#ifndef LONG_EFFECT_LIBRARY
			// toに利きがあるかどうか。mが移動の指し手の場合、mの元の利きを取り除く必要がある。
			&& (is_drop(m) ? effected_to(us, to) : (attackers_to(us, to, pieces() ^ from_sq(m)) ^ from_sq(m)))

			// 敵玉の利きは必ずtoにあるのでそれを除いた利きがあるかどうか。
			&& (attackers_to(them,to,pieces()) ^ king_square(them))
#else
			&& (is_drop(m) ? effected_to(us, to) :
					board_effect[us].effect(to) >= 2 ||
					(long_effect.directions_of(us, from_sq(m)) & Effect8::directions_of(from_sq(m), to)) != 0)

			// 敵玉の利きがあるので2つ以上なければそれで良い。
			&& (board_effect[them].effect(to) <= 1)
#endif
			)
		{
			if (!legal(m))
				continue;

			ASSERT_LV3(gives_check(m));

			This->do_move(m,si,true);

			ASSERT_LV3(in_check());

			// この局面ですべてのevasionを試す
			for (auto m2 : MoveList<EVASIONS>(*this))
			{
				if (!legal(m2))
					continue;

				// この指し手で逆王手になるなら、不詰めとして扱う
				if (gives_check(m2))
					goto NEXT_CHECK;

				This->do_move(m2, si2, false);

				ASSERT_LV3(!in_check());

				if (!weak_mate_n_ply(ply-2))
				{
					// 詰んでないので、m2で詰みを逃れている。
					This->undo_move(m2);
					goto NEXT_CHECK;
				}

				This->undo_move(m2);
			}

			// すべて詰んだ
			This->undo_move(m);

			// mによって3手で詰む。
			return m;

		NEXT_CHECK:;
			This->undo_move(m);
		}
	}
	return MOVE_NONE;
}
开发者ID:yaneurao,项目名称:YaneuraOu,代码行数:90,代码来源:mate_n_ply.cpp

示例7: PositionDiff

const PositionDiff Position::operator -(const Position& other) const {
    int dx = mX - other.getX();
    int dy = mY - other.getY();

    return PositionDiff(dx, dy);
}
开发者ID:zerksud,项目名称:projectz-ndk,代码行数:6,代码来源:Position.cpp

示例8: UpdateAI

        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            events.Update(diff);

            if (me->HasUnitState(UNIT_STATE_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_CURSE:
                        DoCastAOE(SPELL_CURSE_PLAGUEBRINGER);
                        events.ScheduleEvent(EVENT_CURSE, urand(50000, 60000));
                        return;
                    case EVENT_WARRIOR:
                        Talk(SAY_SUMMON);
                        SummonUndead(NPC_WARRIOR, RAID_MODE(2, 3));
                        events.ScheduleEvent(EVENT_WARRIOR, 30000);
                        return;
                    case EVENT_BLINK:
                        DoCastAOE(SPELL_CRIPPLE, true);
                        DoCastAOE(SPELL_BLINK);
                        DoResetThreat();
                        events.ScheduleEvent(EVENT_BLINK, 40000);
                        return;
                    case EVENT_BALCONY:
                        me->SetReactState(REACT_PASSIVE);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        me->AttackStop();
                        me->RemoveAllAuras();
                        me->NearTeleportTo(Teleport.GetPositionX(), Teleport.GetPositionY(), Teleport.GetPositionZ(), Teleport.GetOrientation());
                        events.Reset();
                        events.ScheduleEvent(EVENT_WAVE, urand(2000, 5000));
                        waveCount = 0;
                        return;
                    case EVENT_WAVE:
                        Talk(SAY_SUMMON);
                        switch (balconyCount)
                        {
                            case 0:
                                SummonUndead(NPC_CHAMPION, RAID_MODE(2, 4));
                                break;
                            case 1:
                                SummonUndead(NPC_CHAMPION, RAID_MODE(1, 2));
                                SummonUndead(NPC_GUARDIAN, RAID_MODE(1, 2));
                                break;
                            case 2:
                                SummonUndead(NPC_GUARDIAN, RAID_MODE(2, 4));
                                break;
                            default:
                                SummonUndead(NPC_CHAMPION, RAID_MODE(5, 10));
                                SummonUndead(NPC_GUARDIAN, RAID_MODE(5, 10));
                                break;
                        }
                        ++waveCount;
                        events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, urand(30000, 45000));
                        return;
                    case EVENT_GROUND:
                    {
                        ++balconyCount;
                        float x, y, z, o;
                        me->GetHomePosition(x, y, z, o);
                        me->NearTeleportTo(x, y, z, o);
                        events.ScheduleEvent(EVENT_BALCONY, 110000);
                        EnterPhaseGround();
                        return;
                    }
                }
            }

            if (me->HasReactState(REACT_AGGRESSIVE))
                DoMeleeAttackIfReady();
        }
开发者ID:Laintime,项目名称:FUN,代码行数:77,代码来源:boss_noth.cpp

示例9: glPushName

void
GUITriggeredRerouter::GUITriggeredRerouterEdge::drawGL(const GUIVisualizationSettings& s) const {
    const SUMOReal exaggeration = s.addSize.getExaggeration(s);
    if (s.scale * exaggeration >= 3) {
        glPushName(getGlID());
        const SUMOReal prob = myParent->getProbability();
        if (myAmClosedEdge) {
            // draw closing symbol onto all lanes
            const RerouteInterval* const ri =
                myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
            if (ri != 0 && prob > 0) {
                // draw only if the edge is closed at this time
                if (std::find(ri->closed.begin(), ri->closed.end(), myEdge) != ri->closed.end()) {
                    const size_t noLanes = myFGPositions.size();
                    for (size_t j = 0; j < noLanes; ++j) {
                        Position pos = myFGPositions[j];
                        SUMOReal rot = myFGRotations[j];
                        glPushMatrix();
                        glTranslated(pos.x(), pos.y(), 0);
                        glRotated(rot, 0, 0, 1);
                        glTranslated(0, -1.5, 0);
                        int noPoints = 9;
                        if (s.scale > 25) {
                            noPoints = (int)(9.0 + s.scale / 10.0);
                            if (noPoints > 36) {
                                noPoints = 36;
                            }
                        }
                        glTranslated(0, 0, getType());
                        //glScaled(exaggeration, exaggeration, 1);
                        glColor3d(0.7, 0, 0);
                        GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints);
                        glTranslated(0, 0, .1);
                        glColor3d(1, 0, 0);
                        GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints, 0, prob * 360);
                        glTranslated(0, 0, .1);
                        glColor3d(1, 1, 1);
                        glRotated(-90, 0, 0, 1);
                        glBegin(GL_TRIANGLES);
                        glVertex2d(0 - .3, -1.);
                        glVertex2d(0 - .3, 1.);
                        glVertex2d(0 + .3, 1.);
                        glVertex2d(0 + .3, -1.);
                        glVertex2d(0 - .3, -1.);
                        glVertex2d(0 + .3, 1.);
                        glEnd();
                        glPopMatrix();
                    }
                }
            }

        } else {
            // draw rerouter symbol onto all lanes
            for (size_t i = 0; i < myFGPositions.size(); ++i) {
                const Position& pos = myFGPositions[i];
                SUMOReal rot = myFGRotations[i];
                glPushMatrix();
                glTranslated(pos.x(), pos.y(), 0);
                glRotated(rot, 0, 0, 1);
                glTranslated(0, 0, getType());
                glScaled(exaggeration, exaggeration, 1);
                glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

                glBegin(GL_TRIANGLES);
                glColor3d(1, .8f, 0);
                // base
                glVertex2d(0 - 1.4, 0);
                glVertex2d(0 - 1.4, 6);
                glVertex2d(0 + 1.4, 6);
                glVertex2d(0 + 1.4, 0);
                glVertex2d(0 - 1.4, 0);
                glVertex2d(0 + 1.4, 6);
                glEnd();

                glTranslated(0, 0, .1);
                glColor3d(0, 0, 0);
                pfSetPosition(0, 0);
                pfSetScale(3.f);
                SUMOReal w = pfdkGetStringWidth("U");
                glRotated(180, 0, 1, 0);
                glTranslated(-w / 2., 2, 0);
                pfDrawString("U");

                glTranslated(w / 2., -2, 0);
                std::string str = toString((int)(prob * 100)) + "%";
                pfSetPosition(0, 0);
                pfSetScale(.7f);
                w = pfdkGetStringWidth(str.c_str());
                glTranslated(-w / 2., 4, 0);
                pfDrawString(str.c_str());
                glPopMatrix();
            }
        }
        glPopName();
    }
}
开发者ID:aarongolliver,项目名称:sumo,代码行数:96,代码来源:GUITriggeredRerouter.cpp

示例10: boundary

void FirstPersonCamera::Update(double dt, vector<InteractableOBJs>&InteractablesList, vector<Building>&BuildingsList, Player &somePlayer)
{
    Vector3 boundary(1000, 1000, 1000);

    speed = 30;
    mouseSpeed = 12;

    static const float CAMERA_SPEED = 50.f;
    //if (Application::IsKeyPressed('R'))
    //{
    //	Reset();
    //}

    //view.y < 0.9396 && view.y > -09396

    //Mouse - Shania
    //int Angle = 50;
    //horizontalAngle += mouseSpeed * dt * float(1680 / 2 - Application::mouseX);
    //if (verticalAngle + mouseSpeed * dt * float(1080 / 2 - Application::mouseY) < Angle && verticalAngle + mouseSpeed * dt * float(1080 / 2 - Application::mouseY) > -Angle)
    //{
    //    verticalAngle += mouseSpeed * dt * float(1080 / 2 - Application::mouseY);
    //}

    //Vector3 view(cos(Math::DegreeToRadian(verticalAngle)) * sin(Math::DegreeToRadian(horizontalAngle)),
    //    sin(Math::DegreeToRadian(verticalAngle)),
    //    cos(Math::DegreeToRadian(verticalAngle)) * cos(Math::DegreeToRadian(horizontalAngle)));


    //Vector3 right(sin(Math::DegreeToRadian(horizontalAngle - 90)), 0, cos(Math::DegreeToRadian(horizontalAngle - 90)));

    //up = right.Cross(view);

    //target = position + view.Normalized();


    // Mouse - DonoDon
    Vector3 view = (target - position).Normalized();

    float yaw = 0;
    float pitch = 0;

    yaw = (float)(mouseSpeed  * dt * (1680 / 2 - Application::mouseX));

    pitch = (float)(mouseSpeed * dt * (1080 / 2 - Application::mouseY));

    // Mouse
    Mtx44 rotationYaw;
    rotationYaw.SetToRotation(yaw, 0, 1, 0);
    view = (target - position);
    Vector3 right = view.Cross(up);
    view = rotationYaw * view;

    target = view + position;
    up = rotationYaw * up;

    Mtx44 rotationPitch;
    view = (target - position);
    right = view.Cross(up);
    right.y = 0;
    up = right.Cross(view).Normalized();
    rotationPitch.SetToRotation(pitch, right.x, right.y, right.z);



    view = rotationPitch * view;
    target = view + position;

    view = (target - position).Normalized();

    Position camPos; // Position to check collision with

    if (Application::IsKeyPressed('W'))
    {
        camPos.Set(somePlayer.pos.x + view.Normalized().x, somePlayer.pos.y + view.Normalized().y, somePlayer.pos.z + view.Normalized().z);
        if (createBoundary(InteractablesList, BuildingsList, somePlayer, camPos))
        {
            position.x = position.x + view.Normalized().x; // position = position + view
            position.z = position.z + view.Normalized().z; // position = position + view
            target.x = target.x + view.Normalized().x; // target = target + view
            target.z = target.z + view.Normalized().z; // target = target + view

            somePlayer.pos.x += view.Normalized().x;
            somePlayer.pos.z += view.Normalized().z;
        }
    }

    if (Application::IsKeyPressed('S'))
    {
        //camPos.Set(position.x - view.x, position.Normalized().y - view.y, position.z - view.z);
        camPos.Set(somePlayer.pos.x - view.Normalized().x, somePlayer.pos.y - view.Normalized().y, somePlayer.pos.z - view.Normalized().z);
        if (createBoundary(InteractablesList, BuildingsList, somePlayer, camPos))
        {
            position.x = position.x - (target - position).Normalized().x;
            position.z = position.z - (target - position).Normalized().z;
            target.x = target.x - (target - position).Normalized().x;
            target.z = target.z - (target - position).Normalized().z;

            somePlayer.pos.x -= view.Normalized().x;
            somePlayer.pos.z -= view.Normalized().z;
        }
//.........这里部分代码省略.........
开发者ID:TemplarDon,项目名称:SP2,代码行数:101,代码来源:FirstPersonCamera.cpp

示例11: add

void
Boundary::add(const Position& p) {
    add(p.x(), p.y());
}
开发者ID:nnaren1902,项目名称:Secure-Vehicle-Platoon,代码行数:4,代码来源:Boundary.cpp

示例12:

bool
Boundary::around(const Position& p, SUMOReal offset) const {
    return
        (p.x() <= myXmax + offset && p.x() >= myXmin - offset) &&
        (p.y() <= myYmax + offset && p.y() >= myYmin - offset);
}
开发者ID:nnaren1902,项目名称:Secure-Vehicle-Platoon,代码行数:6,代码来源:Boundary.cpp

示例13: getLevel

void Spectator::getViewIndex(Vec2 pos, ViewIndex& index) const {
  Position position = getLevel()->getPosition(pos);
  position.getViewIndex(index, nullptr);
  if (const Creature* c = position.getCreature())
    index.insert(c->getViewObject());
}
开发者ID:gustavsen,项目名称:keeperrl,代码行数:6,代码来源:spectator.cpp

示例14: deleteSection

void CodeDocument::deleteSection (const Position& startPosition, const Position& endPosition)
{
    deleteSection (startPosition.getPosition(), endPosition.getPosition());
}
开发者ID:0x4d52,项目名称:JUCE,代码行数:4,代码来源:juce_CodeDocument.cpp

示例15: evaluate

Value evaluate(const Position& pos)
{
//	margin = VALUE_ZERO;
	const Color us = pos.side_to_move();
	return Value(pos.evaluate(us));
}
开发者ID:YasuhiroIke,项目名称:Usapyon2-Slave,代码行数:6,代码来源:evaluate_apery.cpp


注:本文中的Position类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。