Lazarus

Installation => General => Topic started by: p.barton@twgs.qld.edu.au on August 28, 2012, 01:27:34 am

Title: Using graph unit
Post by: p.barton@twgs.qld.edu.au on August 28, 2012, 01:27:34 am
Hi,
Trying to get Lazarus to run the "graph" unit in Pascal - uses graph;

Works just fine when installed on my laptop but when installing onto our school network get this message:
C:\Users\bartp\AppData\Local\Temp\project1.lpr(1,1) Fatal: Can't find unit Graph used by UsingGraphics

I'm guessing it is something to do with the path of the graph unit.  Any suggestions?

Sample code I'm running to check if graphics will work below:

Program UsingGraphics;
Uses Crt,Graph;
Var GraphicsDriver, GraphicsMode:smallint;

procedure OpenGraphics;
Begin
 Writeln('Graphics Initialised.');
 GraphicsDriver := Detect;
 InitGraph(GraphicsDriver, GraphicsMode,'');
end;

procedure CloseGraphics;
begin
     CloseGraph;
     Writeln('Graphics Closed.');
End;

procedure DrawCircle;
begin
     circle(320,240,100);
end;

{MISSION CONTROL}
begin
     OpenGraphics;
     repeat
   DrawCircle
     until keypressed;
     CloseGraphics;
     readln;
end.
Title: Re: Using graph unit
Post by: Blaazen on August 28, 2012, 01:48:32 am
There were some discussions about this unit, I don't if it is somewhere in FPC sources.
Try unit "ptcgraph" instead.
Title: Re: Using graph unit
Post by: p.barton@twgs.qld.edu.au on August 28, 2012, 01:57:38 am
No good, thanks for your suggestion.
Title: Re: Using graph unit
Post by: Avishai on August 28, 2012, 02:00:08 am
On my system it is at C:\Lazarus\Fpc\2.6.1\Source\Packages\Graph\Src\Win32
But it depends on the OS.  Check in C:\Lazarus\Fpc\2.6.1\Source\Packages\Graph\Src for your OS.
Title: Re: Using graph unit
Post by: p.barton@twgs.qld.edu.au on August 28, 2012, 02:08:12 am
Thanks for your help.  Have it working fine on my laptop but when I try to run using machines on our school network it can't find the graph.pp file.  I have tried adding the path in the InitGraph section but without success.
Will keep trying. Thanks.
Title: Re: Using graph unit
Post by: Avishai on August 28, 2012, 02:16:55 am
If you Open the Project Inspector from  Menu "Project/Project Inspector" click on the "Add" button, it will add it to the Path.

Edit: Then go to "Project/Project Options" and check the box for "Use these compiler Options as Default for new projects".
Title: Re: Using graph unit
Post by: marcov on August 28, 2012, 10:17:12 am
Windows is a special case, it is called "wingraph" there, just like in Windows versions of Turbo Pascal.
The "win" alludes to the integration with Windows GDI system.

See the games in the FPC demos/examples (fpctris/samegame) for examples of graph.

I don't know if Lazarus packages those though.

TinyPortal © 2005-2018