Stars DLL

MikeDX - 25-3-2016 at 07:49 PM

This DLL creates a starfield in the background, easy to use:

PROGRAM stars; IMPORT "stars.so"; PRIVATE mapa1; BEGIN mapa1=load_map("..\stars\prueba.map"); graph=mapa1; loop x=320; y=240: set_mode(m640x480); frame; // parametros // velocidad,direccion,numerodepuntos,modo,color put_stars(16,8,800,1,255); WHILE(scan_code!=32) FRAME; END quit_stars(); frame; WHILE (scan_code==32) FRAME; END // parametros // velocidad,direccion,numerodepuntos,modo,color put_stars(4,0,800,1,255); frame; WHILE (scan_code==32) FRAME; END quit_stars(); set_mode(m320x200); frame; x=160; y=100: graph=mapa1; WHILE (scan_code==32) FRAME; END // parametros // velocidad,direccion,numerodepuntos,modo,color put_stars(1,3,400,1,15); WHILE (scan_code!=32) FRAME; END quit_stars(); frame; WHILE (scan_code==32) FRAME; END end END

Attachment: stars.c (6kB)
This file has been downloaded 4183 times

Attachment: PRUEBA.MAP (64kB)
This file has been downloaded 4410 times

NoBrain2k - 26-3-2016 at 06:32 PM

Thanks for posting this Mike, very interesting. I've got an idea for an extension I'd like to try to write but we'll see if I ever get around to it, I've got some documentation to finish first!

MikeDX - 26-3-2016 at 06:53 PM

DIV extensions are incredibly easy to write, but having the idea in the first place is the hard part.
At some point I'll write up some docs on how to compile for each platform and what pitfalls to avoid.

NoBrain2k - 27-3-2016 at 11:45 AM

I thought I'd give it ago, apparently I need div.h :)

Is that available anywhere or shall I patiently wait until you get a chance to write up some instructions? I'm honestly in no rush, I was just having a play.

MikeDX - 27-3-2016 at 02:24 PM

I thought div.h was in one of the packages. But since i can't find it, have this one.

gcc dll.c -o dll.so -fPIC -funsigned-char -shared

If you are building for windows, you need to use -o file.dll

Attachment: div.h (18kB)
This file has been downloaded 3982 times

NoBrain2k - 28-3-2016 at 12:00 AM

Well, it compiles (with 5 warnings, but I assume that they're normal)

I then placed stars.prg, stars.so and prueba.map all in the same dir and updated the load_map call to just "prueba.map". I try to execute, compile or debug it and I get "Use of an invalid external DLL". I've tried chmodding the stars.so file 777 just to be sure it's not a permissions thing but to no avail.

This is with beta 12 on Mac.

MikeDX - 28-3-2016 at 04:24 AM

You should use the full path to your stars.so in your prg, or copy stars.so into the app bundle in the same dir as d-OSX