Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with latest CGE #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions maingameunit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -44,7 +44,7 @@ TCastleApp = class(TForm)
TCastleApp = class(TWindowContainer)
{$endif}
private
Viewport: TCastleViewport;
Viewport: TCastleAutoNavigationViewport;
Scene: TCastleScene;
ColorChoice: Integer;
MasterTexture: TRGBAlphaImage;
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down