Blob Blame Raw
#ifndef HELI_SPRITE_H
#define HELI_SPRITE_H


#include "common.h"
#include "animation.h"


typedef struct _Sprite *Sprite;
typedef void (*SpriteCallback)(Sprite sprite);


typedef enum _Collider {
	COLLIDER_RECTANGLE,
	COLLIDER_CIRCLE
} Collider;


Sprite createSprite(double x, double y, double width, double height);
Sprite createSpriteEx(double x, double y, double width, double height, Animation animation);

void spriteDestroy(Sprite sprite);
void spriteDestroyTimer(Sprite sprite, double lifetime);

Sprite spriteClone(Sprite sprite);

double spriteGetX(Sprite sprite);
void spriteSetX(Sprite sprite, double x);
double spriteGetY(Sprite sprite);
void spriteSetY(Sprite sprite, double y);
void spriteSetXY(Sprite sprite, double x, double y);

double spriteGetVelocityX(Sprite sprite);
void spriteSetVelocityX(Sprite sprite, double x);
double spriteGetVelocityY(Sprite sprite);
void spriteSetVelocityY(Sprite sprite, double y);
void spriteSetVelocityXY(Sprite sprite, double x, double y);

double spriteGetAccelerationX(Sprite sprite);
void spriteSetAccelerationX(Sprite sprite, double x);
double spriteGetAccelerationY(Sprite sprite);
void spriteSetAccelerationY(Sprite sprite, double y);
void spriteSetAccelerationXY(Sprite sprite, double x, double y);

double spriteGetScale(Sprite sprite);
void spriteSetScale(Sprite sprite, double scale);

double spriteGetWidth(Sprite sprite);
void spriteSetWidth(Sprite sprite, double width);
double spriteGetHeight(Sprite sprite);
void spriteSetHeight(Sprite sprite, double height);
void spriteSetSize(Sprite sprite, double width, double height);

int spriteGetRotateToDirection(Sprite sprite);
void spriteSetRotateToDirection(Sprite sprite, int rotateToDirection);

double spriteGetRotation(Sprite sprite);
void spriteSetRotation(Sprite sprite, double rotation);

double spriteGetRotationSpeed(Sprite sprite);
void spriteSetRotationSpeed(Sprite sprite, double rotationSpeed);

int spriteGetMirrorX(Sprite sprite);
void spriteSetMirrorX(Sprite sprite, int mirrorX);

int spriteGetMirrorY(Sprite sprite);
void spriteSetMirrorY(Sprite sprite, int mirrorY);

double spriteGetDepth(Sprite sprite);
void spriteSetDepth(Sprite sprite, double depth);

int spriteGetVisible(Sprite sprite);
void spriteSetVisible(Sprite sprite, int visible);

int spriteGetFrozen(Sprite sprite);
void spriteSetFrozen(Sprite sprite, int frozen);

int spriteGetDebug(Sprite sprite);
void spriteSetDebug(Sprite sprite, int debug);

int spriteOverlap(Sprite a, Sprite b);
int spriteCollide(Sprite a, Sprite b);
int spriteIsPointInside(Sprite sprite, double x, double y);

double spriteGetTouchWeight(Sprite sprite);
double spriteGetTouchWeightX(Sprite sprite);
double spriteGetTouchWeightY(Sprite sprite);
double spriteGetTouchFriction(Sprite sprite);
void spriteResetTouch(Sprite sprite);

double spriteGetBounciness(Sprite sprite);
void spriteSetBounciness(Sprite sprite, double bounciness);
double spriteGetBouncinessThreshold(Sprite sprite);
void spriteSetBouncinessThreshold(Sprite sprite, double bouncinessThreshold);

double spriteGetFriction(Sprite sprite);
void spriteSetFriction(Sprite sprite, double friction);
double spriteGetAirFriction(Sprite sprite);
void spriteSetAirFriction(Sprite sprite, double friction);

int spriteGetMassLevel(Sprite sprite);
void spriteSetMassLevel(Sprite sprite, int massLevel);

double spriteGetColliderSensitiveDistance(Sprite sprite);
void spriteSetColliderSensitiveDistance(Sprite sprite, double distance);

void spriteSetCollider(Sprite sprite, Collider type, double xOffset, double yOffset, double rotationOffset);
void spriteSetColliderCircle(Sprite sprite, double xOffset, double yOffset, double radius);
void spriteSetColliderRectangle(
	Sprite sprite, double xOffset, double yOffset, double rotationOffset,
	double width, double height, double cornersRadius );
void spriteSetColliderEx(
	Sprite sprite, Collider type,
	double xOffset, double yOffset, double rotationOffset,
	double width, double height, double radius);

Animation spriteGetAnimation(Sprite sprite);
void spriteSetAnimation(Sprite sprite, Animation animation);
void spriteSetNoAnimation(Sprite sprite);

unsigned int spriteGetShapeColor(Sprite sprite);
void spriteSetShapeColor(Sprite sprite, unsigned int colorCode);

unsigned int spriteGetTintColor(Sprite sprite);
void spriteSetTintColor(Sprite sprite, unsigned int colorCode);

void spriteSetSpeedAndDirection(Sprite sprite, double speed, double angle);
double spriteGetSpeed(Sprite sprite);
double spriteGetDirection(Sprite sprite);
void spritePointTo(Sprite sprite, double x, double y);
void spriteMoveBy(Sprite sprite, double dx, double dy);
void spriteMoveToDirection(Sprite sprite, double distance, double angle);

double spriteGetScaledWidth(Sprite sprite);
double spriteGetScaledHeight(Sprite sprite);

int spriteGetUserTag(Sprite sprite);
void spriteSetUserTag(Sprite sprite, int tag);
const char* spriteGetUserText(Sprite sprite);
void spriteSetUserText(Sprite sprite, const char *text);
void* spriteGetUserData(Sprite sprite);
void spriteSetUserData(Sprite sprite, void *data);

void spriteSetDestroy(Sprite sprite, SpriteCallback destroy);

int spriteUpdate(Sprite sprite, double time);
void spriteDraw(Sprite sprite);

int spritesGetCount();
Sprite spritesGet(int i);



#endif