Class TPHXSprite

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TPHXSprite = class(TObject)

Description

Basic sprite

Hierarchy

  • TObject
  • TPHXSprite

Overview

Methods

Public constructor Create(AEngine: TPHXSpriteEngine); virtual;
Public destructor Destroy; override;
Public procedure Initialize; virtual;
Public procedure Transform;
Public procedure Update(const DeltaTime: Double); virtual;
Public procedure Render; virtual;
Public procedure Kill;
Public procedure RenderBounds(Canvas: TPHXCanvas; Color: TColor4f);
Public procedure Clicked(const X,Y: Integer); virtual;
Public procedure Collided(Sprite: TPHXSprite); virtual;
Public procedure Killed; virtual;
Public function PointInSprite(const Point: TVector2f): Boolean;
Public function Collide(const Displacement: TVector2f): Boolean; overload;
Public function Collide(const Displacement: TVector2f; const Group: TPHXSpriteCollisionGroup): Boolean; overload;
Public function Collide(const Displacement: TVector2f; const Filter: TPHXSpriteCollisionFilter): Boolean; overload;
Public function SpriteToWorld(const Vector: TVector3f): TVector3f; overload;
Public function SpriteToWorld(const Vector: TVector2f): TVector2f; overload;
Public function WorldToSprite(const Vector: TVector3f): TVector3f; overload;
Public function WorldToSprite(const Vector: TVector2f): TVector2f; overload;
Public procedure MoveTo(const Position: TVector3f; const Rotation: Single);
Public procedure Move(const DX, DY: Single);
Public procedure MoveLeft(const Distance: Single);
Public procedure MoveRight(const Distance: Single);
Public procedure MoveUp(const Distance: Single);
Public procedure MoveDown(const Distance: Single);
Public procedure MoveForward(const Distance: Single);
Public procedure MoveBackward(const Distance: Single);
Public function MoveTowards(const FrameTime: Double; const Target: TVector2f; const LinearVelocity, AngularVelocity: Single): Boolean; overload;
Public function MoveTowards(const FrameTime: Double; const Target: TVector3f; const LinearVelocity, AngularVelocity: Single): Boolean; overload;
Public procedure StrafeLeft(const Distance: Single);
Public procedure StrafeRight(const Distance: Single);
Public procedure RotateLeft(const Degrees: Single);
Public procedure RotateRight(const Degrees: Single);
Public procedure RotateTowards(const Point: TVector2f; const Delta: Single);
Public procedure AttatchTo(Sprite: TPHXSprite); overload;
Public procedure AttatchTo(Sprite: TPHXSprite; const Tag: String ); overload;
Public procedure AttatchTo(Sprite: TPHXSprite; const Tag: TPHXTag); overload;
Public procedure CreateDefaultShape;
Public procedure BringToFront;
Public procedure SendToBack;
Public function Clone: TPHXSprite; virtual;
Public procedure Assign(Sprite: TPHXSprite); virtual;

Properties

Public property Engine: TPHXSpriteEngine read FEngine;
Public property Parent: TPHXSprite read FParent write SetParent;
Public property Sprites: TPHXSpriteList read FSprites;
Public property Name: String read FName write FName;
Public property Time: Double read FTime write FTime;
Public property Visible: Boolean read FVisible write FVisible;
Public property Alive: Boolean read FAlive;
Public property Active: Boolean read FActive write FActive;
Public property Position: TVector3f read FPosition write SetPosition;
Public property X: Single read FPosition.X write SetPositionX;
Public property Y: Single read FPosition.Y write SetPositionY;
Public property Layer: Single read FPosition.Z write SetPositionZ;
Public property Rotation: Single read FRotation write SetRotation;
Public property Bounds: TRectf read FLocalBounds write SetBounds;
Public property Image: String read FImage write SetImage;
Public property Pattern: String read FPattern write SetPattern;
Public property Shape: String read FShape write SetShape;
Public property Alpha: Single read FColor.Alpha write FColor.Alpha;
Public property Color: TColor4f read FColor write FColor;
Public property Collider: Boolean read FCollider write SetCollider;
Public property Mode: TPHXSpriteCollisionMode read FMode write FMode;
Public property Group: TPHXSpriteCollisionGroup read FGroup write FGroup;
Public property LocalTransform: TMatrix4 read FLocalTransform;
Public property FinalTransform: TMatrix4 read FFinalTransform;
Public property LocalBounds: TRectf read FLocalBounds;
Public property FinalBounds: TRectf read FFinalBounds;
Public property LocalShape: TPHXShape read FLocalShape;
Public property FinalShape: TPHXShape read FFinalShape;
Public property Width: Integer read GetWidth;
Public property Height: Integer read GetHeight;
Public property LinkedImage: TPHXImage read FLinkedImage write SetImageL;
Public property LinkedPattern: TPHXPatternIndex read FLinkedPattern write SetPatternL;
Public property LinkedShape: TPHXShape read FLinkedShape write SetShapeL;

