From: "VisionForce" <[EMAIL PROTECTED]> To: "FreePascal Developer" <[email protected]> Date sent: Thu, 1 Dec 2005 21:26:49 -0600 Subject: [fpc-devel] Coding Questions Send reply to: FPC developers' list <[email protected]> <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]>
> I have some coding questions: > > 1. Is there a synchronous readkey function, instead of that > asynchronous one? I'm trying to make a simple game to help me learn > Pascal, but I got stuck on this. I know that Turbo Pascal 7 has the > synchronous readkey, but isn't there a way to do this in normal > Pascal? Have a look at unit Keyboard (function PollKeyEvent). > 2. How would I delay the movement of something? When I use Delay(250), > it delays the whole program. In VB, I would write this: . . > So what do I do? Oh, and I need this to be strictly Pascal if > possible, not Delphi; and I'm using the Crt code, so it's a shell > (command prompt style), not Windows forms. One possible cross-platform solution for this (certainly not the only one, but probably fitting quite well here) would be to use function GetMsCount from unit Dos. Regardless of the exact value returned by this call, the difference of values provided by two calls to this function should always be equal to the amount of milliseconds between the two calls (or at least as close to this as the implementation for a particular platform allows). Tomas _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
