Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Forth for Windows offering a graphics window for drawing?

312 views
Skip to first unread message

Antoni Gual Via

unread,
Jun 16, 2014, 7:07:24 AM6/16/14
to
Hi
I program for hobby and I'm just starting with Gforth. Forth is a different and interesting language!
Is there any implementation that offers a canvas for drawing at the style of the old DOS QBasic ?
I don't want to have to access the windows API and don't need to be able to add a GUI to my programs. I just need to open ane empty window and set the color of pixels on it.
Does it exist?
Kind regards
Antonio

Pablo Hugo Reda

unread,
Jun 16, 2014, 7:59:20 AM6/16/14
to
You can access to copy a memory region to current window with bitbtl, making a framebuffer.

I do this in the VM of :r4, I decide to do this because is OS depedent.

https://code.google.com/p/reda4/

the code of VM are in MV folder..

fort...@gmail.com

unread,
Jun 16, 2014, 10:22:10 AM6/16/14
to
I like the TclForth concept. Gives Forth-like access to the Tk graphical
widgets. I've not done anything serious with it yet, only played a little. But
it looked very promising to me.

http://wiki.tcl.tk/37199

jo...@planet.nl

unread,
Jun 17, 2014, 8:55:30 AM6/17/14
to
Hi Antonio,
> Is there any implementation that offers a canvas for drawing
> at the style of the old DOS QBasic ?
I do'n't know about the QbAsic- method.

>I don't want to have to access the windows API and
> don't need to be able to add a GUI to my programs.
> I just need to open an empty window
Will be hard without using some kind of Windows API or a layer to the windows API

> and set the color of pixels on it.
That part can be done without the use of a windows API
Only when you would like to show the content of the window you need
to call some Windows API
But that part can be done by using one existing Forth definition.

> Does it exist?
See the demo in ParallelPlotter.f which is in juliav442.zip
juliav442.zip can be downloaded from:
https://sites.google.com/site/win324th/sources

Jos
 

ste...@mpeforth.com

unread,
Jun 17, 2014, 11:15:56 AM6/17/14
to

> Is there any implementation that offers a canvas for drawing at the style of the old DOS QBasic ?

It's more in the style of the Borland Turbo system, but the GTK+ interface for VFX Forth for Windows, Linux and Mac is present in all versions, has examples and is documented.

See:
http://www.mpeforth.com/vfxwin.htm

Regards, Stephen

Roger Levy

unread,
Jun 17, 2014, 1:25:08 PM6/17/14
to
I wrote the graphics wordset for that. :)

m...@iae.nl

unread,
Jun 17, 2014, 3:19:39 PM6/17/14
to
On Monday, June 16, 2014 1:07:24 PM UTC+2, Antoni Gual Via wrote:
[..]
> I don't want to have to access the windows API and don't need
> to be able to add a GUI to my programs. I just need to open ane
> empty window and set the color of pixels on it.

(Puts on flameproof underwear)
Here is the Forth way, which does EXACTLY what you asked.

Learn a few postscript words, write your commands to a .ps
file, and click on it with your mouse (outside Forth of course).
It will open in a new window with very high quality :-)

Or look up one of the bitmap binary formats (bmp, xbm, png, ...).
It's simpler because you don't need to learn postscript
(but it will look uglier).

I think Anton Ertl once showed the ps trick for the travelling
salesman problem (or something, maybe he'll tell you). Should
be on his Forth repository. This is even simpler because you
reuse existing code (oeps, burning oil, that hurt).

-marcel

rickman

unread,
Jun 17, 2014, 6:21:25 PM6/17/14
to
On 6/16/2014 7:07 AM, Antoni Gual Via wrote:

I would be happy finding an easy way to send text to a second window as
a scrolling display. This is to show two way comms and I need to have
multiple colors to show the two directions and distinguish error
conditions. I haven't figured out how to do this in Win32Forth as yet.
I'd be happy to give Gforth a try if it has some built in words for
this.

I realize this is all done with Windows calls and I did windows
programming many moons ago. But I haven't figured out the translation
between windows programming and doing it under Forth as yet.

--

Rick

Howerd

unread,
Jun 18, 2014, 3:57:02 AM6/18/14
to
Hi Rick,

I think I came across the same problem some time ago - how to emulate the old DOS text display ( even bytes data, odd bytes attribute ) under Windows.

Its a strange type of "progress" when what used to be trivial under DOS is now extremely difficult under Windows...

There is a similar problem with metadata in files : the Windows way is that Windows handles all metadata ( filename, data, read/write attributes etc... ), which effectively ties you in to Windows.
I have been trying to find an elegant way to save two byte streams (i.e. colour metadata) in a file. It appears to be a non-trivial problem.

Best regards,
Howerd

Stephen Pelc

unread,
Jun 19, 2014, 5:05:36 AM6/19/14
to
On Tue, 17 Jun 2014 10:25:08 -0700 (PDT), Roger Levy
<roger...@gmail.com> wrote:

>I wrote the graphics wordset for that. :)

Indeed you did, and very well too.

Stephen


--
Stephen Pelc, steph...@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

Antoni Gual Via

unread,
Jun 20, 2014, 1:36:09 AM6/20/14
to
El dilluns 16 de juny de 2014 13:07:24 UTC+2, Antoni Gual Via va escriure:
About the drawing canvas in Windows perhaps a simple C library as TinyPTC could be linked in some way.
http://sourceforge.net/projects/tinyptc/

Antonio

Mark Wills

unread,
Jun 20, 2014, 4:29:33 AM6/20/14
to
Where's the docs for the GTK+ interface? I have the evaluation version installed, and I haven't seen any docs. Are the docs only available in the full version? If so fair enough. A cross-platform graphics oriented system that isn't Java is very attractive, to me at least. Nothing against Java in particular, it's just that it's rather on the bloated side.

Antoni Gual Via

unread,
Jun 20, 2014, 4:45:53 AM6/20/14
to
El divendres 20 de juny de 2014 10:29:33 UTC+2, Mark Wills va escriure:
> Where's the docs for the GTK+ interface? I have the evaluation version installed, and I haven't seen any docs. Are the docs only available in the full version? If so fair enough. A cross-platform graphics oriented system that isn't Java is very attractive, to me at least. Nothing against Java in particular, it's just that it's rather on the bloated side.

Mark
Is your answer to mine about Tinyptc?
If yes tinyptc is just a wrapper to the windows GDI message loop. It was designed to ease the switch to Windows for graphical demo programmers used to DOS. Tinyptc has only three functions, open, close and doevents. If you want to draw to it you just set bits in a memory buffer.

Antonio

Mark Wills

unread,
Jun 20, 2014, 5:07:20 AM6/20/14
to
Hi Antonio

No, I was referring to the VFX system :-)

Mark

Stephen Pelc

unread,
Jun 20, 2014, 5:19:43 AM6/20/14
to
On Fri, 20 Jun 2014 01:29:33 -0700 (PDT), Mark Wills
<markwi...@gmail.com> wrote:

>Where's the docs for the GTK+ interface? I have the evaluation version inst=
>alled, and I haven't seen any docs. Are the docs only available in the full=
> version? If so fair enough. A cross-platform graphics oriented system that=
> isn't Java is very attractive, to me at least. Nothing against Java in par=
>ticular, it's just that it's rather on the bloated side.

The docs are in the source code! You could always build a DocGen
control file to produce a nice PDF manual. Or you could just
wait for us to do it.
0 new messages