|
@@ -15,6 +15,12 @@ Object2D::Object2D()
|
|
|
Object2D::~Object2D()
|
|
|
{}
|
|
|
|
|
|
+// Übergibt einen Void Funktionspointer auf eine Aktion die einmalig vom Hauptthread ausgeführt werden soll. (Passiert nach dem Tick)
|
|
|
+void Object2D::postAction( std::function< void() > action )
|
|
|
+{
|
|
|
+ actions.push( action );
|
|
|
+}
|
|
|
+
|
|
|
void Object2D::explosion( Vertex worldPos, float intensity )
|
|
|
{
|
|
|
intensity /= ( position - worldPos ).getLengthSq();
|
|
@@ -125,6 +131,11 @@ bool Object2D::handleCollision( Object2D *obj )
|
|
|
|
|
|
bool Object2D::tick( const WeltInfo &info, double zeit )
|
|
|
{
|
|
|
+ while( !actions.empty() )
|
|
|
+ {
|
|
|
+ actions.front()( );
|
|
|
+ actions.pop();
|
|
|
+ }
|
|
|
rotation += rSpeed * (float)zeit;
|
|
|
while( rotation > PI * 2 )
|
|
|
rotation -= (float)PI * 2;
|