View Full Version : Greeting to the community + my problem (PTCPas)

19-04-2007, 05:43 PM
Hi there everyone.
My name is Ivano and I'm Italian.
I just finished reading a book on pascal programming and I was about to start a really simple project.
I get stuck using Graph + Keyboard units, as most I see.
I heard of this PTCPas and I tryed to include in my project, but I can't go further than _just trying_ to compile the unit.
I'm using DevPascal with the provided FPC.
What do I need in order to compile the unit?
Another one, where can I find some tutorials or simple advices on initializing a graphic screen and reading keyboard input?

Thanks anyone in advance for any help.

19-04-2007, 07:21 PM
Hey Berserk, welcome to PGD! :)

Dev-Pascal is a little bit dated... you might find a bit more joy in using Lazarus instead. It uses the same compiler (Free Pascal compiler) but with a newer version.

The new FPC is faster, more stable and supports a lot more platforms. Including GameBoy Advance, Nintendo DS, GP2X, Linux, Mac OS X and Win64!

You can get it at http://lazarus.freepascal.org/

Also a great starting game library is SDL. It will allow you to do all of your graphics, sound, music and game controls too.

JEDI-SDL is the Pascal version that you can use with Lazarus or Delphi. It also supports the rest, but those are the two most common ones.

You can get JEDI-SDL at http://sourceforge.net/projects/jedi-sdl

When you get to the downloads page, you want the one on the bottom that says it's 1.0 BETA. A new version is coming soon.

I have also posted step-by-step instructions on how to install both if you can't figure it out yourself.

You can read that here: http://www.pascalgamedevelopment.com/viewtopic.php?t=3973 ;)

19-04-2007, 08:17 PM
I'm using DevPascal as IDE, but with FreePascal (latest stable release).
As for Lazarus, I use it as well but it's not as practical as DevPas, because you always must have a project while sometimes I need to just compile a single unit or file.
As for JEDI-SDL, I know it but it's too "pre-built" for mt flavours.
I'm a do-it-yourself buddy and ptc was the barest one (except graph unit itself).
What can I do in order to get ptc to work with FPC?

19-04-2007, 08:18 PM
PTC has several subdirectories with include files; therefore you should compiled it with the provided makefile; don't try to do it from an IDE or you must set all paths correctly.

However, PTC is shipped with recent versions of FPC, so all that is needed to use it is "uses ptc" in your program, if you upgrade to the latest FPC.

19-04-2007, 09:33 PM
I don't have it in, I'm using FPC 2.0.4.
However, I tryed re-installing everything.
Compiles fine, but I don't know how to install the new units.
(and this works _only_ when I copy and paste the rtl unit where the compiler expects it to be).
Should I copy/paste them somewhere or do something like make install?
I also noted make install does exist, but copyes the compiled units in the root folder, while I wish them to be under fpc/path/to/units.
Finally, what I get in that folder is just some .o files, a couple .ppu but what about all those .inc? Where are "my" ppw etc?

19-04-2007, 11:38 PM
Well to each ones own, but if you want to make games that use modern day graphics, I'd recommend you try a common API like OpenGL or DirectX or even SDL.

19-04-2007, 11:39 PM
Well to each ones own, but if you want to make games that use modern day graphics, I'd recommend you try a common API like OpenGL or DirectX or even SDL.

The days of DOS-type graphics are pretty much gone. :)

20-04-2007, 06:07 AM
Will, ptc is a standard API. It's a SDL like library written in Pascal.

Beserk, you are right 2.0.4 does not contain, apparently we didn't merge it in 2.0.4. So, use the Makefile to compile it.

20-04-2007, 08:43 AM
I know is not a good idea to write games for dos, but it's the way I prefer to do my things.
As for the OpenGL or DirectX API, ptc uses DirectX for painting the screen.
This makes me return to the first question, wich basicly is "how do I use the makefile the right way"?

20-04-2007, 10:33 AM
* Extract the source
* Type "fpcmake -Tall"
* Type "make"

20-04-2007, 04:17 PM
Just done what you suggested. Worked ok, but what's next?
Meanwhile, I done a lazarus package, manually importing the files.
I now have pct figuring as a new package but I can't use its units.
I also wrote the author for support, but I'm waiting for replyes.

20-04-2007, 04:39 PM
Well, you will get a directory units/i386-linux or something like that. In your IDE, add this directory to the unit path, for example in the text mode IDE, go to Options->Directories and add the full path to the directory.

20-04-2007, 05:38 PM
Hey, thank you so much for your help.
I mean everybody.
I finally made to compile and install.

What I done is (steps made):
[command line]
copying rtl folder to /pp/rtl (I had to - this will be clear in a while)
fpcmake in the ptc folder (otherwise, .as files wont compile - doing fpcmake in the packages folder will overwrite the shipped Makefile.fpc)
make in the ptcpas folder
fpcmake in the packages folder (the ptc package was put in /extra/ptc - I also add ptc in the Makefile.fpc in the /extra folder)

New project -> add ptcpas.pp, hermes/hermes.pp
set project -> compile options -> units to (ptcpath)/hermes; (ptcpath)/win32/directdr
set project -> compile options -> include dirs to (ptcpath)/hermes; (ptcpath)/win32/base; (ptcpath)/win32/directdr; (ptcpath)/hermes

compiled everything (again)

Created a new package (new -> standard package, manually added a single dummy file, opened the project, add unit to existing package)

Compiled the package, installed, rebuilt Lazarus.

project -> new project from file
opened (ptcpath)/demos/fire.pp
compiled, everything flawless.
(exception)-> while debugging, I get an error from the exe saying "can't recycle as the console is already opened".
Launching the executable from a console works perfectly.

I hope these info will be useful to whoever wishes to use ptc in Lazarus.