Description

Methods

Public constructor Create(AEngine: TPHXSpriteEngine); virtual;

Creates a new sprite and adds it to the engine

Public destructor Destroy; override;

Destroy the sprite

Public procedure Initialize; virtual;

Initialize the sprite

Public procedure Transform;

Transform the sprite

Public procedure Update(const DeltaTime: Double); virtual;

Update the sprite

Public procedure Render; virtual;

Render the sprite

Public procedure Kill;

Kill the sprite, the sprite is destroyed by the RemoveDead function in the engine

Public procedure RenderBounds(Canvas: TPHXCanvas; Color: TColor4f);

Render the bounding box for this sprite

Public procedure Clicked(const X,Y: Integer); virtual;

Called when this sprite is clicked

Public procedure Collided(Sprite: TPHXSprite); virtual;

Called when this sprite collides with another sprite

Public procedure Killed; virtual;

Called when this sprite is killed

Public function PointInSprite(const Point: TVector2f): Boolean;

Returns true if the mouse is inside the entity bounding box

Public function Collide(const Displacement: TVector2f): Boolean; overload;

Test if this sprite collides in the future

Parameters
Displacement
The distance in the future to test up to
Returns

True if the sprite will collide, else false

Public function Collide(const Displacement: TVector2f; const Group: TPHXSpriteCollisionGroup): Boolean; overload;

Test if this sprite collides in the future

Parameters
Displacement
The distance in the future to test up to
Group
The collision groups to test collisions against
Returns

True if the sprite will collide, else false

Public function Collide(const Displacement: TVector2f; const Filter: TPHXSpriteCollisionFilter): Boolean; overload;

Test if this sprite collides in the future

Parameters
Displacement
The distance in the future to test up to
Filter
The set of collision groups to test in
Returns

True if the sprite will collide, else false

Public function SpriteToWorld(const Vector: TVector3f): TVector3f; overload;

Transform a vector using the entitys transformation matrix

Public function SpriteToWorld(const Vector: TVector2f): TVector2f; overload;

Transform a vector using the entitys transformation matrix

Public function WorldToSprite(const Vector: TVector3f): TVector3f; overload;

Transform a screen coordinate to a entity coordinate

Public function WorldToSprite(const Vector: TVector2f): TVector2f; overload;

Transform a screen coordinate to a entity coordinate

Public procedure MoveTo(const Position: TVector3f; const Rotation: Single);

Move the sprite to a position

Public procedure Move(const DX, DY: Single);

Move the sprite a distance

Public procedure MoveLeft(const Distance: Single);

Move the sprite to the left

Public procedure MoveRight(const Distance: Single);

Move the sprite to the right

Public procedure MoveUp(const Distance: Single);

Move the sprite to the left

Public procedure MoveDown(const Distance: Single);

Move the sprite to the right

Public procedure MoveForward(const Distance: Single);

Move the sprite forward in the current direction

Public procedure MoveBackward(const Distance: Single);

Move the sprite backwards in the current direction

Public function MoveTowards(const FrameTime: Double; const Target: TVector2f; const LinearVelocity, AngularVelocity: Single): Boolean; overload;

Move and rotates the sprite towards a point

Public function MoveTowards(const FrameTime: Double; const Target: TVector3f; const LinearVelocity, AngularVelocity: Single): Boolean; overload;

Move and rotates the sprite towards a point

Public procedure StrafeLeft(const Distance: Single);

Strafe the entity left along the normal of the rotation vector

Public procedure StrafeRight(const Distance: Single);

Strafe the entity right along the normalof the rotation vector

Public procedure RotateLeft(const Degrees: Single);

