mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-25 23:49:03 +00:00
adding a true user-defined conversion operator
This commit is contained in:
+1
-2
@@ -30,8 +30,7 @@ set(SOURCES
|
||||
|
||||
add_executable(bomberman
|
||||
sources/main.cpp
|
||||
${SOURCES}
|
||||
sources/Models/Vector3.cpp)
|
||||
${SOURCES})
|
||||
target_include_directories(bomberman PUBLIC sources)
|
||||
target_link_libraries(bomberman PUBLIC wal ray)
|
||||
|
||||
|
||||
@@ -153,13 +153,15 @@ namespace BBM
|
||||
{
|
||||
return (point * this) / std::pow(this->magnitude(), 2) * this;
|
||||
}
|
||||
|
||||
explicit operator RAY::Vector3() const { return {this->x, this->y, this->z };}
|
||||
};
|
||||
|
||||
typedef Vector3<float> Vector3f;
|
||||
typedef Vector3<unsigned> Vector3u;
|
||||
typedef Vector3<int> Vector3i;
|
||||
|
||||
RAY::Vector3 operator*(const Vector3f &v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BBM
|
||||
auto &comp = entity.getComponent<Drawable3DComponent<T>>();
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
|
||||
comp.member.setPosition(*pos.position);
|
||||
comp.member.setPosition(static_cast<RAY::Vector3>(pos.position));
|
||||
comp.member.drawOn(this->_window);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user