unit _Resources;

interface

uses
  QuadEngine,
  Classes;

const
  UNITS_SIZE = 128;

  type
TResources = class
  private
    const TILE_SIZE = 64;   
    const UNIT_SIZE = 64;
    const PATH = 'Data/';  
  private
    FQuad: IQuadRender;
  public
    Intro,
    QuadTexture: IQuadTexture;
    LogoTexture: IQuadTexture;
    TileTexture: IQuadTexture;
    UnitTexture: IQuadTexture;
    MapTexture:  IQuadTexture;
    RadiusTexture: IQuadTexture;
    EndTurnTexture: IQuadTexture;
    Win1Texture: IQuadTexture;
    Win2Texture: IQuadTexture;
    Lose1Texture: IQuadTexture;
    Lose2Texture: IQuadTexture;
    Font: IQuadFont;
    constructor Load(Quad: IQuadRender);
    destructor Destroy;
    property Quad: IQuadRender read FQuad;
  end;

var
  Resources: TResources;

implementation

//TResources
constructor TResources.Load(Quad: IQuadRender);
begin
  FQuad:= Quad;
  TileTexture:=    FQuad.CreateAndLoadTexture(0, PATH + 'tiles.png', TILE_SIZE, TILE_SIZE);
  QuadTexture:=    FQuad.CreateAndLoadTexture(0, PATH + 'quad.png');
  LogoTexture:=    FQuad.CreateAndLoadTexture(0, PATH + 'logo.png');
  UnitTexture:=    FQuad.CreateAndLoadTexture(0, PATH + 'units.png', UNIT_SIZE, UNIT_SIZE);
  RadiusTexture:=  FQuad.CreateAndLoadTexture(0, PATH + 'radius.png');
  EndTurnTexture:= FQuad.CreateAndLoadTexture(0, PATH + 'end_turn.png', TILE_SIZE, TILE_SIZE);
  MapTexture:=     FQuad.CreateAndLoadTexture(0, PATH + 'map.png');  
  Win1Texture:=    FQuad.CreateAndLoadTexture(0, PATH + 'win1.png');
  Win2Texture:=    FQuad.CreateAndLoadTexture(0, PATH + 'win2.png');
  Lose1Texture:=   FQuad.CreateAndLoadTexture(0, PATH + 'lose1.png');
  Lose2Texture:=   FQuad.CreateAndLoadTexture(0, PATH + 'lose2.png');

  Font:= FQuad.CreateAndLoadFont(PATH + 'Font/Font.png', PATH + 'Font/Font.qef');

  Font.SetIsSmartColoring(True);
end;

destructor TResources.Destroy;
begin
  inherited;
  QuadTexture:= nil;
  LogoTexture:= nil;
  TileTexture:= nil;
  UnitTexture:= nil;
  RadiusTexture:= nil;
  EndTurnTexture:= nil;
  MapTexture:= nil;
  Win1Texture:= nil;
  Win2Texture:= nil;
  Lose1Texture:= nil;
  Lose2Texture:= nil;
  Font:= nil;
  inherited;
end;

end.
