Recent

Author Topic: What is your current pet project (not work related?)  (Read 760 times)

TBMan

  • Sr. Member
  • ****
  • Posts: 307
What is your current pet project (not work related?)
« on: November 13, 2025, 06:32:23 am »
With a ton of help from ChatgPT** I'm doing a PTCgraph/Borland Graph/PTCCRT/PTCMouse unit clones and at the same time I'm recreating my GUI to use the new units. As I'm adding my GUI objects I'm tweaking the look of them to be more in the line of Windows 11.  I'm learning the value of overloading procedures.

Right now I'm in the process of creating my win_fonts unit which is just a bunch of UNICODESTRING constants.

** I'm telling ChatgPT what I want to do and it does it. Then I test it and see if it works in the scheme of things. As I'm going along I'm learning what needs to be done using the Windows API which was always a black box to me.
There was a few irritating things that happen along the way like ChatgPT declaring a dc like this:
Code: Pascal  [Select][+][-]
  1. var
  2.  hDC : HDC;
  3.  

And I'm saying to it, No, this isn't C. Also, after I got my GUI skeleton app up and running I found the graphics weren't being scaled and the mouse state wasn't in sync if the window was stretched or maximized, so that had to be fixed. 

It's almost like taking a class in Windows coding. :)

Here's a quick demo of a few of the fonts I'm building in and a look at the start of the GUI.
 
https://www.youtube.com/watch?v=DuBGdm5RY6o


I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

Thausand

  • Sr. Member
  • ****
  • Posts: 445
Re: What is your current pet project (not work related?)
« Reply #1 on: November 13, 2025, 06:54:55 am »
For clearify:
HDC is Device Context Handle write ms (https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types)

HDC is opaque type. FPC have too (rtl/win/wininc/base.inc)
Code: Pascal  [Select][+][-]
  1. type
  2.   HANDLE = System.THandle;
  3.   ...
  4.   HDC = HANDLE;
  5.  

System.THandle is know (https://www.freepascal.org/docs-html/rtl/system/thandle.html)
Quote
This type should be considered opaque. It is used to describe file and other handles.

That is mean: is something (we not know) that some function need or have use. Many OS have use (opaque) handle for pass for function (or get from).

That mean is no relate for windows, only is relate for c when OS is write in c. If OS write in rust then handle is rust, if OS is write in pascal then handle is Pascal  :)

When port library then many time have function and use opaque type and is mean no 'touch' is same when say have no have peek inside this private.

440bx

  • Hero Member
  • *****
  • Posts: 5896
Re: What is your current pet project (not work related?)
« Reply #2 on: November 13, 2025, 07:08:11 am »
It's almost like taking a class in Windows coding. :)
Just in case you might be interested.  I posted a number of _pure_ Windows API programming examples quite a while back.  An index of the examples is found at:

https://forum.lazarus.freepascal.org/index.php/topic,52984.0.html

The index is incomplete (I keep forgetting to update it).  There are a total of 8 threads with various examples but the index only goes up to 5.  A search for "WinAPI examples" brings a complete list.

Anyway... just in case you want to see what it's like to program directly and completely to the Windows API. If I may say so myself, there are a couple of really interesting examples that showcase some characteristics of programming to the API that are very seldom exposed.

HTH.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18524
  • Here stood a man who saw the Elbe and jumped it.
Re: What is your current pet project (not work related?)
« Reply #3 on: November 13, 2025, 07:28:17 am »
@TBMan

Yes, those 440bx examples are good introductions.
I also have posted quite a few examples from the golden years, mainly translations to Pascal of
https://www.charlespetzold.com/books/ or similar from msdn example code (many of which are Petzold's anyway)
Charley has made many of his books available for free, through his own website. And the sourcecode too...
Which was /still is one of the greats regarding Windows programming. It is all C, though, but very readable C and void of much macro wizzardry. IOW, proper C. Which translates to Pascal without much effort, many can be done on the fly.

But I thought you would stick to ptc? Which is far more interesting ;) since it gives you a greater degree of freedom in some ways.

@440bx
That is also the answer to your 8 months old outstanding question to me: I can confirm I have his permission.
Copyright and source required of course. I simply forgot about it.
There is a slight nuance: some of the code is copyright Microsoft, but that was free to translate anyway.

Btw: my pet project is writing a book about the current main/trunk new features. Many examples I already gave on this forum or the wiki, but in an unstructured way. It is by no means in publishable order.
« Last Edit: November 13, 2025, 08:00:13 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

