You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.0 KiB
HTML
118 lines
4.0 KiB
HTML
<!h1=Basis Klasse für alle Objekte des Frameworks>
|
|
|
|
class CActor
|
|
{
|
|
public:
|
|
CActor();
|
|
|
|
CActor(int type);
|
|
virtual ~CActor();
|
|
|
|
virtual void Action(float delta);
|
|
virtual void Draw(llgfx_id id);
|
|
|
|
virtual void SetPos(float x, float y);
|
|
virtual void SetPos(int x, int y);
|
|
int GetXPos() { return (int)m_position.m_u; };
|
|
int GetYPos() { return (int)m_position.m_v; };
|
|
|
|
virtual void TestCollision(CActor *actor_with);
|
|
virtual void Collision_Player(CActor *player );
|
|
virtual void Collision_Shot(CActor *player, CActor *shot);
|
|
virtual void AddScore(int score);
|
|
|
|
virtual bool Message(const char *Type);
|
|
virtual void SendMsg(const char *msg);
|
|
virtual CActor * IsActor( const char *name); // returned sich selbst wenn name entspricht
|
|
|
|
virtual void SetDirectionD( float deg );
|
|
virtual void SetDirectionR( float rad );
|
|
virtual void InitTarget(float time, float target_x, float target_y );
|
|
virtual void InitTarget(float time, CVec2f &targetpos );
|
|
virtual void InitMove(float x_velocity, float y_velocity );
|
|
virtual void InitMove(CVec2f &targetpos, float velocity );
|
|
virtual bool MoveToTarget(float delta); // returned true wenn target erreicht
|
|
virtual bool MoveToTarget(float delta, CVec2f ¤t_pos, CVec2f &target_pos, CVec2f &direction);
|
|
virtual void Move(float delta);
|
|
virtual void GetBoundingRect(llgfx_sRECT *rect);
|
|
|
|
virtual void RotateModel(float angle); // winkel in radians
|
|
virtual void RotateLocal(float angle); // winkel in radians
|
|
|
|
float GetAngleToPoint(float x, float y);
|
|
void InitTargetAngleD(float time, float new_angle); // newAngle in degree
|
|
void InitTargetAngleR(float time, float new_angle); // newAngle in radians
|
|
float GetViewAngleD();
|
|
float GetViewAngleR();
|
|
virtual bool RotateToTargetAngle(float delta); // return true wenn target angle erreicht
|
|
void SetViewAngleD( float degree );
|
|
void PlusViewAngleD( float degree );
|
|
void MinusViewAngleD( float degree );
|
|
void PlusViewAngleR( float radians );
|
|
void MinusViewAngleR( float radians );
|
|
void SetViewAngleR( float radians );
|
|
|
|
void AddChild(CActor * actor );
|
|
void SetParent(CActor * actor );
|
|
void RemoveParent();
|
|
void RemoveChild(CActor * actor);
|
|
|
|
|
|
|
|
|
|
queue<CStabAction> m_script;
|
|
CStabAction * m_cur_script;
|
|
queue<CStabAction> m_actions;
|
|
|
|
queue<CActor> m_childs;
|
|
CActor *m_parent; // Wenn ungleich 0 dann muss drawchild() aufgerufen werden
|
|
static CRoot *gl_root; // Root Actor
|
|
|
|
|
|
CVec2f m_position; // Playfield Position
|
|
CVec2f m_xyoffset; // Drawing Offset
|
|
CVec2f m_target_position; // Ziel Playfield Position für move_target
|
|
CVec2f m_direction; // Richtungsvektor
|
|
CVec2f m_old_position; // Alte Playfield Position
|
|
CVec2f m_scale; // x,y scale faktor
|
|
float m_velocity; // Geschwindigkeit
|
|
float m_acceleration; // Beschleunigung pro Sekunde
|
|
float m_view_angle; // 0 = Zeigt nach oben
|
|
float m_cos_radians;
|
|
float m_sin_radians;
|
|
float m_target_angle; // für RotateTo
|
|
float m_rdir; // rotation
|
|
float m_rtleft; // zeit übrig für zielrotation
|
|
|
|
float m_health; // Anzahl Health
|
|
float m_power; // Power bei Kollision
|
|
int m_score; // Jeder Actor hat einen Score
|
|
|
|
|
|
float m_lifetime; // Actor wird entfernt wenn lifetime unter 0 geht
|
|
float m_radius; // Für Kollisionsabfrage
|
|
llgfx_sRECT m_bounding_rect; // Für Kollisionsabfrage
|
|
llgfx_sRECT m_position_rect; // posrect = m_boudingrect + m_position
|
|
// Muss durch Action() gesetzt werden
|
|
|
|
int m_blitflag; // blitflag
|
|
llgfx_sBLITFX m_blitfx; // blitfx
|
|
|
|
int m_type; // type für z.b. CreateUpdatePacket
|
|
int m_id; // Für Kollision etc.
|
|
|
|
// Object Typ Informationen
|
|
// Jede Klasse die die Funktion Message ableitet muss
|
|
// objtype und namen im Konstruktor setzen
|
|
// Messagesyntax ist = "objname::*", * steht für die Message
|
|
char m_obj_name[64]; // Objekt name oder Objekt nummer
|
|
int m_obj_namelen; // länge des Obektnames
|
|
|
|
virtual void ParseSkriptFile(const char *filename );
|
|
virtual void ParseLine( const char * line );
|
|
void ClearScript();
|
|
|
|
|
|
static float GetAngle(CActor *A, CActor *B);
|
|
};
|