unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, GLScene, GLObjects, GLMisc, GLWin32Viewer, GLCadencer;
type
TForm1 =
class(TForm)
GLScene1: TGLScene;
GLSceneViewer1: TGLSceneViewer;
GLCamera1: TGLCamera;
GLLightSource1: TGLLightSource;
GLCube1: TGLCube;
GLCadencer1: TGLCadencer;
procedure GLCadencer1Progress(Sender: TObject;
const deltaTime,
newTime: Double);
procedure GLSceneViewer1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
MousePos: TPoint;
//Mausposi für Weltendrehung
implementation
{$R *.dfm}
procedure TForm1.GLCadencer1Progress(Sender: TObject;
const deltaTime,
newTime: Double);
begin
glcube1.Turn(deltatime*45);
end;
procedure TForm1.GLSceneViewer1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
//Daten erforderlich für die Drehung des Weltsystems
MousePos.X := X;
MousePos.Y := Y;
Screen.Cursor:=crSizeAll;
end;
procedure TForm1.GLSceneViewer1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if ssLeft
in Shift
then
GLCamera1.MoveAroundTarget((MousePos.Y - Y) / 2, (MousePos.X - X) / 2);
MousePos.X := X;
MousePos.Y := Y;
end;
end.