Going Beyond the Beeb

for all subjects/topics not covered by the other forum categories
Post Reply
julie_m
Posts: 587
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Going Beyond the Beeb

Post by julie_m »

I know, it's sacrilege. But I'm thinking of doing something a bit non-Acorn-ish, and writing some code to run on the host hardware directly! I want to port a version of BCP away from the Beeb.

The first thing I'm going to need for this is a layer which will let my program draw on the screen, and read the keyboard and mouse. And this is the bit where I'm going to have to confess to not having much of a clue; because anything I've done on modern hardware either wasn't real-time interactive, or used a web browser for the user interface. (Or both. Even before HTML canvas was a thing, I was using external programs to generate PNGs from data extracted from a database. Whereas now I can just select the data, format it as JSON and render the image on the client end .....)

I don't doubt I could do this that way, but it seems needlessly clunky. It probably would need its own Apache server just to talk to the file system.

So what I'm looking for is some sort of Open Source drawing library thing that has bindings for Perl (because that's the language in which I'm most fluent; and anyway, interpreted is good, as it means the Source Code is the executable, so nobody can hoard it away from users) and will let me plot pixels, lines, shapes and text in a window on screen, and read keystrokes and mouse movements and clicks. And ideally it should not be tied so tightly to either KDE or Gnome as to make it unusable on a lightweight desktop.

Can anyone recommend anything?
User avatar
davidb
Posts: 3395
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Going Beyond the Beeb

Post by davidb »

You probably want to use something like SDL, which I believe has Perl bindings.
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Going Beyond the Beeb

Post by tricky »

I use imgui for most of my pc apps now although still use MFC dialogs sometimes.
I don't know which platforms or languages imgui uses but it is lots of platforms although I don't know how many wrappers there are for the basic c++ it is written in.
It can do very user friendly uis, but ones that a programmer will be ok with take minimal code.
Confession: basic C++ is my favourite language flavour, just ahead of C :)
julie_m
Posts: 587
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: Going Beyond the Beeb

Post by julie_m »

It seems to have bindings for everything except Perl, and I'm not confident enough with C (let alone C++) to start a big-ish project in it -- that'd be too much learning at once to be fun. Also, it doesn't seem to have a native X backend, but needs SDL or something.

BeebEm uses SDL, so I at least know that will be capable of everything I am going to need. I've even done a tiny bit of a hack with SDL and Perl once, to get some keycodes for BeebEm on Ubuntu in a VM on my MacBook, so I know I have it installed.

If I design my classes for my objects properly in the first place
(and I spent a long time on the internal structures of the objects in BCP before I wrote so much as an LDA, just making sure there wasn't another byte to be squozen out; I actually over-did it at first, thinking I could get away with every part with the same footprint having its silkscreen legend in the same position relative to its outline, but that turned out to be a saving too far and I ended up having to add four bytes to each part for a position, rotation and indicator flag saying whether to use the default position specified in the footprint definition or this one), and cleanly separate out the drawing stuff into methods, it will be less hard to migrate to a different graphics layer in future if necessary.

I guess the next thing I have to do is write a program to make it display "Wibble" .....
Post Reply

Return to “off-topic”