Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-06

Can We use CRT and Video Unit in Single Unit In free pascal

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tomas Hajny
to Jonas Maebe
Jonas Maebe wrote 6 lines
On 23 Jun 2014, at 09:45, mokashe.ram wrote: > Can We use CRT and Video Unit in Single Unit Simulteneously... That is documented: http://www.freepascal.org/docs-html/rtl/video/ (the remark at the bottom of the page)

While Jonas is correct that this combination is neither recommended nor officially supported (among others due to the fact that this combination would not work on some of FPC supported platforms), it _does_ work for some other platforms as already mentioned on this list in another thread also started by you (see
http://lists.freepascal.org/pipermail/fpc-pascal/2014-May/041991.html).

Tomas

Reply by email

mokashe.ram
to Tomas Hajny

Hi
Thanks for your help.
I have Gone throgh the previous post,

(In)compatibility of units Video and Crt is platform (implementation) specific thing. They can be used together without any issues on platforms
providing sufficient access to the console.

*it means i cann't use write/Writeln function using video unit*

i just want to check at particular screen location value exist or not using Videobuf ( ex. If VideoBuf[Offset ' ' Then Begin ...End]) . i can check but i cannt use any crt function with VideoBuf.

Please correct me

Thanks
SUD

Reply by email

Tomas Hajny

On Mon, June 23, 2014 12:09, mokashe.ram wrote:

Hi,

Thanks for your help. I have Gone throgh the previous post, (In)compatibility of units Video and Crt is platform

(implementation)

Show quoted text 6 lines
specific thing. They can be used together without any issues on platforms providing sufficient access to the console. *it means i cann't use write/Writeln function using video unit* i just want to check at particular screen location value exist or not using Videobuf ( ex. If VideoBuf[Offset ' ' Then Begin ...End]) . i can

check

but i cannt use any crt function with VideoBuf.

Indeed, you should not mix access to the console using Crt.Write(Ln) with access via Video.VideoBuf^. On the other hand, you can use Video.VideoBuf^ together with keyboard related functions from unit Crt (with the caveat that it would work on e.g. Win32 but not e.g. on Linux).

Vice versa, you may be able to use functionality provided by unit Video for changing the console resolution (under Win32) together with Crt.Write(Ln) as long as you re-initialize the window coordinates (Crt.Window) after Video.SetVideoMode and before any Crt.Write(Ln).

Tomas

Reply by email

DaWorm
to Tomas Hajny

Or you can do the right thing and not use the contents of the video memory as if it were a variable to be used to check if you have or have not done a particular thing, which is what it looks like your original code does.

This would require understanding more of what the program you are porting was intended to do and less of how it did it. Once you have that, so many questions answer themselves.

Jeff.

Reply by email