Fixed a bug with getting the sprite position not using the offset for box2d
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#ifndef RC_OS_DEFINES_H_INCLUDED
|
#ifndef RC_OS_DEFINES_H_INCLUDED
|
||||||
#define RC_OS_DEFINES_H_INCLUDED
|
#define RC_OS_DEFINES_H_INCLUDED
|
||||||
|
|
||||||
//#define RC_LINUX
|
#define RC_LINUX
|
||||||
#define RC_WEB
|
//#define RC_WEB
|
||||||
//#define RC_WINDOWS
|
//#define RC_WINDOWS
|
||||||
//#define RC_ANDROID
|
//#define RC_ANDROID
|
||||||
//#define RC_MAC
|
//#define RC_MAC
|
||||||
|
|||||||
@@ -540,8 +540,11 @@ void rc_getSpritePosition(int spr_id, double* x, double* y)
|
|||||||
if(!rc_sprite[spr_id].active)
|
if(!rc_sprite[spr_id].active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*x = (double)rc_sprite[spr_id].physics.body->GetPosition().x;
|
double off_x = rc_sprite[spr_id].physics.offset_x;
|
||||||
*y = (double)rc_sprite[spr_id].physics.body->GetPosition().y;
|
double off_y = rc_sprite[spr_id].physics.offset_y;
|
||||||
|
|
||||||
|
*x = (double)rc_sprite[spr_id].physics.body->GetPosition().x - off_x;
|
||||||
|
*y = (double)rc_sprite[spr_id].physics.body->GetPosition().y - off_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
double rc_spriteX(int spr_id)
|
double rc_spriteX(int spr_id)
|
||||||
@@ -552,7 +555,9 @@ double rc_spriteX(int spr_id)
|
|||||||
if(!rc_sprite[spr_id].active)
|
if(!rc_sprite[spr_id].active)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (double)rc_sprite[spr_id].physics.body->GetPosition().x;
|
double off_x = rc_sprite[spr_id].physics.offset_x;
|
||||||
|
|
||||||
|
return (double)rc_sprite[spr_id].physics.body->GetPosition().x - off_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
double rc_spriteY(int spr_id)
|
double rc_spriteY(int spr_id)
|
||||||
@@ -563,7 +568,9 @@ double rc_spriteY(int spr_id)
|
|||||||
if(!rc_sprite[spr_id].active)
|
if(!rc_sprite[spr_id].active)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (double)rc_sprite[spr_id].physics.body->GetPosition().y;
|
double off_y = rc_sprite[spr_id].physics.offset_y;
|
||||||
|
|
||||||
|
return (double)rc_sprite[spr_id].physics.body->GetPosition().y - off_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rc_setSpriteRotation(int spr_id, double angle)
|
void rc_setSpriteRotation(int spr_id, double angle)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<irrtheora.h>
|
<irrtheora.h>
|
||||||
"rc_func130_cases.h"
|
"rc_func130_cases.h"
|
||||||
|
|
||||||
1731547485 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
|
1731678428 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
|
||||||
|
|
||||||
1730315467 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
|
1730315467 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
|
||||||
|
|
||||||
@@ -2486,7 +2486,7 @@
|
|||||||
<irrlicht.h>
|
<irrlicht.h>
|
||||||
<cmath>
|
<cmath>
|
||||||
|
|
||||||
1731554928 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_spritelib.h
|
1731679477 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_spritelib.h
|
||||||
"SDL.h"
|
"SDL.h"
|
||||||
<SDL2/SDL.h>
|
<SDL2/SDL.h>
|
||||||
"rc_sprite2D.h"
|
"rc_sprite2D.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user