Author Topic: A simple old-school demo  (Read 8417 times)

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: A simple old-school demo
« Reply #15 on: December 08, 2012, 09:13:02 AM »
Yes, drawing can't be much faster, EGSL is after all an FPC prgram.  ;) The only thing that's possible with Freepascal (and almost not with EGSL) is a raycaster.

Tomaaz

  • Guest
Re: A simple old-school demo
« Reply #16 on: January 10, 2013, 07:42:02 PM »
I tried to compile the demo with new egslengine and got this:
Quote
...
test.pas(35,57) Error: Incompatible type for arg no. 2: Got "Extended", expected "LongInt"
test.pas(180,62) Error: Incompatible type for arg no. 2: Got "Extended", expected "Byte"
test.pas(190) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
...

It doesn't make any sense to me. Here are the lines of code:

Code: [Select]
...
[35] putimage(int(sx * 40 + przes), int(sy * 40 + przes2), picture2);
...
[180] colour(int((255 - kol) / 4 + 64), int((255 - kol) / 4 + 64), 0);
...

How is it possible that first argument is accepted, but the second is not? And why it has got Extended?

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: A simple old-school demo
« Reply #17 on: January 10, 2013, 07:49:18 PM »
That's because the int() function changed. Actually this is the Freepascal int() function which is described as this:
Quote
Int returns the integer part of any Real X, as a Real.
So it returns Real. Please use trunc() instead of int().
This only affects Pascal programs. With Lua, int() still works. It works now like trunc(), for rounding in Lua please use round().

Tomaaz

  • Guest
Re: A simple old-school demo
« Reply #18 on: January 10, 2013, 10:21:13 PM »
Thanx!