New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactoring GetIsCollidedWith #670
Conversation
@@ -40,6 +40,19 @@ void Collider::SetTransform(const Matrix44F& transform) { | |||
rotation_ = r; | |||
} | |||
|
|||
bool Collider::GetIsCollidedWith(std::shared_ptr<Collider> collider) { return GetIsCollidedWith_(collider); } | |||
bool Collider::GetIsCollidedWith(std::shared_ptr<Collider> collider) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getなのでconstはつけれませんか?
float radius_; | ||
|
||
bool GetIsCollidedWith_(std::shared_ptr<Collider> shape) override; | ||
protected: | ||
std::pair<b2Shape*, int32_t> GetB2Shapes() override { return {&shape_, 1}; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
綺麗やるなら内部的にShapeCollectionクラス等を用意してそれを返すようにしたほうがいい気がする
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ポインタに関してはunique_ptrでもつとかしか手段思いつかないですね...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ただの値の場合とstd::vectorの場合を同一視している荒技なので、どうしたものか。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ShapeCollection
というのは、このタプル相当のフィールドを持ったclassという感じの……?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ん?生ポなのがアレという話ではなく?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector返す変わる的な何か
float radius_; | ||
|
||
bool GetIsCollidedWith_(std::shared_ptr<Collider> shape) override; | ||
protected: | ||
std::pair<b2Shape*, int32_t> GetB2Shapes() override { return {&shape_, 1}; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ん?生ポなのがアレという話ではなく?
b98d6fb
to
9d32535
Compare
Changes/変更内容
Collider周りのリファクタリングです。
全てのクラスの組み合わせについて
b2TestOverlap
を呼び出す処理が書かれていて酷かったので、抽象化しました。ただし生ポインタを使ってしまっているので、もう少しうまい方法があれば教えてください。
Issue