// Elysion Frameworks
// Basic Game unit
// Abstract layer for games 
//
// (C) 2009, Johannes Stein
// Freeze.Dev - http://www.freeze-dev.de
//

unit BasicGame;

interface

uses
    ElysionKronos;


type
TBasicGame = Class(TelObject)
  private
    function GetWidth: Integer;
    function GetHeight: Integer;
  public
    // Creates TBasicGame with no strings attached
    // A window needs to be created manually if not done yet
    constructor Create(); Overload; Override;
    
    // Creates TBasicGame and creates a window
    constructor Create(Width, Height, BPP: Integer; Fullscreen: Boolean); Overload;

    destructor Destroy(); Override;
  
    procedure Initialize(); virtual; abstract;
    
    procedure Render(); virtual; abstract;
    procedure Update(dt: Double); virtual; abstract;
  published
    property Width: Integer read GetWidth;
    property Height: Integer read GetHeight;
end;

implementation

constructor TBasicGame.Create();
begin

end;

constructor TBasicGame.Create(Width, Height, BPP: Integer; Fullscreen: Boolean);
begin
  Application.Initialize(Width, Height, BPP, Fullscreen);
end;

destructor TBasicGame.Destroy();
begin
  inherited;
end;

function TBasicGame.GetWidth: Integer;
begin
  if ActiveWindow <> nil then Result := ActiveWindow.Width;
end;

function TBasicGame.GetHeight: Integer;
begin
  if ActiveWindow <> nil then Result := ActiveWindow.Height;
end;

end.
