Finished documentation

Finished documentation on sprite physics and joints
Fixed some bugs in sprite physics
Added safety checks for joint types
Added code to free up joints when a canvas is destroyed
This commit is contained in:
n00b
2024-10-28 22:22:33 -04:00
parent 8f1b72a8e2
commit 2a580f9686
113 changed files with 1485 additions and 882 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1593,31 +1593,31 @@ case FN_spriteIsFixedRotation: //Number Function
rc_push_num(rc_spriteIsFixedRotation( SPRITEISFIXEDROTATION_SPR_ID ));
break;
case FN_createDistanceJoint: //Number Function
rc_push_num(rc_createDistanceJoint( CREATEDISTANCEJOINT_SPRITEA, CREATEDISTANCEJOINT_SPRITEB, CREATEDISTANCEJOINT_AX, CREATEDISTANCEJOINT_AY, CREATEDISTANCEJOINT_BX, CREATEDISTANCEJOINT_BY ));
rc_push_num(rc_createDistanceJoint( CREATEDISTANCEJOINT_SPRITEA, CREATEDISTANCEJOINT_SPRITEB, CREATEDISTANCEJOINT_AX, CREATEDISTANCEJOINT_AY, CREATEDISTANCEJOINT_BX, CREATEDISTANCEJOINT_BY, CREATEDISTANCEJOINT_COLLIDE_CONNECT ));
break;
case FN_createFrictionJoint: //Number Function
rc_push_num(rc_createFrictionJoint( CREATEFRICTIONJOINT_SPRITEA, CREATEFRICTIONJOINT_SPRITEB, CREATEFRICTIONJOINT_X, CREATEFRICTIONJOINT_Y ));
rc_push_num(rc_createFrictionJoint( CREATEFRICTIONJOINT_SPRITEA, CREATEFRICTIONJOINT_SPRITEB, CREATEFRICTIONJOINT_X, CREATEFRICTIONJOINT_Y, CREATEFRICTIONJOINT_COLLIDE_CONNECT ));
break;
case FN_createGearJoint: //Number Function
rc_push_num(rc_createGearJoint( CREATEGEARJOINT_JOINTA, CREATEGEARJOINT_JOINTB, CREATEGEARJOINT_G_RATIO ));
rc_push_num(rc_createGearJoint( CREATEGEARJOINT_JOINTA, CREATEGEARJOINT_JOINTB, CREATEGEARJOINT_G_RATIO, CREATEGEARJOINT_COLLIDE_CONNECT ));
break;
case FN_createMotorJoint: //Number Function
rc_push_num(rc_createMotorJoint( CREATEMOTORJOINT_SPRITEA, CREATEMOTORJOINT_SPRITEB ));
rc_push_num(rc_createMotorJoint( CREATEMOTORJOINT_SPRITEA, CREATEMOTORJOINT_SPRITEB, CREATEMOTORJOINT_COLLIDE_CONNECT ));
break;
case FN_createPrismaticJoint: //Number Function
rc_push_num(rc_createPrismaticJoint( CREATEPRISMATICJOINT_SPRITEA, CREATEPRISMATICJOINT_SPRITEB, CREATEPRISMATICJOINT_AX, CREATEPRISMATICJOINT_AY, CREATEPRISMATICJOINT_AXISX, CREATEPRISMATICJOINT_AXISY ));
rc_push_num(rc_createPrismaticJoint( CREATEPRISMATICJOINT_SPRITEA, CREATEPRISMATICJOINT_SPRITEB, CREATEPRISMATICJOINT_AX, CREATEPRISMATICJOINT_AY, CREATEPRISMATICJOINT_AXISX, CREATEPRISMATICJOINT_AXISY, CREATEPRISMATICJOINT_COLLIDE_CONNECT ));
break;
case FN_createPulleyJoint: //Number Function
rc_push_num(rc_createPulleyJoint( CREATEPULLEYJOINT_SPRITEA, CREATEPULLEYJOINT_SPRITEB, CREATEPULLEYJOINT_GAX, CREATEPULLEYJOINT_GAY, CREATEPULLEYJOINT_GBX, CREATEPULLEYJOINT_GBY, CREATEPULLEYJOINT_AX, CREATEPULLEYJOINT_AY, CREATEPULLEYJOINT_BX, CREATEPULLEYJOINT_BY, CREATEPULLEYJOINT_J_RATIO ));
rc_push_num(rc_createPulleyJoint( CREATEPULLEYJOINT_SPRITEA, CREATEPULLEYJOINT_SPRITEB, CREATEPULLEYJOINT_GAX, CREATEPULLEYJOINT_GAY, CREATEPULLEYJOINT_GBX, CREATEPULLEYJOINT_GBY, CREATEPULLEYJOINT_AX, CREATEPULLEYJOINT_AY, CREATEPULLEYJOINT_BX, CREATEPULLEYJOINT_BY, CREATEPULLEYJOINT_J_RATIO, CREATEPULLEYJOINT_COLLIDE_CONNECT ));
break;
case FN_createRevoluteJoint: //Number Function
rc_push_num(rc_createRevoluteJoint( CREATEREVOLUTEJOINT_SPRITEA, CREATEREVOLUTEJOINT_SPRITEB, CREATEREVOLUTEJOINT_X, CREATEREVOLUTEJOINT_Y ));
rc_push_num(rc_createRevoluteJoint( CREATEREVOLUTEJOINT_SPRITEA, CREATEREVOLUTEJOINT_SPRITEB, CREATEREVOLUTEJOINT_X, CREATEREVOLUTEJOINT_Y, CREATEREVOLUTEJOINT_COLLIDE_CONNECT ));
break;
case FN_createWeldJoint: //Number Function
rc_push_num(rc_createWeldJoint( CREATEWELDJOINT_SPRITEA, CREATEWELDJOINT_SPRITEB, CREATEWELDJOINT_X, CREATEWELDJOINT_Y ));
rc_push_num(rc_createWeldJoint( CREATEWELDJOINT_SPRITEA, CREATEWELDJOINT_SPRITEB, CREATEWELDJOINT_X, CREATEWELDJOINT_Y, CREATEWELDJOINT_COLLIDE_CONNECT ));
break;
case FN_createWheelJoint: //Number Function
rc_push_num(rc_createWheelJoint( CREATEWHEELJOINT_SPRITEA, CREATEWHEELJOINT_SPRITEB, CREATEWHEELJOINT_AX, CREATEWHEELJOINT_AY, CREATEWHEELJOINT_AXISX, CREATEWHEELJOINT_AXISY ));
rc_push_num(rc_createWheelJoint( CREATEWHEELJOINT_SPRITEA, CREATEWHEELJOINT_SPRITEB, CREATEWHEELJOINT_AX, CREATEWHEELJOINT_AY, CREATEWHEELJOINT_AXISX, CREATEWHEELJOINT_AXISY, CREATEWHEELJOINT_COLLIDE_CONNECT ));
break;
case FN_getJointWorldAnchorA: //Sub Procedure
rc_getJointWorldAnchorA( GETJOINTWORLDANCHORA_JOINT_ID, &GETJOINTWORLDANCHORA_X, &GETJOINTWORLDANCHORA_Y );
@@ -1793,6 +1793,9 @@ case FN_getJointLinearSpeed: //Number Function
case FN_getJointAngularSpeed: //Number Function
rc_push_num(rc_getJointAngularSpeed( GETJOINTANGULARSPEED_JOINT_ID ));
break;
case FN_DeleteJoint: //Sub Procedure
rc_deleteJoint( DELETEJOINT_JOINT_ID );
break;
case FN_CreateTileSet: //Number Function
rc_push_num(rc_createTileSet( CREATETILESET_IMG_ID, CREATETILESET_TILE_W, CREATETILESET_TILE_H ));
break;

