设为首页 加入收藏

TOP

【Spine】Spine Runtime for Delphi移植笔记(四) - spine.classes
2017-10-10 12:04:51 】 浏览:3596
Tags:Spine Runtime for Delphi 移植 笔记 spine.classes
////////////////////////////////////////////////////////////////////////////////
//Generic delphi runtime v3.6 for Spine animation tool                        //
//Runtime port by cjk (hzi1980@163.com)                                       //
////////////////////////////////////////////////////////////////////////////////

unit spine.classes;

interface

uses
  System.Classes, System.SysUtils, System.Generics.Collections, spine.types;

type
  THashSet<T> = class
  private
  public
    procedure Clear;
    function Add(const Item: T): Boolean;
  end;

  TExposedList<T> = class(TList<T>)
  private
    FVersion: Integer;
    procedure ClearEx(const AIndex, ALen: Integer); overload;
    procedure Shift(const AStart, ADelta: Integer);
  public
    procedure EnsureCapacity(const AMin: Integer);
    procedure ClearEx(const AClearArray: Boolean = True); overload;
    function  Resize(const ANewSize: Integer): TExposedList<T>;
    procedure RemoveAt(const AIndex: Integer);
    procedure CopyFrom(const ASource: TExposedList<T>); overload;
    procedure CopyFrom(const ASource: TExposedList<T>;
      const ASourceStart, ATargetStart, ACount: Integer); overload;
  end;

  TSpineTexture = class(TObject)

  end;

  TAtlasPage = class(TObject)
  public
    Name: AnsiString;
    Format: TPageFormat;
    MinFilter: TPageTextureFilter;
    MagFilter: TPageTextureFilter;
    WrapU: TPageTextureWrap;
    WrapV: TPageTextureWrap;
    Texture: TSpineTexture;
    Width: Integer;
    Height: Integer;
    end;

  TAtlasRegion = class(TObject)
    Page: TAtlasPage;
    Name: AnsiString;
    X: Integer;
    Y: Integer;
    Width: Integer;
    Height: Integer;
    U: Single;
    V: Single;
    U2: Single;
    V2: Single;
    OffsetX: Single;
    OffsetY: Single;
    OriginalWidth: Integer;
    OriginalHeight: Integer;
    Index: Integer;
    Rotate: Boolean;
    Splits: array of Integer;
    Pads: array of Integer;
    end;

  ITextureLoader = class abstract
    function LoadTexture(const Page: TAtlasPage; const TextureName: string): TSpineTexture; virtual; abstract;
  end;

  IUpdateable = class abstract
    procedure Update; virtual; abstract;
  end;

  IAtlas = class abstract end;
  ISkeleton = class abstract end;
  IBone = class(IUpdateable) end;
  ISlot = class abstract end;
  IEvent = class abstract end;
  IAnimation = class abstract end;
  IAnimationState = class abstract end;
  ISkin = class abstract end;

  IAttachment = class abstract
  protected
    function GetID: Integer; virtual; abstract;
    function GetName: string; virtual; abstract;
  public
    property ID: Integer read GetID;
    property Name: string read GetName;
  end;

  IConstraint = class(IUpdateable)
  protected
    function GetOrder: Integer; virtual; abstract;
  public
    property Order: Integer read GetOrder;
  end;

  ITimeline = class abstract
  protected
    function GetPropertyId: Integer; virtual; abstract;
  public
    procedure Apply(const ASkeleton: ISkeleton;
                    const ALastTime, ATime: Single;
                    const AEvents: TList<IEvent>;
                    const AAlpha: Single;
                    const APose: TMixPose;
                    const ADirection: TMixDirection); virtual; abstract;
    property PropertyId: Integer read GetPropertyId;
  end;

implementation

end.

 

类定义,I 开头的抽象类大多数只是为了定义一下,因为需要单元间交叉引用,但是又不想都是定义为TObject,写接口又没必要,只能这么写了。

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇【Spine】Spine Runtime for Delp.. 下一篇firemonkey ListView DynamicAppe..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目