Discusion: Blocky library lazarus / 39-Graphics ---------------------------------------------------------------------- BlueIcaro · 2022-04-27 07:55 Hello, If you have to develop a librarr likeb Blocky https://en.wikipedia.org/wiki/Blockly, using Lazarus, which graphic library would you use?. Mayt be BGRABitmap), other?, advantages and disadvantages of using one or the other. Thanks /BlueIcaro ---------------------------------------------------------------------- MarkMLl · 2022-04-27 08:19 Interesting question. Do you want fully-animated drag-and-drop etc.? I've taken a sniff around in the past for a Smalltalk implementation based on Pascal with limited success. If such a thing existed it should be possible to port Scratch, since the RPi variant of that is still Smalltalk-based (and has an Easter Egg that allows you to inspect the underlying implementation). Somewhat later: there's one Pascal implementation mentioned at http:// www.ksl.stanford.edu/testfiles/piernot/smtkinfo/smtkpubimplem.html and apparently the original Tektronix system was based on Pascal http://wirfs-brock.com/allen/things/smalltalk-things/tektronix- smalltalk-document-archive I don't know whether either of those would be of any use in practice. MarkMLl ---------------------------------------------------------------------- BlueIcaro · 2022-04-27 09:13 Quote from: MarkMLl on April 27, 2022, 10:19:29 am Interesting question. Do you want fully-animated drag-and-drop etc.? I't will nice have drag and drop feature. But for the moment I'm thinking how to paint the blocks, keep joined together, etc. I didn't know smalltak, I'll take a look and investigate about scrath. /BlueIcaro ---------------------------------------------------------------------- MarkMLl · 2022-04-27 09:42 Quote from: BlueIcaro on April 27, 2022, 11:13:30 amI didn't know smalltak, I'll take a look and investigate about scrath. The original implementation of Scratch used Smalltalk, and that's still the one being shipped by Rpi and Debian. Later implementations mover to Javascript etc. A major omission was that there was no way of integrating plugins to handle e.g. custom hardware. I believe that later versions have attempted to fix that by adding the facility to talk to a server process written using a "real language". Smalltalk is, of course, the grandpa of OO languages, descended from Simula hence ALGOL. I'm by no means convinced that implementing a Smalltalk interpreter (frequently referred to as a VM, although that term's been monopolised recently by hardware virtualisation etc.) is the way to go, but I think that it's at least worth checking (even if ruled out) early in the project. MarkMLl ---------------------------------------------------------------------- Handoko · 2022-04-27 11:54 Quote from: BlueIcaro on April 27, 2022, 09:55:48 am... using Lazarus, which graphic library would you use?. Mayt be BGRABitmap), other? ... BGRABitmap is slow. For satisfying my curiosity about how good or worse TCanvas was, I wrote a vertical shooting spaceship game using only TCanvas' line drawing functions, no bimap texture. It worked okay on my 15 years old dual core WinXP laptop. But if I added more visual effects, no matter how hard I optimized it, it started to show performance issue. I heard we can easily switch from TCanvas to use BGRABitmap, so I did it. What I found was, it was as slow as TCanvas, on some cases it was 3% slower if I remember correctly. Newer versions of BGRABitmap have some 3D features that use OpenGL, which means they're hardware accelerated. But most of BGRABitmap functions are not hardware accelerated. If you only want to show some simple graphics, BGRABitmap should be okay. But if you want your library to look good like most of the modern software do, you should consider the others: https://wiki.freepascal.org/Graphics_libraries https://wiki.freepascal.org/Developing_with_Graphics#See_also I recommend OpenGL. Learning OpenGL is hard, but if you use only the fixed function pipeline (compatibility profile), OpenGL isn't that hard. I am working to write my graphics library that uses OpenGL via TOpenGLContext, which is bundled in the default Lazarus installation. I want users to able to get the performance of OpenGL but as easy to use as BASIC's commands. The progress is slow because I'm still learning OpenGL. Now, I managed to do multi-layer texturing and importing shapes from obj files. You should also consider Graphics32 and ZenGL. Read more: https://forum.lazarus.freepascal.org/index.php/topic,59144.msg440998.h tml#msg440998