void CFontMaterial::DrawString( CDrawContext * pDrawContext, std::string text, float x, float y, float r, float g, float b, float a, int type ) { float xtrans = 0.0f, ytrans = 0.0f; float xoffset = 0.0f, yoffset = 0.0f; pDrawContext->SetTexture( m_FontSheet.GetTexture() ); pDrawContext->SetDrawColor( r, g, b, a ); if( type & ( DRAW_TEXT_HORIZ_CENTER | DRAW_TEXT_VERT_CENTER ) ) { Vector2< int > size = GetStringSize( text ); if( type & DRAW_TEXT_HORIZ_CENTER ) { xoffset = ( float )-size.GetX() * .5f; } if( type & DRAW_TEXT_VERT_CENTER ) { yoffset = ( float )-size.GetY() * .5f; } } for( int i = 0; i < text.length(); i++ ) { bool newline = false; if( text[i] == '\n' ) newline = true; if( !newline ) { int c = text[i]; CFontCharacter fchar = m_Characters[c]; Vector2< float > size = fchar.m_Size; Vector2< float > v1 = fchar.m_UpperLeftST; Vector2< float > v2 = fchar.m_LowerRightST; pDrawContext->StartDraw(); pDrawContext->SetPos( x + xoffset + xtrans + fchar.m_Left, y + yoffset + ytrans - fchar.m_Down + m_LargestBearingY ); pDrawContext->SetScale( size.GetX() , size.GetY() ); pDrawContext->SetTexCoord( v1.GetX(), v1.GetY(), v2.GetX(), v1.GetY(), v2.GetX(), v2.GetY(), v1.GetX(), v2.GetY() ); pDrawContext->EndDraw(); xtrans += fchar.m_Trans; } else { xtrans = 0; ytrans += m_FontSize; } } }
Rectangle::Rectangle(float height, float width, Vector2 center) { a.Set(center.GetX() - width / 2, center.GetY() - height / 2); b.Set(center.GetX() + width / 2, center.GetY() - height / 2); c.Set(center.GetX() + width / 2, center.GetY() + height / 2); d.Set(center.GetX() - width / 2, center.GetY() + height / 2); }
Rectangle::Rectangle(const Vector2 &min, const Vector2 &max) { a = min; b = Vector2(max.GetX(), min.GetY()); c = max; d = Vector2(min.GetX(), max.GetY()); }
Vector2 AABB::GetOverlap(AABB other, bool makeIntegral) const { Vector2 overlap; const AABB *left = _x < other._x ? this : &other; const AABB *right = left == this ? &other : this; overlap.SetX(left->_x + left->_width - right->_x); if (left == this) overlap.SetX(overlap.GetX() * -1); const AABB *top = _y < other._y ? this : &other; const AABB *bottom = top == this ? &other : this; overlap.SetY(top->_y + top->_height - bottom->_y); if (top == this) overlap.SetY(overlap.GetY() * -1); if (makeIntegral) { float x = overlap.GetX(); float y = overlap.GetY(); x = x < 0 ? ::floorf(x) : ::ceilf(x); y = y < 0 ? ::floorf(y) : ::ceilf(y); overlap.SetX(x); overlap.SetY(y); } return overlap; }
bool CircleCollider::CollisionCheck(Vector2& a_vPointOne,Vector2& a_vPointTwo) { Vector2 newCenter(m_vCenter.GetX() - a_vPointOne.GetX() ,m_vCenter.GetY() - a_vPointOne.GetY() ); Vector2 newPointTwo(a_vPointTwo.GetX() - a_vPointOne.GetX() ,a_vPointTwo.GetY() - a_vPointOne.GetY() ); float projection = newCenter.Norm().Dot(newPointTwo.Norm()); float sinofAngle = sqrt(1 - (projection * projection)); float lhs, rhs; lhs = m_fRadius *m_fRadius; rhs = newCenter.SqMagnatude() * sinofAngle; return lhs >= rhs; }
Vector2 Grid::PosGrid(Vector2 point) { int x = (int)((point.GetX() / CELL_SIZE)); int y = (int)((point.GetY() / CELL_SIZE)); return Vector2(x, y); }
bool Vector2::operator==(const Vector2& v) { if(x != v.GetX()) return false; if(y != v.GetY()) return false; return true; }
int CFontMaterial::GetStringHeight( std::string text ) { Vector2< int > v = GetStringSize( text ); return v.GetY(); }
Matrix3 Matrix3::Scale(const Vector2& scale) { Matrix3 m; m.m_[0] = scale.GetX(); m.m_[1] = scale.GetY(); return m; }
Matrix3 Matrix3::Translate(const Vector2& pos) { Matrix3 m; m.m_[2] = pos.GetX(); m.m_[5] = pos.GetY(); return m; }
Vector2 Matrix3::operator*(const Vector2& rhs) const { float vector[3] = { m_[0]*m_[1]*m_[1]*rhs.GetX(), m_[2]*m_[3]*m_[4]*rhs.GetY(), m_[5]*m_[6]*m_[7] }; return Vector2(vector[0] / vector[2], vector[1] / vector[2]); }
Ivy::Math::Matrix Ivy::Math::Matrix::Scale(Vector2 scale) { glm::mat4 scaled = glm::scale(values, Vector3(scale.GetX(), scale.GetY(), 0.0f).GetRawData()); return Matrix(scaled[0][0], scaled[0][1], scaled[0][2], scaled[0][3], scaled[1][0], scaled[1][1], scaled[1][2], scaled[1][3], scaled[2][0], scaled[2][1], scaled[2][2], scaled[2][3], scaled[3][0], scaled[3][1], scaled[3][2], scaled[3][3]); }
void FieldCharacter::UpdateDirection(Vector2 directionVector) { directionVector = directionVector.Normalize(); // We'll snap the player's direction vector according to // the nearest direction for which we have an animation. double angleToHorizontal = acos(directionVector.GetX()); // acos() only returns values from 0 to pi, // so to get the full circle we need to check // whether we're in the bottom two quandrants, // and change the angle to account for this if so. if (directionVector.GetY() > 0) { angleToHorizontal = 2 * M_PI - angleToHorizontal; } if (angleToHorizontal <= M_PI / 8 || angleToHorizontal > M_PI * 15 / 8) { SetSpriteDirection(FieldCharacterDirectionSide); SetDirection(CharacterDirectionRight); } else if (angleToHorizontal > M_PI / 8 && angleToHorizontal <= M_PI * 3 / 8) { SetSpriteDirection(FieldCharacterDirectionDiagonalUp); SetDirection(CharacterDirectionRight); } else if (angleToHorizontal > 3 * M_PI / 8 && angleToHorizontal <= M_PI * 5 / 8) { SetSpriteDirection(FieldCharacterDirectionUp); } else if (angleToHorizontal > 5 * M_PI / 8 && angleToHorizontal <= M_PI * 7 / 8) { SetSpriteDirection(FieldCharacterDirectionDiagonalUp); SetDirection(CharacterDirectionLeft); } else if (angleToHorizontal > 7 * M_PI / 8 && angleToHorizontal <= M_PI * 9 / 8) { SetSpriteDirection(FieldCharacterDirectionSide); SetDirection(CharacterDirectionLeft); } else if (angleToHorizontal > 9 * M_PI / 8 && angleToHorizontal <= M_PI * 11 / 8) { SetSpriteDirection(FieldCharacterDirectionDiagonalDown); SetDirection(CharacterDirectionLeft); } else if (angleToHorizontal > 11 * M_PI / 8 && angleToHorizontal <= M_PI * 13 / 8) { SetSpriteDirection(FieldCharacterDirectionDown); } else if (angleToHorizontal > 13 * M_PI / 8 && angleToHorizontal <= M_PI * 15 / 8) { SetSpriteDirection(FieldCharacterDirectionDiagonalDown); SetDirection(CharacterDirectionRight); } }
bool Shader::SetShaderVec2Parameter(const char* name, Vector2 vec2) { int locID = glGetUniformLocation(m_programID, name); if (locID >= 0) { glUniform2f(locID, vec2.GetX(), vec2.GetY()); } return true; }
void MouseHelper::MouseOverText::Draw(Vector2 cursorPosition) { MLIFont *pMouseOverFont = CommonCaseResources::GetInstance()->GetFontManager()->GetFontFromId("MouseOverFont"); Vector2 cursorSize = GetCursorSize(); Vector2 mouseOverTextPosition = cursorPosition + Vector2(cursorSize.GetX() / 2, cursorSize.GetY()) - Vector2(pMouseOverFont->GetWidth(text) / 2, 0); if (mouseOverTextPosition.GetX() < MouseOverTextMarginPx) { mouseOverTextPosition.SetX(MouseOverTextMarginPx); } else if (mouseOverTextPosition.GetX() + pMouseOverFont->GetWidth(text) > gScreenWidth - MouseOverTextMarginPx) { mouseOverTextPosition.SetX(gScreenWidth - MouseOverTextMarginPx - pMouseOverFont->GetWidth(text)); } if (mouseOverTextPosition.GetY() + pMouseOverFont->GetHeight(text) > gScreenHeight - TabHeight - MouseOverTextMarginPx) { mouseOverTextPosition.SetY(mouseOverTextPosition.GetY() - cursorSize.GetY() - pMouseOverFont->GetHeight(text)); } if (mouseOverTextPosition.GetY() + pMouseOverFont->GetHeight(text) > gScreenHeight - TabHeight - MouseOverTextMarginPx) { mouseOverTextPosition.SetY(gScreenHeight - TabHeight - MouseOverTextMarginPx - pMouseOverFont->GetHeight(text)); } // We don't want the mouse over text to continue to follow the mouse cursor in the y-direction // after it starts fading out, so we'll set the current mouse over text position such that // we can retrieve the last y-position prior to fading out as its permanent y-position // until the fade-out has completed. if (!isFadingOut) { fadeOutMousePosition = mouseOverTextPosition; } else { mouseOverTextPosition.SetY(fadeOutMousePosition.GetY()); } mouseOverTextPosition += Vector2(0, currentOffset); pMouseOverFont->Draw(text, mouseOverTextPosition, Color(currentOpacity, 1.0, 1.0, 1.0)); }
void EvidenceDescription::Draw(Vector2 position) { EnsureEvidenceInformation(); pBackgroundImage->Draw(position); if (pEvidenceSprite != NULL) { pEvidenceSprite->Draw(Vector2(position.GetX() + 3, position.GetY() + 3)); pNameFont->Draw(evidenceName, Vector2(position.GetX() + 128 + 10, position.GetY() + 3 + 5)); int totalDescriptionHeight = (int)(evidenceDescriptionLines.size() * pDescriptionFont->GetLineHeight() + (evidenceDescriptionLines.size() - 1) * descriptionLineSeparationHeight); int currentY = (int)(position.GetY() + (5 + pNameFont->GetLineHeight() + 130 - totalDescriptionHeight) / 2); for (unsigned int i = 0; i < evidenceDescriptionLines.size(); i++) { pDescriptionFont->Draw(evidenceDescriptionLines[i], Vector2(position.GetX() + 128 + 20, currentY)); currentY += pDescriptionFont->GetLineHeight() + descriptionLineSeparationHeight; } } }
bool CircleCollider::CollisionCheck(Vector2& a_vPoint) { float lhs = (m_fRadius * m_fRadius); float rhsX = (a_vPoint.GetX() - m_vCenter.GetX()); float rhsY = (a_vPoint.GetY() - m_vCenter.GetY()); if(lhs > ((rhsX*rhsX)+(rhsY*rhsY))) return true; return false; }
RectangleWH HitBox::GetBoundingBox() const { double left = numeric_limits<double>::infinity(); double top = numeric_limits<double>::infinity(); double right = -numeric_limits<double>::infinity(); double bottom = -numeric_limits<double>::infinity(); for (unsigned int i = 0; i < collidableObjectList.size(); i++) { vector<Vector2> *pVertices = collidableObjectList[i]->GetVertices(); for (unsigned int j = 0; j < pVertices->size(); j++) { Vector2 vertex = (*pVertices)[j]; if (vertex.GetX() < left) { left = vertex.GetX(); } if (vertex.GetX() > right) { right = vertex.GetX(); } if (vertex.GetY() < top) { top = vertex.GetY(); } if (vertex.GetY() > bottom) { bottom = vertex.GetY(); } } } return RectangleWH(left, top, right - left, bottom - top); }
void PlayerActor::ProjectileHit(Actor *prj) { if (_shieldActive) { if (((ProjectileActor*)prj)->IsReflectable()) { Vector2 vel = prj->GetSpeed(); vel.SetX(vel.GetX() * -1); vel.SetY(vel.GetY() * -1); prj->SetSpeed(vel); } } else { SetHealth(0); } }
void Sprite::Draw(Vector2 position, Color color, double scale, bool flipHorizontally) { if (GetSpriteSheetImage() == NULL) { return; } Vector2 pixelSnappedPosition = Vector2((int)position.GetX(), (int)position.GetY()); GetSpriteSheetImage()->Draw( pixelSnappedPosition, spriteClipRect, flipHorizontally, false /* flipVertically */, scale, color); }
void Sprite::DrawClipped(Vector2 position, RectangleWH clipRect, bool flipHorizontally, Color color) { if (GetSpriteSheetImage() == NULL) { return; } // Adjust the clip rect to account for the fact that we've eliminated blank space // that was around the source image. if (spriteDrawOffset.GetX() > 0 || spriteDrawOffset.GetY() > 0) { Vector2 oldClipRectPosition(clipRect.GetX(), clipRect.GetY()); clipRect.SetX(clipRect.GetX() - spriteDrawOffset.GetX()); clipRect.SetY(clipRect.GetY() - spriteDrawOffset.GetY()); position += Vector2(clipRect.GetX(), clipRect.GetY()) - oldClipRectPosition; if (clipRect.GetX() + clipRect.GetWidth() > GetWidth()) { clipRect.SetWidth(GetWidth() - clipRect.GetX()); } if (clipRect.GetY() + clipRect.GetHeight() > GetHeight()) { clipRect.SetHeight(GetHeight() - clipRect.GetY()); } } Vector2 pixelSnappedPosition = Vector2( (int)(position.GetX() + (originalSize.GetX() > 0 && flipHorizontally ? originalSize.GetX() - GetWidth() - spriteDrawOffset.GetX() : spriteDrawOffset.GetX())), (int)(position.GetY() + spriteDrawOffset.GetY())); GetSpriteSheetImage()->Draw( pixelSnappedPosition, RectangleWH( spriteClipRect.GetX() + clipRect.GetX(), spriteClipRect.GetY() + clipRect.GetY(), clipRect.GetWidth(), clipRect.GetHeight()), flipHorizontally, false /* flipVertically */, 1.0, color); }
void Sprite::Draw(Vector2 position, Color color, double scale, bool flipHorizontally) { if (GetSpriteSheetImage() == NULL) { return; } Vector2 pixelSnappedPosition = Vector2( (int)(position.GetX() + (originalSize.GetX() > 0 && flipHorizontally ? originalSize.GetX() - GetWidth() - spriteDrawOffset.GetX() : spriteDrawOffset.GetX())), (int)(position.GetY() + spriteDrawOffset.GetY())); GetSpriteSheetImage()->Draw( pixelSnappedPosition, spriteClipRect, flipHorizontally, false /* flipVertically */, scale, color); }
void Sprite::DrawClipped(Vector2 position, RectangleWH clipRect, bool flipHorizontally, Color color) { if (GetSpriteSheetImage() == NULL) { return; } Vector2 pixelSnappedPosition = Vector2((int)position.GetX(), (int)position.GetY()); GetSpriteSheetImage()->Draw( pixelSnappedPosition, RectangleWH( spriteClipRect.GetX() + clipRect.GetX(), spriteClipRect.GetY() + clipRect.GetY(), clipRect.GetWidth(), clipRect.GetHeight()), flipHorizontally, false /* flipVertically */, 1.0, color); }
void Button::Draw(double xOffset, double yOffset) { Color textColor; if (GetIsDisabled()) { textColor = DisabledTextColor; } else if (isMouseDown) { textColor = MouseDownTextColor; } else if (isMouseOver) { textColor = MouseOverTextColor; } else { textColor = NormalTextColor; } Vector2 textPosition = Vector2( GetXPosition() + animationOffset + xOffset, GetYPosition() + yOffset); pTextFont->Draw(GetText(), textPosition, textColor); if (pCustomIconSprite != NULL) { Vector2 spritePosition = Vector2( textPosition.GetX() - pCustomIconSprite->GetWidth() - 4, textPosition.GetY() - 4 + (36 - pCustomIconSprite->GetHeight()) / 2); pCustomIconSprite->Draw(spritePosition); } else if (GetLockCount() > 0 || GetUnlockedLockCount() > 0) { int lockPositionOffset = 0; for (int i = 0; i < GetLockCount(); i++) { lockPositionOffset += pLockSprite->GetWidth() + 2; Vector2 lockPosition = Vector2( textPosition.GetX() - lockPositionOffset, textPosition.GetY() - 9); pLockSprite->Draw(lockPosition); } for (int i = 0; i < GetUnlockedLockCount(); i++) { lockPositionOffset += pUnlockingAnimation->GetSize().GetX() + 2; Vector2 lockPosition = Vector2( textPosition.GetX() - lockPositionOffset, textPosition.GetY() - 9); pUnlockingAnimation->Draw(lockPosition); } } else if (GetShowCheckMark()) { Vector2 checkMarkPosition = Vector2( textPosition.GetX() - pCheckMarkImage->width, textPosition.GetY() - 4); pCheckMarkImage->Draw(checkMarkPosition); } }
Vector2 Vector2::operator+(const Vector2 &rhs) { Vector2 result; result.SetValues(_x + rhs.GetX(), _y + rhs.GetY()); return result; }
void CgEffect::SetVector(const char* name, Vector2& v) { cgSetParameter2f(this->retrieveParameter(name), v.GetX(), v.GetY()); }
void PromptOverlay::Draw() { pDarkeningImage->Draw(Vector2(0, 0), Color(fadeOpacity * 0.75, 1, 1, 1)); if (allowsTextEntry) { Vector2 textEnteredPosition = Vector2((gScreenWidth - pTextEntryFont->GetWidth(textEntered)) / 2, (gScreenHeight - pTextEntryFont->GetLineHeight()) / 2 + yOffset); pTextEntryFont->Draw(textEntered, textEnteredPosition, Color(fadeOpacity, 1, 1, 1)); if (TextInputHelper::GetIsCaretShowing()) { SDL_Rect rect = { (int)(textEnteredPosition.GetX() + pTextEntryFont->GetWidth(textEntered.substr(0, TextInputHelper::GetCaretPosition()))), (int)textEnteredPosition.GetY(), 2, (int)pTextEntryFont->GetLineHeight() }; SDL_SetRenderDrawColor(gpRenderer, 255, 255, 255, (Uint8)(fadeOpacity * 255)); SDL_SetRenderDrawBlendMode(gpRenderer, SDL_BLENDMODE_BLEND); SDL_RenderFillRect(gpRenderer, &rect); } } int textLineTop = gScreenHeight / 2 - pTextFont->GetLineHeight() * (1 + headerTextLines.size()) - (allowsTextEntry ? 2 * pTextEntryFont->GetLineHeight() / 3 : 0) + yOffset; for (unsigned int i = 0; i < headerTextLines.size(); i++) { pTextFont->Draw(headerTextLines[i], Vector2((gScreenWidth - pTextFont->GetWidth(headerTextLines[i])) / 2, textLineTop + pTextFont->GetLineHeight() * i), Color(fadeOpacity, 1, 1, 1)); } for (unsigned int i = 0; i < buttonList.size(); i++) { buttonList[i]->Draw(fadeOpacity); } }
void PlayerActor::Update(double elapsedSecs) { bool wasDigging = _digDir != Edge::NONE; // Updates the mindcontrol hat if the button is being pressed because stoping time messes up other stuff for hat switching. UpdateHatSprite(); UpdateInput(elapsedSecs); if (_isDestroyed || !_isActive || _stoppedTime) return; Actor::Update(elapsedSecs); UpdateShieldStatus(elapsedSecs); // Slow gravity if we're gliding if (_gliding && _jumpVelocity > 0) { _jumpVelocity += -5.9 * 64 * elapsedSecs; } if (_wasOnGround) { _jumpBoosted = false; } _jumpVelocity -= -9.8 * 64 * elapsedSecs; _jumpVelocity = Math::Clamp(_jumpVelocity, -_maxJumpVel, _maxJumpVel); // Check whether we're finished digging and update sprites accordingly if (wasDigging && _digDir == Edge::NONE) { _sprites[_currentSpriteSheet]->Stop(); _currentSpriteSheet = _curKinematic.velocity.GetX() > 1 ? "walk" : "idle"; SetActorYDirection(SpriteSheet::YAxisDirection::UP); _sprites[_currentSpriteSheet]->Start(); } UpdatePosition(elapsedSecs); _aabb.UpdatePosition(*this); _wasOnDoor = false; for (auto actor : _gameScreen->GetLevel()->GetActors()) { if (!actor->IsActive() || actor.get() == (Actor*)this) continue; if (CollisionCheck(*actor)) { Type type = actor->GetType(); switch (type) { case Type::enemy: case Type::bombenemy: SetHealth(0); break; case Type::door: shared_ptr<DoorActor> door = dynamic_pointer_cast<DoorActor>(actor); if (!door->IsOpen()) { Edge edge = door->GetEdge(); bool affectsY = edge == Edge::BOTTOM || edge == Edge::TOP; Vector2 overlap = _aabb.GetOverlap(actor->GetAABB(), true); // Push our hero out of the door if (affectsY) { int extraOff = door->GetPosition().GetY() > _curKinematic.position.GetY() ? -1 : 1; _curKinematic.position.SetY(_curKinematic.position.GetY() + overlap.GetY()); _prevKinematic.position.SetY(_curKinematic.position.GetY()); // Tile collision will screw up otherwise... if (extraOff == -1) _wasOnDoor = true; } else { int extraOff = door->GetPosition().GetX() > _curKinematic.position.GetX() ? -1 : 1; _curKinematic.position.SetX(_curKinematic.position.GetX() + overlap.GetX()); _prevKinematic.position.SetX(_curKinematic.position.GetX()); // Tile collision will screw up otherwise... } } break; } } } DetectTileCollisions(_collisionInfo, _gameScreen->GetLevel()); DigDiggableTiles(); UpdateCollisions(elapsedSecs); _prevKinematic = _curKinematic; _collisionInfo.colIntersect.clear(); _collisionInfo.rowIntersect.clear(); }
void Dialog::Draw(double xOffset, double yOffset) { #ifdef ENABLE_DEBUG_MODE if (gEnableDebugMode && filePath.length() > 0) { MLIFont *pFont = CommonCaseResources::GetInstance()->GetFontManager()->GetFontFromId("MouseOverFont"); pFont->Draw(GetFileNameFromFilePath(ConvertSeparatorsInPath(filePath + ".ogg")), Vector2(xOffset, yOffset + gScreenHeight - Dialog::Height - TabHeight + 3 - pFont->GetLineHeight())); } #endif if (isInterrogation) { if (!pEvidenceSelector->GetIsShowing() && !evidencePresented && !pState->WasInterjectionOngoing()) { if (!isPassive) { pPressForInfoTab->Draw(xOffset, yOffset); pPresentEvidenceTab->Draw(xOffset, yOffset); if (Case::GetInstance()->GetPartnerManager()->GetCurrentPartnerId().length() > 0 && pCurrentPartner->GetConversationAbilityName().length() > 0) { pUsePartnerTab->Draw(0, yOffset); } } if (!isConfrontation || Confrontation::GetEnabledConfrontationTopicCount() > 1) { pEndInterrogationTab->Draw(xOffset, yOffset); } } } else if (pEvidenceSelector->GetIsShowing()) { pEvidenceSelector->Draw(yOffset); } if (GetIsStarted()) { Vector2 lineScreenPosition = Vector2(textAreaRect.GetX() + desiredPadding, textAreaRect.GetY() + desiredPadding); int curTextPosition = 0; TextColor curTextColor = TextColorNormal; deque<string> lines = split(GetString(), '\n'); list<Interval>::iterator textIntervalEnumerator = textIntervalList.begin(); Interval *pCurrentTextInterval = NULL; if (textIntervalEnumerator != textIntervalList.end()) { pCurrentTextInterval = &(*textIntervalEnumerator); curTextColor = pCurrentTextInterval->Color; ++textIntervalEnumerator; } for (unsigned int i = 0; i < lines.size(); i++) { string line = lines[i]; int curLineTextPosition = 0; Vector2 curScreenPosition = Vector2(lineScreenPosition.GetX(), lineScreenPosition.GetY()); string lineRemainder = line; while (pCurrentTextInterval != NULL && pCurrentTextInterval->EndIndex - curTextPosition - curLineTextPosition <= (int)lineRemainder.length()) { string linePortionToDraw = lineRemainder.substr(0, pCurrentTextInterval->EndIndex - curTextPosition - curLineTextPosition); lineRemainder = lineRemainder.substr(pCurrentTextInterval->EndIndex - curTextPosition - curLineTextPosition); pDialogFont->Draw(linePortionToDraw, Vector2(curScreenPosition.GetX() + xOffset, curScreenPosition.GetY() + yOffset), GetColorFromTextColor(curTextColor)); curScreenPosition.SetX(curScreenPosition.GetX() + pDialogFont->GetWidth(linePortionToDraw)); curLineTextPosition += linePortionToDraw.length(); if (textIntervalEnumerator != textIntervalList.end()) { pCurrentTextInterval = &(*textIntervalEnumerator); curTextColor = pCurrentTextInterval->Color; ++textIntervalEnumerator; } else { curTextColor = TextColorNormal; pCurrentTextInterval = NULL; } } pDialogFont->Draw(lineRemainder, Vector2(curScreenPosition.GetX() + xOffset, curScreenPosition.GetY() + yOffset), GetColorFromTextColor(curTextColor)); lineScreenPosition.SetY(lineScreenPosition.GetY() + pDialogFont->GetLineHeight()); // Add one for the carriage return character. curTextPosition += line.length() + 1; } } if (GetIsReadyToProgress() && !evidencePresented) { if (isInterrogation) { if (!pEvidenceSelector->GetIsShowing()) { pInterrogationUpArrow->Draw(xOffset, yOffset); pInterrogationDownArrow->Draw(xOffset, yOffset); } } else if (!pEvidenceSelector->GetIsShowing() && !GetIsAutomatic() && !isStatic) { pConversationDownArrow->Draw(xOffset, yOffset); } } }
Vector2 operator*(const Matrix2& lhs, const Vector2& rhs) { return Vector2(lhs[0] * rhs.GetX() + lhs[2] * rhs.GetY(), lhs[1] * rhs.GetX() + lhs[3] * rhs.GetY()); }