Community
Message Board

Chat room - users
Game Over
( 394431 downloads)
Work In Progress
( 523201 downloads)
Links

Code Exchange
Downloads
Tutorials
Add to Favourites

Submit news

DIV ARENA FORUMS
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: Stars DLL
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 25-3-2016 at 07:49 PM
Stars DLL


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






Code:
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 4355 times

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

View user's profile View All Posts By User
NoBrain2k
DIV Junior
**


Avatar


Posts: 20
Registered: 13-3-2016
Member Is Offline


[*] posted on 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!
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 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.
View user's profile View All Posts By User
NoBrain2k
DIV Junior
**


Avatar


Posts: 20
Registered: 13-3-2016
Member Is Offline


[*] posted on 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.
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 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.



Code:
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 4160 times

View user's profile View All Posts By User
NoBrain2k
DIV Junior
**


Avatar


Posts: 20
Registered: 13-3-2016
Member Is Offline


[*] posted on 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.
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 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

View user's profile View All Posts By User

  Go To Top

Powered by XMB
XMB Forum Software © 2001-2012 The XMB Group
[Queries: 18]