Changeset 561 for trunk


Ignore:
Timestamp:
Apr 28, 2024, 12:39:51 AM (8 months ago)
Author:
chronos
Message:
  • Fixed: Resize Term window offscreen bitmap on screen size change. Needed for tablet PC where screen can rotate.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r559 r561  
    17291729  UnusedTribeFiles := TStringList.Create;
    17301730  UnusedTribeFiles.Sorted := True;
    1731   TribeNames := tstringlist.Create;
     1731  TribeNames := TStringList.Create;
    17321732
    17331733  IsoEngine.Init(InitEnemyModel);
     
    56245624          PaintLocTemp(MyUn[UnFocus].Loc, pltsBlink);
    56255625          PaintDestination;
    5626           // if MoveHintToLoc>=0 then
    5627           // ShowMoveHint(MoveHintToLoc, true);
     5626          // if MoveHintToLoc >= 0 then
     5627          // ShowMoveHint(MoveHintToLoc, True);
    56285628        end;
    56295629      end
     
    82878287  MiniFrame, MaxMapWidth: Integer;
    82888288begin
     8289  BaseWin.CreateOffscreen(Offscreen);
    82898290  SmallScreen := Width < 1024;
    82908291  with MainMap do begin
  • trunk/Packages/CevoComponents/BaseWin.pas

    r558 r561  
    476476
    477477procedure CreateOffscreen(var Offscreen: TBitmap);
    478 begin
    479   if Offscreen <> nil then
    480     Exit;
    481   Offscreen := TBitmap.Create;
    482   Offscreen.PixelFormat := TPixelFormat.pf24bit;
    483   if Screen.Height - yUnused < 480 then
    484     Offscreen.SetSize(Screen.Width, 480)
    485   else
    486     Offscreen.SetSize(Screen.Width, Screen.Height - yUnused);
    487   Offscreen.Canvas.FillRect(0, 0, Offscreen.Width, OffScreen.Height);
    488   Offscreen.Canvas.Brush.Style := TBrushStyle.bsClear;
     478var
     479  NewWidth: Integer;
     480  NewHeight: Integer;
     481begin
     482  if not Assigned(Offscreen) then begin
     483    Offscreen := TBitmap.Create;
     484    Offscreen.PixelFormat := TPixelFormat.pf24bit;
     485  end;
     486  if Screen.Height - yUnused < 480 then begin
     487    NewWidth := Screen.Width;
     488    NewHeight := 480;
     489  end else begin
     490    NewWidth := Screen.Width;
     491    NewHeight := Screen.Height - yUnused;
     492  end;
     493  if (Offscreen.Width <> NewWidth) or (Offscreen.Height <> NewHeight) then begin
     494    Offscreen.SetSize(NewWidth, NewHeight);
     495    Offscreen.Canvas.FillRect(0, 0, Offscreen.Width, OffScreen.Height);
     496    Offscreen.Canvas.Brush.Style := TBrushStyle.bsClear;
     497  end;
    489498end;
    490499
Note: See TracChangeset for help on using the changeset viewer.