unit uBasic;

interface

uses SysUtils;


const
  // Grid size (in pixels)
  GRID_SIZE = 80;
  
  // Top meu (in pixels)
  TOP_MENU = 40;

  {$IFDEF WINDOWS}
    PATH = '..\resources\';
  {$ELSE}
    {$IFDEF DARWIN}
    // Specific constant for Mac OS X
    PATH = '../Resources/';
    {$ELSE}
	// Linux, FreeBSD and other UNIX machines
    PATH = '../resources/';
    {$ENDIF}
  {$ENDIF}

type  
  TRace = (raOrc, raHuman);
  TUnitType = (utSwordsman, utArcher, utPikeman);

  TGameState = (gsIntro, gsMainMenu, gsGame, gsInstructions, gsSettings);
  TLanguage = (laGerman, laEnglish);
  
  TGauge = record
    Min: Integer;
	Max: Integer;
	Value: Integer;
  end;

function GetResPath: String;
function GetResDataPath: String;
function GetResImgPath: String;
function GetResSndPath: String;
function GetResFontPath: String;
function GetStdFont: String;

function GetGridWidth: Integer;
function GetGridHeight: Integer;

procedure ResetGridBlock;

var GridBlock: array[0..9, 0..7] of Boolean;

implementation

function GetResPath: String;
begin
  Result := PATH;
end;

function GetResDataPath: String;
begin
  {$IFDEF WINDOWS}
    Result := GetResPath + 'data\';
  {$ELSE}
    Result := GetResPath + 'data/';
  {$ENDIF}
end;

function GetResImgPath: String;
begin
  {$IFDEF WINDOWS}
    Result := GetResPath + 'images\';
  {$ELSE}
    Result := GetResPath + 'images/';
  {$ENDIF}
end;

function GetResSndPath: String;
begin
  {$IFDEF WINDOWS}
    Result := GetResPath + 'sounds\';
  {$ELSE}
    Result := GetResPath + 'sounds/';
  {$ENDIF}
end;

function GetResFontPath: String;
begin
  {$IFDEF WINDOWS}
    Result := GetResPath + 'fonts\';
  {$ELSE}
    Result := GetResPath + 'fonts/';
  {$ENDIF}
end;

function GetStdFont: String;
begin
	Result := GetResFontPath + 'DejaVuSans.ttf';
end;

function GetGridWidth: Integer;
begin
  Result := (800 div GRID_SIZE) - 1;
end;

function GetGridHeight: Integer;
begin
  Result := ((600 - TOP_MENU) div GRID_SIZE);
end;

procedure ResetGridBlock;
var i, j: Integer;
begin
  for i := 0 to GetGridWidth do
  begin
    for j := 0 to GetGridHeight do GridBlock[i, j] := false;
  end;
end;

end.