Rotate the sprite to the left

Public procedure RotateRight(const Degrees: Single);

Rotate the sprite to the right

Public procedure RotateTowards(const Point: TVector2f; const Delta: Single);

Rotates the sprite towards a point

Public procedure AttatchTo(Sprite: TPHXSprite); overload;

Move a sprite to the center position of this sprite

Public procedure AttatchTo(Sprite: TPHXSprite; const Tag: String ); overload;

Attatch another sprite to a tag in the image

Public procedure AttatchTo(Sprite: TPHXSprite; const Tag: TPHXTag); overload;

Attatch another sprite to a tag in the image

Public procedure CreateDefaultShape;

Creates a box shape that fits this sprite

Public procedure BringToFront;

Move the sprite to the front

Public procedure SendToBack;

Send the sprite to the back

Public function Clone: TPHXSprite; virtual;

Return a clone of this sprite

Public procedure Assign(Sprite: TPHXSprite); virtual;

Copy all properties from another sprite to this sprite

Properties

Public property Engine: TPHXSpriteEngine read FEngine;

The sprite engine

Public property Parent: TPHXSprite read FParent write SetParent;

The parent sprite

Public property Sprites: TPHXSpriteList read FSprites;

Child sprites

Public property Name: String read FName write FName;

The name of the sprite

Public property Time: Double read FTime write FTime;

Elapsed time

Public property Visible: Boolean read FVisible write FVisible;

Toggles if the entity is visible

Public property Alive: Boolean read FAlive;

If the sprite is alive.

Public property Active: Boolean read FActive write FActive;

If the sprite is active

Public property Position: TVector3f read FPosition write SetPosition;

Position of the sprite

Public property X: Single read FPosition.X write SetPositionX;

Current X-position

Public property Y: Single read FPosition.Y write SetPositionY;

Current Y-position

Public property Layer: Single read FPosition.Z write SetPositionZ;

Current Z-position

Public property Rotation: Single read FRotation write SetRotation;

Current rotation

Public property Bounds: TRectf read FLocalBounds write SetBounds;

Bounding box of the sprite

Public property Image: String read FImage write SetImage;

The imgage for the sprite

Public property Pattern: String read FPattern write SetPattern;

The pattern index for the sprite

Public property Shape: String read FShape write SetShape;

This is the shape to be used for collision testing

Public property Alpha: Single read FColor.Alpha write FColor.Alpha;

The alpha value of the sprite

Public property Color: TColor4f read FColor write FColor;

The color of the sprite

Public property Collider: Boolean read FCollider write SetCollider;

If this sprite should be considered in the collision testing

Public property Mode: TPHXSpriteCollisionMode read FMode write FMode;

The collision mode of the sprite

Public property Group: TPHXSpriteCollisionGroup read FGroup write FGroup;

The collision mode of the sprite

Public property LocalTransform: TMatrix4 read FLocalTransform;

property CollisionEnabled: Boolean read FCollisionData write FCollisionData;

property CollisionGroup: TPHXSpriteCollisionMode read FCollisionGroup write FCollisionGroup;

property CollisionMode: TPHXSpriteCollisionGroup read FCollisionFilter write FCollisionFilter;

property CollisionData: Pointer read FCollisionData write FCollisionData; Relative transformation between the parent and this sprite

Public property FinalTransform: TMatrix4 read FFinalTransform;

Absolute transformation in world coordinates

Public property LocalBounds: TRectf read FLocalBounds;

Bounding box in releative sprite coordinates

Public property FinalBounds: TRectf read FFinalBounds;

Bounding box in absolute world coordinates

Public property LocalShape: TPHXShape read FLocalShape;

Shape in releative sprite coordinates

Public property FinalShape: TPHXShape read FFinalShape;

Shape in absolute world coordinates

Public property Width: Integer read GetWidth;

Width of the sprite

Public property Height: Integer read GetHeight;

Height of the sprite

Public property LinkedImage: TPHXImage read FLinkedImage write SetImageL;

The current image

Public property LinkedPattern: TPHXPatternIndex read FLinkedPattern write SetPatternL;

The current pattern

Public property LinkedShape: TPHXShape read FLinkedShape write SetShapeL;

The current shape


Generated by PasDoc 0.13.0 on 2013-08-26 11:02:42