FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

I've written a handful of cool code

 
Post new topic   Reply to topic     Forum Index -> Potential Projects
View previous topic :: View next topic  
Author Message
Destructionator



Joined: 17 Sep 2007
Posts: 9
Location: New York State

PostPosted: Mon Sep 17, 2007 10:32 am    Post subject: I've written a handful of cool code Reply with quote

I'm doing one thread here for a bunch of things I've written in D over the last few months. Most them are between 50 and 80 percent done, but pretty usable, although, still clunky and not well documented.


I'm not really asking for source control or webspace or anything like that; I just want to show off my code and get a little feedback on what I have so far. I also hope some of it will be useful to others as time goes on.

There are 5 main things ready to be shown off:

A simple game foundation library, with SDL and OpenGL. I've thus far written three games with it (two of which aren't done, and the third uses artwork which I'm not licensed to redistribute yet, so I can't show them at this time) that both run on Windows and Linux with just a recompile. Nothing fancy - it actually uses 2d graphics (the opengl is just to speed it up) and a simple repeating timer, but I like it that way. ~2000 lines of source total. It also transparently translates joysticks to an abstract button, based on a Playstation controller (what I use).

The dependency list for this is somewhat big - SDL, SDL_ttf, SDL_image, SDL_Mixer, OpenGL, and all their dependencies as well, of course. It also uses D SDL bindings (the only case where I didn't manually copy and paste the protos I need) which I forgot where I got them....

Naturally, you need all the development versions. For Windows, you also need a file that describes the DLLs. I ended up making mine myself.

If it ends up being needed, I can put my copies of some of the compile time dependency files up on the 'net too. Run time, just grab the libs from libsdl.org for your platform.

Due to the dependencies, compiling it can be hard. You'll need to point the compiler at the right folder to find the SDL imports, and of course, point the linker at the right thing. In the zip is my makefile. It won't work on your system (unless your home folder has the same name and layout as mine...), but should be easy to adapt.

Also in there is my Windows makefile, which puts out a Windows .exe using the Win32 dmd under Wine. Again, it will probably need some work to adapt to your system - it is just meant to be a starting point.


I've not made a website nor documentation for this, but I will offer the complete source for it and the very beginnings of a side scroller game I started last week.

I'll write real documentation and a simple, commented, sample program when I have more time to spare.

http://arsdnet.net/code/src.zip
make would make a Linux binary called play
make -f Makefile.windows would make a Windows binary called engine.exe
They won't run, since they require some font files which I'm not sure I am licensed to distribute, but you can examine the source and see about toying with that.
play.d is the main file.



----------------------------------------


A simple .ini-like file reader based on function callbacks. ~100 lines.
See its website with source and documentation:
http://arsdnet.net/code/Ini.html



---------------------------------------

A simple lisp-like language interpreter. I use it for scripting my games. ~1000 lines. Still needs some work, but it does work well enough to play with.
See its website with source and documentation:
http://arsdnet.net/m3/Lispy.html


---------------------------------


All of the above are D 1.0. The ones following I wrote last week in D 2.0, and as thus, aren't stable yet. Eventually, I want to convert the above things to D 2 as well, but will wait a bit on that.


--------------------------


A cgi module. ~300 lines of code so far. Uses typedefs and a template system (that I wrote in C a while back: ~800 lines that I didn't bother rewriting in D, but the D code does call its functions) to help protect against outputting potential XSS holes.

No documentation or website yet, but here is the source:
http://arsdnet.net/code/cgi.d

I'm writing a program that uses this and the db module (below) and will post its source when it is ready to serve as an example.


--------------------------


A database module, currently only implementing a wrapper around sqlite3. I made this to work with my cgi programs for creating low traffic dynamic websites. It also uses a typedef to help catch potential sql injections at compile time.

Again, no site or docs, but source here:
http://arsdnet.net/code/db.d

The interfaces at the top of that file are empty, but I'll fill them out as I finish the work.

It requires sqlite3 libraries somewhere where your linker can find them, but it doesn't need the headers (I copy-pasted the portions I am using).

------------

I point you at a couple of my posts on another forum where I typed up a bit on the cgi and db modules last night as I wrote them. link





All these are written in a pretty haphazard way. When I call a C function I usually just copy and paste its prototype into an extern(C) block in my D code, often changing all its pointer types to void* so it works for me.

I just toss a symlink to the source in the folder when I use a file, and add it to my makefile. None are real libraries yet.

Lots of it is also very ugly code, but in my experience, most non-trivial programs that need to work in a limited schedule tend to get ugly...
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Sep 17, 2007 2:09 pm    Post subject: Reply with quote

You might ask BCS for some access to the Scrapple project.

BA
_________________
I really like the vest!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Potential Projects All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group