diff --git a/maingameunit.pas b/maingameunit.pas index f66859b..a5c7e1f 100755 --- a/maingameunit.pas +++ b/maingameunit.pas @@ -21,7 +21,7 @@ interface type TMyEventListener = class(TComponent) - procedure ReceivedIsActive(Event: TX3DEvent; Value: TX3DField; const Time: TX3DTime); + procedure ReceivedIsActive(const Event: TX3DEvent; const Value: TX3DField; const Time: TX3DTime); end; { TCastleApp } @@ -44,7 +44,7 @@ TCastleApp = class(TForm) TCastleApp = class(TWindowContainer) {$endif} private - Viewport: TCastleViewport; + Viewport: TCastleAutoNavigationViewport; Scene: TCastleScene; ColorChoice: Integer; MasterTexture: TRGBAlphaImage; @@ -111,7 +111,7 @@ implementation { Taken from example and slightly modified } -procedure TMyEventListener.ReceivedIsActive(Event: TX3DEvent; Value: TX3DField; const Time: TX3DTime); +procedure TMyEventListener.ReceivedIsActive(const Event: TX3DEvent; const Value: TX3DField; const Time: TX3DTime); var AColor: Cardinal; Val: Boolean; @@ -125,7 +125,7 @@ procedure TMyEventListener.ReceivedIsActive(Event: TX3DEvent; Value: TX3DField; if Val then begin // Find out the currnt color of the model - AColor := TTouchSensorNode(Event.ParentNode).MetadataInteger['Color', 0]; + AColor := TTouchSensorNode(Event.ParentNode).MetadataInteger['Color']; LabelT2.Caption := Format('isActive %d : %s', [evt_t2, IntToHex(AColor, 6)]); Inc(evt_t2); // Change color @@ -158,13 +158,13 @@ procedure TCastleApp.SetSensor(AScene: TCastleScene; AColor: TVector4Byte); TouchSensor := TTouchSensorNode.Create('TextureColor'); TouchSensor.Enabled := true; TouchSensor.EventIsActive.AddNotification(@EventListener.ReceivedIsActive); - TouchSensor.MetadataInteger['Color', 0] := Vec4BtoInt(NewColor); + TouchSensor.MetadataInteger['Color'] := Vec4BtoInt(NewColor); TransformNode.AddChildren(TouchSensor); LabelT1.Caption := 'Sensor set - ' + IntToHex(Vec4BtoInt(NewColor), 6); end else begin - TouchSensor.MetadataInteger['Color', 0] := Vec4BtoInt(NewColor); + TouchSensor.MetadataInteger['Color'] := Vec4BtoInt(NewColor); LabelT1.Caption := 'Sensor set - ' + IntToHex(Vec4BtoInt(NewColor), 6); end; end @@ -351,7 +351,7 @@ procedure TCastleApp.LoadScene(Sender: TObject; filename: String); TempImage: TRGBAlphaImage; begin // Set up the main viewport - Viewport := TCastleViewport.Create(Application); + Viewport := TCastleAutoNavigationViewport.Create(Application); // Use all the viewport Viewport.FullSize := true; // Automatically position the camera