So I'm a complete newbie to programming, and would be appreciative of any help/'pointing' in the right direction. If not much is required, then I'd appreciate it if someone could actually post the solution.
Basically, I'm creating a projectile motion simulator. The simulator works perfectly, however I have one slight problem: the number of points I need to connect in my program vary. At the moment, I'm just using a huge array size (eg of 10,000) to compensate. Really I'd like a cleaner way of doing this. Now I'm sure you're all thinking: dynamic arrays! However, when trying to use dynamic arrays, I get pages and pages of errors. I'm told it's because the Windows API functions don't have access to the dynamic array's memory heap. Here's my current code:
procedure TNewPageControl.PaintWindow(DC : HDC);
var
Points : Array [1..10000] of TPoint;
NumOfPoints : integer;
begin
{Generate Point Co-Ordinates and Increment NumOfPoints}
PolyLine(DC, Points, NumOfPoints);
end;
As I said, whilst my code works perfectly, I'd just like a more sophisticated solution than what I have at the moment. I've been told I can use pointers (which I know nothing about) to act almost like a dynamic array which the Windows function can understand. Does anyone know how I could do this?
I'm using Lazarus, if that makes any difference. If I don't get any answers here, I'll try asking on the Lazarus forums.
Thanks :)