Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OO Wrapper  (Read 7458 times)

0 Members and 1 Guest are viewing this topic.

krzat

  • Full Member
  • ***
  • Posts: 107
    • View Profile
OO Wrapper
« on: October 12, 2012, 10:09:05 am »
Github site: https://github.com/krzat/SFML-D
Ready to use package(windows): https://github.com/downloads/krzat/SFML-D/working_sample.7z

I have tested it on Windows(DMD and GDC), but it may also work on other platforms. To see how it works, check  the test.d file. I have also attached .bat scripts for easy compilation (GDC or DMD required).

Most of this code is autogenerated, so expect some bugs.

EDIT: new version, added network and removed auto functions
EDIT2: uploaded to git, and separated modules
« Last Edit: October 13, 2012, 08:04:47 pm by krzat »
SFML.Utils - useful extensions for SFML.Net

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: OO Wrapper
« Reply #1 on: October 13, 2012, 06:38:08 am »
Nice work! This is really cool!

I too am working on a wrapper, but looks like you beat me!
This is really cool though, and I am glad to look at different ways of doing bindings! It even gave me a few ideas for my own project.


By the way, what did you use to auto generate all this code? That's pretty spiffy.
DSFML - SFML for the D Programming Language.

krzat

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: OO Wrapper
« Reply #2 on: October 13, 2012, 10:59:55 am »
I have:
1. used gcc to generate processed C header
2. cleaned that file, so htod could work
3. used htod to convert C header to D file
4. used my own program to:
 a. fix compiler errors of D file(htod is a bit outdated)
 b. remove comments and empty lines
 c. remove sf prefix from struct names
 d. collect every opaque struct
 e. collect every function with name like someOpaqueStruct_someFunc(T* ptr, ...);
 f. in another file: generate class and methods in it for every collected struct
5. added some manual fixes

I have updated the wrapper: added network classes, and proper return types for functions (becouse auto breaks Mono-D autocompletion).
SFML.Utils - useful extensions for SFML.Net

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: OO Wrapper
« Reply #3 on: October 14, 2012, 07:25:54 am »
That's pretty funny that you named it SFML-D. I was was planning on using the same name! And I was also just about to put it on github.

Stealin' my thunder  :P
DSFML - SFML for the D Programming Language.

krzat

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: OO Wrapper
« Reply #4 on: October 14, 2012, 12:00:21 pm »
Oh, sorry for that. I can change the name if you want.

Btw. how much of the wrapper have you finished?
SFML.Utils - useful extensions for SFML.Net

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: OO Wrapper
« Reply #5 on: October 14, 2012, 09:29:30 pm »
Oh, it's cool man. It's just a name.  ;D 

I have all of the system and window modules done except for a couple of things. I'm not going for just a wrapper though. I'm pretty much porting the API into D. Currently I'm working on getting some of the inheritance stuff working for the graphics module(drawable for instance) , but I'm also going to play around with the audio module soon too.

I'm doing everything by hand though. It's a project for better learning some of the semantics of the D language. I'm sure that as I learn more I might go back and rewrite some things(like my own bindings. currently I'm using derelict as a back end), but so far it all works pretty well. It definitely makes me happy how nice of an API SFML is, and I like how well it is documented.

DSFML - SFML for the D Programming Language.

tmc

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: OO Wrapper
« Reply #6 on: January 23, 2013, 03:07:19 pm »
Hi, thanks for creating these. Nice and simple.

I've updated your wrapper to work with the latest git version of CSFML and D release. Well, actually I've only verified that the sample program compiles and works. If there are any new functions in CSFML I haven't added them. Anyone using the old [C]SFML builds on the website will probably want krzat's version instead.

https://github.com/rversteegen/SFML-D

anarky

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: OO Wrapper
« Reply #7 on: March 09, 2013, 07:52:22 pm »
Hi guys,
the Yage3D project is interested in this binding  ;) JoeCoder is now going D2 and if you look at the new branch you can see some OO wrapping around the "window" module already... Which may not be necessary if a good OO Wrapper like yours is available! So I beg you to keep up the good work.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: OO Wrapper
« Reply #8 on: March 10, 2013, 06:14:46 pm »
Just a heads up, I am almost done with my version of a "wrapper" for CSFML in D. It's very similar to this, but my ultimate goal was to have it become the official DSFML so there are a few extras on top of it just wrapping things in a OO way. Class has been taking up a lot of my time but I should have the first version finished in no longer than 2 weeks. (the end of this week is my last week of classes so I planned on finishing up the last of it asap)

I wanted to get it finished before I really said anything, but with Laurent's binding post I thought I should speak up!

And also, I have a few ideas for improving how it works that I will implement after I finish getting it "working".

Happy programming guys!
DSFML - SFML for the D Programming Language.

 

anything