Recent

Author Topic: My first "tool" written with Lazarus  (Read 2248 times)

TBMan

  • New Member
  • *
  • Posts: 39
My first "tool" written with Lazarus
« on: January 21, 2025, 04:44:58 pm »
Years ago (early 1990's) I had written a GUI for myself just for the heck of it. I'm not using OOP this time around as I have to relearn it. I had made myself a sprite editor back then (pictured below) and I decided to do one for myself using Lazarus. The new version is the one pictured with the black background. I just sledgehammered my checkboxes and buttons as different arrays of records. This time around I have an Export feature that writes the sprite as a const to a text file. I'm not doing anything great with sprites, just putpixel one at a time. With today's computers being so fast for what I do it's fine. I just have to name the const when I insert it in my code.

Instead of defining the sprites as a [0..#,0..#] array I use an array that is 0 to 4095 of byte and also the width and depth is part of the sprite. Those are used to index the array as though it was a matrix.

Here's an example of the const text file:

Code: Pascal  [Select][+][-]
  1. CONST
  2. : array [0..11,0..11] of byte = ((0,0,0,0,0,0,0,0,0,0,0,0),
  3. (0,0,0,0,0,0,0,0,0,0,0,0),
  4. (0,0,0,0,0,0,0,0,0,0,0,0),
  5. (0,0,0,0,0,0,0,0,0,0,0,0),
  6. (0,0,0,0,0,0,0,0,0,0,0,0),
  7. (0,0,0,0,0,0,0,0,0,0,0,0),
  8. (0,0,0,0,0,0,0,0,0,0,0,0),
  9. (0,0,0,0,0,0,0,0,0,0,0,0),
  10. (0,0,0,0,0,0,0,0,0,0,0,0),
  11. (0,0,0,0,0,0,0,0,0,0,0,0),
  12. (0,0,0,0,0,0,0,0,0,0,0,0),
  13. (0,0,0,0,0,0,0,0,0,0,0,0));
  14.  
  15.  
  16.  
« Last Edit: January 21, 2025, 04:51:06 pm by TBMan »

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 584
Re: My first "tool" written with Lazarus
« Reply #1 on: January 21, 2025, 05:06:02 pm »
Looks nice, and sounds like a good project to start exploring Lazarus with!

TBMan

  • New Member
  • *
  • Posts: 39
Re: My first "tool" written with Lazarus
« Reply #2 on: January 21, 2025, 05:28:10 pm »
Looks nice, and sounds like a good project to start exploring Lazarus with!

Thanks Curt. Now I am going to have to dig in a bit and see how to do linked lists for open and save file dialog boxes.

Handoko

  • Hero Member
  • *****
  • Posts: 5386
  • My goal: build my own game engine using Lazarus
Re: My first "tool" written with Lazarus
« Reply #3 on: January 22, 2025, 03:11:17 am »
Interesting, please keep us updated.
Lazarus has many ready-to-use graphics and GUI components. I can't image how difficult it was for writing a sprite editor in the past from scratch.

TRon

  • Hero Member
  • *****
  • Posts: 3925
Re: My first "tool" written with Lazarus
« Reply #4 on: January 22, 2025, 03:15:48 am »
Those pictures for sure bring back the d-paint vibes. Thank you for sharing.
I do not have to remember anything anymore thanks to total-recall.

Boleeman

  • Hero Member
  • *****
  • Posts: 769
Re: My first "tool" written with Lazarus
« Reply #5 on: January 22, 2025, 07:19:32 am »
Here is a basic Pixel Editor as a starter project, if you want to play around with it.
Instead of using a constant array, use dynamic arrays so that you can vary the size of the grid.

« Last Edit: January 22, 2025, 07:21:39 am by Boleeman »

Wesbat

  • New Member
  • *
  • Posts: 37
    • engrams.dev
Re: My first "tool" written with Lazarus
« Reply #6 on: January 22, 2025, 08:36:29 am »
Very nice thanks for sharing. Those palette colours sure takes me back!

TBMan

  • New Member
  • *
  • Posts: 39
Re: My first "tool" written with Lazarus
« Reply #7 on: January 22, 2025, 03:11:42 pm »
Here is a basic Pixel Editor as a starter project, if you want to play around with it.
Instead of using a constant array, use dynamic arrays so that you can vary the size of the grid.

Never knew about dynamic arrays. Wow, let me try that, thanks!

Boleeman

  • Hero Member
  • *****
  • Posts: 769
Re: My first "tool" written with Lazarus
« Reply #8 on: February 01, 2025, 09:48:18 am »
Accidentally came across a free cool looking pixel editor called PixiEditor written in CSharp.

A Pixel art editing software which can have layers and alter the opacity.
Create beautiful sprites for your games, animations (coming soon!) and edit images.


https://github.com/Wappen/PixiEditor

Download the compiled install versions here:

https://github.com/PixiEditor/PixiEditor/releases

https://github.com/PixiEditor/PixiEditor/releases/download/1.2.5.0/PixiEditor.1.2.5.0.x64.zip
https://github.com/PixiEditor/PixiEditor/releases/download/1.2.5.0/PixiEditor.1.2.5.0.x86.zip

« Last Edit: February 01, 2025, 09:50:29 am by Boleeman »

Soner

  • Sr. Member
  • ****
  • Posts: 318
Re: My first "tool" written with Lazarus
« Reply #9 on: February 01, 2025, 12:00:18 pm »
Those pictures for sure bring back the d-paint vibes. Thank you for sharing.
d for Deluxe? I had version V for Amiga.

TBMan

  • New Member
  • *
  • Posts: 39
Re: My first "tool" written with Lazarus
« Reply #10 on: February 01, 2025, 09:00:56 pm »
I've extended the sprite sizes and added line, rectangle, filled rectangles and circle tools. I might rewrite it using the app framework I started this week.

silvercoder70

  • Full Member
  • ***
  • Posts: 136
    • Tim Coates
Re: My first "tool" written with Lazarus
« Reply #11 on: February 01, 2025, 10:04:01 pm »
just wanted to compliment you on the program so far ... looks good.

(though it does bring back horrible memories)
Explore the beauty of modern Pascal programming with Delphi & Free Pascal - https://www.youtube.com/@silvercoder70

TRon

  • Hero Member
  • *****
  • Posts: 3925
Re: My first "tool" written with Lazarus
« Reply #12 on: February 01, 2025, 11:23:46 pm »
d for Deluxe? I had version V for Amiga.
Yeah, Deluxe Paint. That was back in the day when EA actually made some useful contributions to the world  :)

Animated brushes for instance, remember that ?

It was a must have for developing game/demo graphics.

(though it does bring back horrible memories)
Oh ? If you are able to then please do share because I for one am intrigued. How could a pixel editor provide someone with bad memories ?  :)

PS: Thank you Silvercoder for your video's.
I do not have to remember anything anymore thanks to total-recall.

TBMan

  • New Member
  • *
  • Posts: 39
Re: My first "tool" written with Lazarus
« Reply #13 on: February 02, 2025, 02:19:04 am »
just wanted to compliment you on the program so far ... looks good.

(though it does bring back horrible memories)

Thanks!  I'm going to check out your videos soon too.

silvercoder70

  • Full Member
  • ***
  • Posts: 136
    • Tim Coates
Re: My first "tool" written with Lazarus
« Reply #14 on: February 02, 2025, 11:58:45 am »
Not the pixel editor itself, but rather to a different time when you only had a resource editor, and then when Delphi came out and having to create own icons for your applications and compared to now, lower specs, less colors... and the start of DLL hell. Shall I go on...
Explore the beauty of modern Pascal programming with Delphi & Free Pascal - https://www.youtube.com/@silvercoder70

 

TinyPortal © 2005-2018