View File

@@ -28,6 +28,7 @@
#include "rc_sprite2D.h"
#include "rc_spritelib.h"
#include "rc_tilelib.h"
#include "rc_joints.h"
#include <irrtheora.h>
using namespace irr;
@@ -987,6 +988,16 @@ void rc_canvasClose(int canvas_id)
rc_canvas[canvas_id].physics2D.world = NULL;
for(int i = 0; i < rc_joint.size(); i++)
{
if(rc_joint[i].canvas == canvas_id)
{
rc_joint[i].canvas = -1;
rc_joint[i].joint = NULL;
rc_joint[i].active = false;
}
}
//sprites are destroyed when the world is deleted so I just to set the active attribute to false and set the body to NULL
for(int i = 0; i < rc_canvas[canvas_id].sprite.size(); i++)
{

View File

@@ -11,7 +11,7 @@
#include "rc_gfx_core.h"
int rc_createDistanceJoint(int spriteA, int spriteB, double aX, double aY, double bX, double bY)
int rc_createDistanceJoint(int spriteA, int spriteB, double aX, double aY, double bX, double bY, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -47,6 +47,7 @@ int rc_createDistanceJoint(int spriteA, int spriteB, double aX, double aY, doubl
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2DistanceJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(aX, aY), b2Vec2(bX, bY));
@@ -57,7 +58,7 @@ int rc_createDistanceJoint(int spriteA, int spriteB, double aX, double aY, doubl
return joint_id;
}
int rc_createFrictionJoint(int spriteA, int spriteB, double x, double y)
int rc_createFrictionJoint(int spriteA, int spriteB, double x, double y, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -93,6 +94,7 @@ int rc_createFrictionJoint(int spriteA, int spriteB, double x, double y)
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2FrictionJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(x, y));
@@ -103,7 +105,7 @@ int rc_createFrictionJoint(int spriteA, int spriteB, double x, double y)
return joint_id;
}
int rc_createGearJoint(int jointA, int jointB, double g_ratio)
int rc_createGearJoint(int jointA, int jointB, double g_ratio, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -142,6 +144,7 @@ int rc_createGearJoint(int jointA, int jointB, double g_ratio)
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2GearJointDef joint_def;
joint_def.joint1 = rc_joint[jointA].joint;
@@ -153,7 +156,7 @@ int rc_createGearJoint(int jointA, int jointB, double g_ratio)
return joint_id;
}
int rc_createMotorJoint(int spriteA, int spriteB)
int rc_createMotorJoint(int spriteA, int spriteB, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -189,6 +192,7 @@ int rc_createMotorJoint(int spriteA, int spriteB)
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2MotorJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body);
@@ -199,7 +203,7 @@ int rc_createMotorJoint(int spriteA, int spriteB)
return joint_id;
}
int rc_createPrismaticJoint(int spriteA, int spriteB, double aX, double aY, double axisX, double axisY)
int rc_createPrismaticJoint(int spriteA, int spriteB, double aX, double aY, double axisX, double axisY, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -235,6 +239,7 @@ int rc_createPrismaticJoint(int spriteA, int spriteB, double aX, double aY, doub
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2PrismaticJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(aX, aY), b2Vec2(axisX, axisY));
@@ -245,7 +250,7 @@ int rc_createPrismaticJoint(int spriteA, int spriteB, double aX, double aY, doub
return joint_id;
}
int rc_createPulleyJoint(int spriteA, int spriteB, double gaX, double gaY, double gbX, double gbY, double aX, double aY, double bX, double bY, double j_ratio)
int rc_createPulleyJoint(int spriteA, int spriteB, double gaX, double gaY, double gbX, double gbY, double aX, double aY, double bX, double bY, double j_ratio, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -281,6 +286,7 @@ int rc_createPulleyJoint(int spriteA, int spriteB, double gaX, double gaY, doubl
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2PulleyJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(gaX, gaY), b2Vec2(gbX, gbY), b2Vec2(aX, aY), b2Vec2(bX, bY), j_ratio);
@@ -291,7 +297,7 @@ int rc_createPulleyJoint(int spriteA, int spriteB, double gaX, double gaY, doubl
return joint_id;
}
int rc_createRevoluteJoint(int spriteA, int spriteB, double x, double y)
int rc_createRevoluteJoint(int spriteA, int spriteB, double x, double y, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -327,6 +333,7 @@ int rc_createRevoluteJoint(int spriteA, int spriteB, double x, double y)
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2RevoluteJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(x, y));
@@ -337,7 +344,7 @@ int rc_createRevoluteJoint(int spriteA, int spriteB, double x, double y)
return joint_id;
}
int rc_createWeldJoint(int spriteA, int spriteB, double x, double y)
int rc_createWeldJoint(int spriteA, int spriteB, double x, double y, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -373,6 +380,7 @@ int rc_createWeldJoint(int spriteA, int spriteB, double x, double y)
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2WeldJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(x, y));
@@ -383,7 +391,7 @@ int rc_createWeldJoint(int spriteA, int spriteB, double x, double y)
return joint_id;
}
int rc_createWheelJoint(int spriteA, int spriteB, double aX, double aY, double axisX, double axisY)
int rc_createWheelJoint(int spriteA, int spriteB, double aX, double aY, double axisX, double axisY, bool collide_connected)
{
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return -1;
@@ -419,6 +427,7 @@ int rc_createWheelJoint(int spriteA, int spriteB, double aX, double aY, double a
}
rc_joint[joint_id].active = true;
rc_joint[joint_id].canvas = rc_active_canvas;
b2WheelJointDef joint_def;
joint_def.Initialize(rc_sprite[spriteA].physics.body, rc_sprite[spriteB].physics.body, b2Vec2(aX, aY), b2Vec2(axisX, axisY));
@@ -429,6 +438,22 @@ int rc_createWheelJoint(int spriteA, int spriteB, double aX, double aY, double a
return joint_id;
}
void rc_deleteJoint(int joint_id)
{
if(joint_id < 0 || joint_id >= rc_joint.size())
return;
if(!rc_joint[joint_id].active)
return;
int j_canvas = rc_joint[joint_id].canvas;
rc_canvas[j_canvas].physics2D.world->DestroyJoint(rc_joint[joint_id].joint);
rc_joint[joint_id].joint = NULL;
rc_joint[joint_id].canvas = -1;
rc_joint[joint_id].active = false;
}
void rc_getJointWorldAnchorA(int joint_id, double* x, double* y)
{
if(joint_id < 0 || joint_id >= rc_joint.size())
@@ -621,8 +646,13 @@ void rc_setJointLength(int joint_id, double jlen)
if(!rc_joint[joint_id].active)
return;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
j->SetLength(jlen);
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
j->SetLength(jlen);
break;
}
}
double rc_getJointLength(int joint_id)
@@ -633,8 +663,14 @@ double rc_getJointLength(int joint_id)
if(!rc_joint[joint_id].active)
return 0;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetLength();
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetLength();
}
return 0;
}
void rc_setJointMinLength(int joint_id, double jlen)
@@ -645,8 +681,13 @@ void rc_setJointMinLength(int joint_id, double jlen)
if(!rc_joint[joint_id].active)
return;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
j->SetMinLength(jlen);
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
j->SetMinLength(jlen);
break;
}
}
double rc_getJointMinLength(int joint_id)
@@ -657,8 +698,14 @@ double rc_getJointMinLength(int joint_id)
if(!rc_joint[joint_id].active)
return 0;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetMinLength();
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetMinLength();
}
return 0;
}
void rc_setJointMaxLength(int joint_id, double jlen)
@@ -669,8 +716,12 @@ void rc_setJointMaxLength(int joint_id, double jlen)
if(!rc_joint[joint_id].active)
return;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
j->SetMaxLength(jlen);
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
j->SetMaxLength(jlen);
}
}
double rc_getJointMaxLength(int joint_id)
@@ -681,8 +732,14 @@ double rc_getJointMaxLength(int joint_id)
if(!rc_joint[joint_id].active)
return 0;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetMaxLength();
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetMaxLength();
}
return 0;
}
double rc_getJointCurrentLength(int joint_id)
@@ -693,8 +750,14 @@ double rc_getJointCurrentLength(int joint_id)
if(!rc_joint[joint_id].active)
return 0;
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetCurrentLength();
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_DISTANCE:
b2DistanceJoint* j = (b2DistanceJoint*)rc_joint[joint_id].joint;
return j->GetCurrentLength();
}
return 0;
}
void rc_setJointStiffness(int joint_id, double stiffness)
@@ -992,8 +1055,15 @@ void rc_setJointRatio(int joint_id, double j_ratio)
if(!rc_joint[joint_id].active)
return;
b2GearJoint* j = (b2GearJoint*)rc_joint[joint_id].joint;
j->SetRatio(j_ratio);
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_GEAR:
{
b2GearJoint* j = (b2GearJoint*)rc_joint[joint_id].joint;
j->SetRatio(j_ratio);
}
break;
}
}
double rc_getJointRatio(int joint_id)
@@ -1033,8 +1103,15 @@ void rc_setJointLinearOffset(int joint_id, double x, double y)
if(!rc_joint[joint_id].active)
return;
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
j->SetLinearOffset(b2Vec2(x, y));
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_MOTOR:
{
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
j->SetLinearOffset(b2Vec2(x, y));
}
break;
}
}
void rc_getJointLinearOffset(int joint_id, double* x, double* y)
@@ -1045,10 +1122,17 @@ void rc_getJointLinearOffset(int joint_id, double* x, double* y)
if(!rc_joint[joint_id].active)
return;
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
b2Vec2 v = j->GetLinearOffset();
*x = v.x;
*y = v.y;
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_MOTOR:
{
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
b2Vec2 v = j->GetLinearOffset();
*x = v.x;
*y = v.y;
}
break;
}
}
void rc_setJointAngularOffset(int joint_id, double angleOffset)
@@ -1059,8 +1143,15 @@ void rc_setJointAngularOffset(int joint_id, double angleOffset)
if(!rc_joint[joint_id].active)
return;
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
j->SetAngularOffset(angleOffset);
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_MOTOR:
{
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
j->SetAngularOffset(angleOffset);
}
break;
}
}
double rc_getJointAngularOffset(int joint_id)
@@ -1071,8 +1162,17 @@ double rc_getJointAngularOffset(int joint_id)
if(!rc_joint[joint_id].active)
return 0;
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
return j->GetAngularOffset();
switch(rc_joint[joint_id].type)
{
case RC_JOINT_TYPE_MOTOR:
{
b2MotorJoint* j = (b2MotorJoint*)rc_joint[joint_id].joint;
return j->GetAngularOffset();
}
break;
}
return 0;
}

