Wie wäre es dann mit Pointern damit müsste ich doch dieses Problem lösen können?
Also ich habe es mahl so probiert aber ich bekomme immer eine "EAccessViolation"
Delphi-Quelltext
1:
| PMyGraphicObject = ^TMyGraphicObject; |
Einen Pointer auf "TMyGraphicObject"
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8:
| function GetObject(Index: integer): PMyGraphicObject;
property Objects[Index: integer]: PMyGraphicObject read GetObject;
function TMyGraphicEngineObjects.GetObject(Index: integer): PMyGraphicObject; begin result:= @GraphicObj[Index]; end; |
"PMyGraphicObject" benutzen und mit "@GraphicObj[Index]" den Pointer übergeben.
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| GE.GraphicObjects.Objects[0]^.DrawPosition:= dpZero; GE.GraphicObjects.Objects[0]^.XPos:= x*TileSize; GE.GraphicObjects.Objects[0]^.YPos:= y*TileSize; GE.GraphicObjects.Objects[0]^.ZPos:= 1; GE.GraphicObjects.Objects[0]^.Width:= TileSize; GE.GraphicObjects.Objects[0]^.Height:= TileSize; GE.GraphicObjects.Objects[0]^.Scale.XScale:= 1; GE.GraphicObjects.Objects[0]^.Scale.YScale:= 1; GE.GraphicObjects.Objects[0]^.BlendType:= btNormal; GE.GraphicObjects.Objects[0]^.ObjectType:= gotNormal; GE.GraphicObjects.Objects[0]^.TextureID:= 0; |
Ich müsste doch hier "GE.GraphicObjects.Objects[0]" meinen Pointer bekommen den ich mit "^" dereferenziere und dann ganz normal in meinen record schreiben kann aber wie gesagt bekomme ich schon bei "GE.GraphicObjects.Objects[0]^.DrawPosition:= dpZero;" eine "EAccessViolation"