440bx

  • Hero Member
  • *****
  • Posts: 5896
Re: What is your current pet project (not work related?)
« Reply #4 on: November 13, 2025, 08:12:46 am »
There is a slight nuance: some of the code is copyright Microsoft, but that was free to translate anyway.
That's always the concern.  When a book is published, normally, it is the publisher that owns the copyright. 

There have been cases when the publisher eventually relinquished the copyright back to the author because they were no longer interested in the book (happens with old books) but, anyone wanting to use the material is well advised to stand on solid legal ground and figure out who is the current copyright holder and what is allowed and disallowed by that entity or individual.

Thank you for the update.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18524
  • Here stood a man who saw the Elbe and jumped it.
Re: What is your current pet project (not work related?)
« Reply #5 on: November 13, 2025, 09:00:19 am »
That's always the concern.  When a book is published, normally, it is the publisher that owns the copyright. 
No, that is wrong: the author retains copyright, unless published in a employee/employer relationship. Otherwise known as "written by commission".
The publisher has only copyrights to a particular distribution, not the content itself. Will send the personal response in private, unless response can be made public.
« Last Edit: November 13, 2025, 09:08:43 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

TBMan

  • Sr. Member
  • ****
  • Posts: 307
Re: What is your current pet project (not work related?)
« Reply #6 on: November 13, 2025, 03:28:43 pm »
It's almost like taking a class in Windows coding. :)
Just in case you might be interested.  I posted a number of _pure_ Windows API programming examples quite a while back.  An index of the examples is found at:

https://forum.lazarus.freepascal.org/index.php/topic,52984.0.html

The index is incomplete (I keep forgetting to update it).  There are a total of 8 threads with various examples but the index only goes up to 5.  A search for "WinAPI examples" brings a complete list.

Anyway... just in case you want to see what it's like to program directly and completely to the Windows API. If I may say so myself, there are a couple of really interesting examples that showcase some characteristics of programming to the API that are very seldom exposed.

HTH.

Thanks, that will help.
I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

440bx

  • Hero Member
  • *****
  • Posts: 5896
Re: What is your current pet project (not work related?)
« Reply #7 on: November 13, 2025, 04:31:34 pm »
Thanks, that will help.
You're welcome. 

If you have any questions about any of the examples, don't hesitate to ask. 
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

TBMan

  • Sr. Member
  • ****
  • Posts: 307
Re: What is your current pet project (not work related?)
« Reply #8 on: November 13, 2025, 05:07:28 pm »
@TBMan

Yes, those 440bx examples are good introductions.
I also have posted quite a few examples from the golden years, mainly translations to Pascal of
https://www.charlespetzold.com/books/ or similar from msdn example code (many of which are Petzold's anyway)
Charley has made many of his books available for free, through his own website. And the sourcecode too...
Which was /still is one of the greats regarding Windows programming. It is all C, though, but very readable C and void of much macro wizzardry. IOW, proper C. Which translates to Pascal without much effort, many can be done on the fly.

But I thought you would stick to ptc? Which is far more interesting ;) since it gives you a greater degree of freedom in some ways.


Btw: my pet project is writing a book about the current main/trunk new features. Many examples I already gave on this forum or the wiki, but in an unstructured way. It is by no means in publishable order.

PTC isn't going to go away for me, as I will still use it. In between ideas for doing a new game I thought I would dive into learning more about the Windows API and doing my win_graph project is like going to school. I'll be doing a new sprite format and doing a different approach to displaying them. The new sprite format falls into doing a new sprite editor and that falls into developing a color wheel, among other things, which should be fun.
I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

Weiss

  • Full Member
  • ***
  • Posts: 224
Re: What is your current pet project (not work related?)
« Reply #9 on: November 20, 2025, 12:20:09 pm »
"not work related" has different meaning in my case. My work is not programming. I created quite a few "work related" applications (related to my work as marine engineer) in my free time at work. They are all pet projects then. The whole "programming" thing in my case is a pet project. Would be ok but wife looks at me kind of funny lately.

One of them projects grew into a massive undertaking, which I sometimes regret going to. I am writing interpreting language for on-the-fly ideas. Kind of like Matlab or sciLab. It is REPL, extending the hosting application. At first, I was reading and writing Herbert Sauro's Rodus, but then weered off into some wild woods of programming. Kind of balancing now between continuing on, as there is a light at the end, or abandoning this Quasimodo of programming language.

Not sure if this would be a "pet", or gremlin.

 

TinyPortal © 2005-2018