From a7eee8d5ccf8cd6d7388377c08e90594edb36ed8 Mon Sep 17 00:00:00 2001 From: Quentin Date: Tue, 27 Jun 2023 19:19:19 +0200 Subject: [PATCH] script vector3: add to_string and << operator overload (#119) --- script/scrVector.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/script/scrVector.hpp b/script/scrVector.hpp index f3abd31..6aabff7 100644 --- a/script/scrVector.hpp +++ b/script/scrVector.hpp @@ -1,5 +1,8 @@ #pragma once #include "../rage/vector.hpp" +#include +#include +#include namespace rage { @@ -64,6 +67,19 @@ namespace rage return this->x != other.x || this->y != other.y || this->z != other.z; } + std::string to_string() const + { + std::stringstream ss; + ss << *this; + return ss.str(); + } + + friend std::ostream& operator<<(std::ostream& os, const scrVector& vec) + { + os << "(" << vec.x << ", " << vec.y << ", " << vec.z << ")"; + return os; + } + alignas(8) float x{}; alignas(8) float y{}; alignas(8) float z{};