View File

@@ -78,6 +78,8 @@ struct rc_b2Joint_obj
int type;
bool active;
int canvas;
};
irr::core::array<rc_b2Joint_obj> rc_joint;

View File

@@ -286,7 +286,7 @@ void rc_setSpriteBullet(int spr_id, bool flag)
if(!rc_sprite[spr_id].active)
return;
return rc_sprite[spr_id].physics.body->SetBullet(flag);
rc_sprite[spr_id].physics.body->SetBullet(flag);
}
bool rc_spriteIsBullet(int spr_id)
@@ -297,7 +297,7 @@ bool rc_spriteIsBullet(int spr_id)
if(!rc_sprite[spr_id].active)
return false;
rc_sprite[spr_id].physics.body->IsBullet();
return rc_sprite[spr_id].physics.body->IsBullet();
}
void rc_setSpriteSleepAllowed(int spr_id, bool flag)
@@ -308,7 +308,7 @@ void rc_setSpriteSleepAllowed(int spr_id, bool flag)
if(!rc_sprite[spr_id].active)
return;
return rc_sprite[spr_id].physics.body->SetSleepingAllowed(flag);
rc_sprite[spr_id].physics.body->SetSleepingAllowed(flag);
}
bool rc_spriteSleepAllowed(int spr_id)
@@ -319,7 +319,7 @@ bool rc_spriteSleepAllowed(int spr_id)
if(!rc_sprite[spr_id].active)
return false;
rc_sprite[spr_id].physics.body->IsSleepingAllowed();
return rc_sprite[spr_id].physics.body->IsSleepingAllowed();
}
void rc_setSpriteAwake(int spr_id, bool flag)
@@ -330,7 +330,7 @@ void rc_setSpriteAwake(int spr_id, bool flag)
if(!rc_sprite[spr_id].active)
return;
return rc_sprite[spr_id].physics.body->SetAwake(flag);
rc_sprite[spr_id].physics.body->SetAwake(flag);
}
bool rc_spriteIsAwake(int spr_id)
@@ -341,7 +341,7 @@ bool rc_spriteIsAwake(int spr_id)
if(!rc_sprite[spr_id].active)
return false;
rc_sprite[spr_id].physics.body->IsAwake();
return rc_sprite[spr_id].physics.body->IsAwake();
}
void rc_setSpriteFixedRotation(int spr_id, bool flag)
@@ -352,7 +352,7 @@ void rc_setSpriteFixedRotation(int spr_id, bool flag)
if(!rc_sprite[spr_id].active)
return;
return rc_sprite[spr_id].physics.body->SetFixedRotation(flag);
rc_sprite[spr_id].physics.body->SetFixedRotation(flag);
}
bool rc_spriteIsFixedRotation(int spr_id)
@@ -363,5 +363,5 @@ bool rc_spriteIsFixedRotation(int spr_id)
if(!rc_sprite[spr_id].active)
return false;
rc_sprite[spr_id].physics.body->IsFixedRotation();
return rc_sprite[spr_id].physics.body->IsFixedRotation();
}