script vector3: add to_string and << operator overload (#119)

This commit is contained in:
Quentin 2023-06-27 19:19:19 +02:00 committed by GitHub
parent 9d951d0e32
commit a7eee8d5cc

View File

@ -1,5 +1,8 @@
#pragma once #pragma once
#include "../rage/vector.hpp" #include "../rage/vector.hpp"
#include <string>
#include <sstream>
#include <ostream>
namespace rage namespace rage
{ {
@ -64,6 +67,19 @@ namespace rage
return this->x != other.x || this->y != other.y || this->z != other.z; 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 x{};
alignas(8) float y{}; alignas(8) float y{};
alignas(8) float z{}; alignas(8) float z{};