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 7b8bfba701
commit d8304d3e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,8 @@
#pragma once
#include "../rage/vector.hpp"
#include <string>
#include <sstream>
#include <ostream>
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{};