AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Thema durchsuchen
Ansicht
Themen-Optionen

Andorra 2D [Ver. 0.4.5.1, 31.12.08]

Ein Thema von igel457 · begonnen am 24. Nov 2006 · letzter Beitrag vom 14. Sep 2011
 
Benutzerbild von Codewalker
Codewalker

Registriert seit: 18. Nov 2005
Ort: Ratingen
945 Beiträge
 
Delphi XE2 Professional
 
#11

Re: Andorra 2D - The Next Generation 2D Engine [Ver. 0.20 AL

  Alt 2. Mai 2007, 19:34
Ich habe mal alle Stellen zusammengesucht.

Die Deklaration der neuen Engine:
Delphi-Quellcode:
  TZoomSpriteengine = class(TSpriteEngine)
  private
    FZoom: Integer;
    procedure SetZoom(const Value: Integer);
  public
    property Zoom: Integer Read FZoom Write SetZoom;
  end;

{............}

procedure TZoomSpriteengine.SetZoom(const Value: Integer);
var
  r: TRect;
  w, h: integer;
begin
  FZoom := Value;
  r := FSurfaceRect;
  w := r.Right - r.Left;
  h := r.Bottom - r.Top;
  FSurfaceRect := Rect(r.Left - w * Zoom, r.Top - h * Zoom,
    r.Right + w * Zoom, r.Bottom + h * Zoom);
end;
Und jetzt die Zoomfunktionen im Hauptprogramm:

Delphi-Quellcode:
procedure TForm1.ZoomIn(Sender: TObject);
begin
  if Settings.Zoom = 1 then // Only Setup Zoom if change is necessary
    Exit;
  Settings.Zoom := 1; // Change Zoom to Close-View
  SpriteEngine.Zoom := Settings.Zoom; // Apply View to Engine
  AdDraw.AdAppl.Setup2DScene(DrawBox.Width * Settings.Zoom, // Recalibrate Viewports
    DrawBox.Height * Settings.Zoom);
  Spriteengine.X := Spriteengine.X - DrawBox.Width / 2; // Make Camera focus old target point
  Spriteengine.Y := Spriteengine.Y - DrawBox.Height / 2;
end;
DrawBox ist eine PaintBox, die ich als Positionshilfe nutze. Settings ist nur eine Hilfsklasse.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:15 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz