Changeset 7 for trunk/Platform


Ignore:
Timestamp:
May 9, 2015, 12:00:33 AM (10 years ago)
Author:
chronos
Message:
  • Added: Action to switch to full screen mode.
  • Added: Video driver registration.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Platform/Base/UPlatformBase.pas

    r6 r7  
    5757  end;
    5858
     59  { TBaseVideoDevice }
     60
     61  TBaseVideoDevice = class(TDevice)
     62  private
     63    FOnRedraw: TNotifyEvent;
     64  public
     65    VideoMemory: PByte;
     66    VideoMemorySize: TPoint;
     67    DPI: Integer;
     68    constructor Create; override;
     69    destructor Destroy; override;
     70    procedure Service(Index: Integer; DataIn, DataOut: TMemory); override;
     71    property OnRedraw: TNotifyEvent read FOnRedraw write FOnRedraw;
     72  end;
     73
    5974implementation
     75
     76{ TBaseVideoDevice }
     77
     78constructor TBaseVideoDevice.Create;
     79begin
     80  inherited Create;
     81end;
     82
     83destructor TBaseVideoDevice.Destroy;
     84begin
     85  inherited Destroy;
     86end;
     87
     88procedure TBaseVideoDevice.Service(Index: Integer; DataIn, DataOut: TMemory);
     89begin
     90  if Index = 0 then begin
     91    // Redraw to screen
     92    if Assigned(FOnRedraw) then
     93      FOnRedraw(Self);
     94  end else
     95  if Index = 1 then begin
     96    // Get video memory
     97    VideoMemory := GetMem(VideoMemorySize.X * VideoMemorySize.Y * 4);
     98//    DataOut^ := VideoMemory;
     99//    DataOut^ := VideoMemory;
     100  end else inherited;
     101end;
    60102
    61103{ TBaseSerialDevice }
     
    76118procedure TBaseSerialDevice.Service(Index: Integer; DataIn, DataOut: TMemory);
    77119begin
    78   inherited Service(Index, DataIn, DataOut);
    79120  if Index = 0 then begin
    80121    Lock.Acquire;
     
    82123      FOnReceiveData(DataIn);
    83124    Lock.Release;
    84   end else raise Exception.Create('Unsupported service ' + IntToStr(Index) + ' for driver ''' + Name + '''');
     125  end else inherited;
    85126end;
    86127
Note: See TracChangeset for help on using the changeset viewer.