unit iz_Options;

interface
uses
  iz_types, iz_cfg, iz_gfx, iz_Input;

type
  izzInputOptions = ^izInputOptions;
  izInputOptions = record
    // Acion
    kEscape,
    kPouse,
    kFps : word;
  end;

  izzOptions = ^izOptions;
  izOptions = record
    // System
    //  Graphics
    ScreenWidth,
    ScreenHeight,
    BitDepth,
    Freq,
    FScreen,
    vSync : word;
    // Input
    InputOptions : izInputOptions;
  end;
var
  Options : izOptions;

procedure Options_Load(self : izzOptions; FileName : string);
procedure Options_Input_Load(self : izzOptions; FileName : string);
implementation

procedure Options_Load(self : izzOptions; FileName : string);
begin
  // System
  //  Graphics
  self^.ScreenWidth := Cfg_ReadInt(FileName, 'SYSTEM_GRAPHICS:Width', 800);
  self^.ScreenHeight := Cfg_ReadInt(FileName, 'SYSTEM_GRAPHICS:Height', 600);
  self^.BitDepth := Cfg_ReadInt(FileName, 'SYSTEM_GRAPHICS:Bits', 32);
  self^.FScreen := Cfg_ReadInt(FileName, 'SYSTEM_GRAPHICS:Fullscreen', 0);
  self^.Freq := Cfg_ReadInt(FileName, 'SYSTEM_GRAPHICS:Freq', 75);
  self^.vSync := Cfg_ReadInt(FileName, 'SYSTEM_GRAPHICS:vSync', 1);
end;

procedure Options_Input_Load(self : izzOptions; FileName : string);
begin
  self^.InputOptions.kEscape := Cfg_ReadInt(FileName, 'CONTROL:ESCAPE', 27);
  self^.InputOptions.kFps:= Cfg_ReadInt(FileName, 'CONTROL_ACTION:FPS', 80);
end;

end.
