summaryrefslogtreecommitdiff
path: root/Runtime/Physics2D/SpriteCollider2D.h
blob: 948b2965b2f2ef9944ca1796714135442d39dcc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#if (ENABLE_2D_PHYSICS || DOXYGEN) && ENABLE_SPRITECOLLIDER

#include "Runtime/Math/Vector2.h"
#include "Runtime/Utilities/dynamic_array.h"
#include "Runtime/Graphics/SpriteFrame.h"
#include "Runtime/Physics2D/PolygonColliderBase2D.h"

class Sprite;


// --------------------------------------------------------------------------


class SpriteCollider2D : public PolygonColliderBase2D
{
public:	
	REGISTER_DERIVED_CLASS (SpriteCollider2D, PolygonColliderBase2D)
	DECLARE_OBJECT_SERIALIZE (SpriteCollider2D)
	
	SpriteCollider2D (MemLabelId label, ObjectCreationMode mode);
	static void InitializeClass();

	virtual const Polygon2D& GetPoly() const;

	virtual void Reset ();
	virtual void SmartReset ();

	PPtr<Sprite> GetSprite() const { return m_Sprite; }
	void SetSprite(PPtr<Sprite> sprite);

private:
	PPtr<Sprite> m_Sprite;
};

#endif