SFML community forums

Bindings - other languages => D => Topic started by: Trass3r on March 04, 2010, 02:47:20 am

Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on March 04, 2010, 02:47:20 am
Is anybody using DSFML for some bigger project?
I currently only use a small part of it and thus can't thoroughly test all of it.
Could use some feedback.

Also if someone gets some of the samples to work, tell me.


Just removed the csfml-system dependency. Use standard library features for threading, mutexes, time measurement and random number generation.

Future directions are:
- D1/Tango compatibility will be completely dropped, D2 is now frozen and fast approaching
- probably removing get/set prefixes in function names to make it more D-ish.
- gotta think about a more clever and more robust internal C pointer handling
Title: Anybody using DSFML/DSFML2?
Post by: Xeon06 on March 04, 2010, 05:44:58 pm
I absolutely love the D language and I would use this binding if it wasn't for the fact that the D community isn't very big and that whole thing about Phobos/Tango is making me wary of this language. Too bad really :(. Although I think you should keep on developing this, one day when D gets more fame surely this will come in handy!
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on March 04, 2010, 06:15:27 pm
You should switch over to D2 now if you don't wanna miss the train.

D2 is frozen and will probably be released this summer when Andrei's book comes out.
The library developers will have to gradually port their stuff to D2, just as QtD and LuaD who recently dropped D1/Tango support, just as DSFML itself which will become unusable with D1 more and more.

And eventually even the douchebags behind Tango will be forced to switch, putting an end to the whole Phobos/Tango misery (if they don't go mad and use yet another incompatible runtime) :)
Title: Anybody using DSFML/DSFML2?
Post by: Xeon06 on March 05, 2010, 06:19:02 am
I think I'll wait till summer then, my engine is already quite advanced to port it all over, but I am really looking forward to the release of D2.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on March 05, 2010, 01:58:17 pm
hmm waiting might make sense if you want to buy the book and get to know D2 that way.
Nevertheless gradually porting is easier. replacing existing char[] with string, writing new code with D2 in mind etc.

What engine are you talking about?
Title: Anybody using DSFML/DSFML2?
Post by: Xeon06 on March 06, 2010, 04:53:39 am
My personal game engine. I'll finish this game in C#, then check out D2, as the advantages of D over C# (especially speed) are great.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 12:57:04 am
I can almost get some of the samples working by manually fixing the calls to several property methods which have been renamed. But in many cases I end up with this particular call in the client code:

Code: [Select]
Input i = app.getInput();

where app is a RenderWindow object. There's no getInput or any similar methods in that class (and I've tried them all just to check), so I'm not sure what to call instead. I don't see an equivalent method in the Input class either.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 23, 2010, 01:16:58 am
Yeah most of the samples are horribly outdated :(
It should be app.input

If you get them to run, please post the diffs so I can commit them :)
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 01:41:38 pm
Yeah I'm just trying out the pong sample, I've fixed (hopefully) all the problems in the code, and the imports work fine. But I can't get optlink link with the libraries. I keep getting back undefined symbol errors.. so I guess I have to manually pass the lib directory to optlink, but I'm not having much success.

What's your build command (xfbuild/dmd), pretty please?
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 23, 2010, 02:58:17 pm
Nothing fancy:
Code: [Select]
xfbuild main.d +v +xcore +xstd +obin\OpenBB-d -wi -unittest -debug -g
Since the CSFML dlls are loaded at runtime they can't be the problem.
Be sure to add +xcore and +xstd.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 07:38:27 pm
This is kind of difficult to compile.  :)

So basically, CSFML is dependent on SFML, and DFSM is a wrapper for CSFML, have I got that right?

I can now compile with xfbuild but I get a runtime error:
Loading error. Reason : Symbol cannot be found in specified library (library : csfml-audio-d.dll, symbol : sfMusic_Create)
core.exception.AssertError@dsfml\system\vector.d(371): SSE length calculation failed

Grepping through the source finds these methods:
C:\sfml2\CSFML\include\SFML\Audio\Music.h:44:CSFML_API sfMusic* sfMusic_CreateFromFile(const char* filename);
C:\sfml2\CSFML\include\SFML\Audio\Music.h:55:CSFML_API sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes);
C:\sfml2\CSFML\src\SFML\Audio\Music.cpp:36:sfMusic* sfMusic_CreateFromFile(const char* filename)
C:\sfml2\CSFML\src\SFML\Audio\Music.cpp:53:sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes)

I'll try writing a simpler example, maybe I haven't built properly or something.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 23, 2010, 08:04:46 pm
Yeah, unfortunately. There's no way to access the SFML C++ code directly.
So CSFML provides C functions to access the internal SFML code.

That sfMusic error is known and actually no real error. The dll loading code is auto-generated.
The 2nd SSE error is a unittest failure cause the SSE sqrt is only a rough approximation. I need to loosen the checked condition.

Both errors shouldn't occur in release mode (i.e. with -release -O -inline instead of -debug -g -unittest).
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 08:24:24 pm
Quote from: "Trass3r"
Yeah, unfortunately. There's no way to access the SFML C++ code directly.
So CSFML provides C functions to access the internal SFML code.

That sfMusic error is known and actually no real error. The dll loading code is auto-generated.
The 2nd SSE error is a unittest failure cause the SSE sqrt is only a rough approximation. I need to loosen the checked condition.

Both errors shouldn't occur in release mode (i.e. with -release -O -inline instead of -debug -g -unittest).

Aha! It compiles and runs now. I had to copy the bin files with some data stuff but that's okay. I'll have to fix the module though, as soon as I run the game I loose the round, and at exit I get an invalid memory reference error.

But at least we're going somewhere.. Thanks for the help, I'll see if I can fix these samples somehow.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 23, 2010, 09:32:55 pm
Yeah you gotta be fast so you don't lose immediately :D

Do you have any details regarding the exiting error?
I think in some rare cases access violations occur. I couldn't really track it down yet. Order of static destructor calls could be one issue.

The whole internal csfml handling is a big issue I haven't really solved/decided yet.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 11:00:32 pm
Quote from: "Trass3r"
Yeah you gotta be fast so you don't lose immediately :D


Hmm. Yeah it's weird I compiled it without xfbuild and it immediately makes me either loose or win. But I've recompiled again with xfbuild and I can actually play now (yay!).

Quote from: "Trass3r"

Do you have any details regarding the exiting error?
I think in some rare cases access violations occur. I couldn't really track it down yet. Order of static destructor calls could be one issue.

The whole internal csfml handling is a big issue I haven't really solved/decided yet.


Just this:
---------------------------
pong.exe - Application Error
---------------------------
The instruction at "0x6b6252ba" referenced memory at "0x01b1bb78". The memory could not be "read".

I haven't set up a debugger for D yet (not like there's much D2 debuggers out there), so I can't tell you more. Maybe I've screwed up some method call, I'll do a diff with the original and refactor again, this time properly renaming the methods, and I'll try other examples if they crash or not on exit.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 11:01:49 pm
Btw I get ~6000 FPS on average. D is damn fast, eh? :lol:
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 23, 2010, 11:11:04 pm
Quote from: "AndrejM"
Hmm. Yeah it's weird I compiled it without xfbuild and it immediately makes me either loose or win. But I've recompiled again with xfbuild and I can actually play now (yay!).

That sounds completely weird. Could you post the dmd commandline you used?

Quote from: "AndrejM"
I haven't set up a debugger for D yet (not like there's much D2 debuggers out there)

On Windows you have cv2pdb and the upcoming Mago debugger.

Quote from: "AndrejM"
Btw I get ~6000 FPS on average. D is damn fast, eh? :lol:

Which OS/HW configuration?
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 23, 2010, 11:26:47 pm
Quote from: "Trass3r"
Quote from: "AndrejM"
Hmm. Yeah it's weird I compiled it without xfbuild and it immediately makes me either loose or win. But I've recompiled again with xfbuild and I can actually play now (yay!).

That sounds completely weird. Could you post the dmd commandline you used?


I'm not sure, I forgot to take a note, sorry. But I also recompiled the .dll's using the batch file that comes with SFML, so it was probably a mistake on my part when I was moving dll's round and about.

Quote from: "Trass3r"

Which OS/HW configuration?

XP32
AMD Athlon II X4 620 @ 2.6Ghz
3GB DDR2 400Mhz
GeForce 9600 GT

The GPU and Ram is pretty old already but I'm fine with that. A modern game like Dirt 2 runs perfectly fine on 1680x1050, which is my max resolution. It does get a little laggy with a lot of antialiasing, but that's expected with an older GPU I guess.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 23, 2010, 11:49:40 pm
Ok, btw Laurent is currently switching over to CMake.
At least the OpenGL example is still up-to-date :)
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 24, 2010, 07:13:51 pm
Quote from: "Trass3r"
Ok, btw Laurent is currently switching over to CMake.


So this means DFSML will need those CMakeLists.txt files now? I've never used CMake before, right now I'm compiling like so:

Code: [Select]

xfbuild pong.d +v +xcore +xstd +o..\bin\ -release -O -inline -I..\..\..\import


I've noticed something in your debug build command you've posted earlier:
Quote from: "Trass3r"
Nothing fancy:
Code: [Select]
xfbuild main.d +v +xcore +xstd +obin\OpenBB-d -wi -unittest -debug -g


-d is a compiler switch that enables deprecated features. Did you want to compile with -d, or are you just using that extension as a naming convention for debug builds (the command above just glues -d to the name)?
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 24, 2010, 07:19:51 pm
No, CMake is just used to build sfml and the csfml dlls on top of it.
Yeah the '-d' belongs to the filename, resulting in OpenBB-d.exe
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 24, 2010, 07:23:46 pm
One more thing: Where did you find about those +xstd and +xcore flags? I don't see them listed when using xfbuild --help ?
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 24, 2010, 07:29:14 pm
Dunno, at least they are listed there: http://bitbucket.org/h3r3tic/xfbuild/wiki/Home
Although they say it's +x=pck instead of +xpck :?:
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 24, 2010, 07:36:51 pm
Quote from: "Trass3r"
Dunno, at least they are listed there: http://bitbucket.org/h3r3tic/xfbuild/wiki/Home
Although they say it's +x=pck instead of +xpck :?:

Oops, I thought those two were some options that enable multicore compilation or something, I didn't realize it's the package exclusion option.

I do compile fine without excluding those packages, at least in the pong example. Why do you exclude them?
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 24, 2010, 07:42:03 pm
I had weird errors in some projects that were solved by excluding them.
Furthermore Phobos is already precompiled so I don't know if it makes any sense at all not to exclude them.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 24, 2010, 07:46:24 pm
Quote from: "Trass3r"
I had weird errors in some projects that were solved by excluding them.
Furthermore Phobos is already precompiled so I don't know if it makes any sense at all not to exclude them.

Ah, ok.

Is the network package operational? I can't get that to compile. And I saw some weird method definitions, such as:

Code: [Select]
void add(T socket)


I guess this was supossed to be a template but was never completed?
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 24, 2010, 08:07:57 pm
No. It used to compile without errors but Laurent restructured the whole package some time ago.

Currently I'm not inclined to fix this as its future in DSFML is still undecided.

Phobos should provide a way to do network communication and probably has a more sophisticated solution anyway. On the other hand SFML's simplicity approach might be a good alternative. I can't assess that though since I haven't used any networking stuff whatsoever.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 24, 2010, 08:14:13 pm
Quote from: "Trass3r"
No. It used to compile without errors but Laurent restructured the whole package some time ago.

Currently I'm not inclined to fix this as its future in DSFML is still undecided.

Phobos should provide a way to do network communication and probably has a more sophisticated solution anyway. On the other hand SFML's simplicity approach might be a good alternative. I can't assess that though since I haven't used any networking stuff whatsoever.

Fair enough. Phobos is growing rapidly so that might be a good idea. I won't touch any examples with networking (if there are any).
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 25, 2010, 09:34:14 pm
It seems to be an issue with OpenAl:

First-chance exception at 0x6b6252ba (openal32.dll) in pong.exe: 0xC0000005: Access violation reading location 0x01b2b7f0.
Unhandled exception at 0x6b6252ba (openal32.dll) in pong.exe: 0xC0000005: Access violation reading location 0x01b2b7f0.

Removing audio-related code in Pong will stop the app from crashing at exit. I couldn't hear the sound anyway so there's definitely something broken somewhere.

The same thing happens with the soundstream.d example, which compiles and runs but doesn't output any sound and crashes at exit.

In that example code [soundstream.d], there's a MySoundStream class that inherits from the abstract class SoundStream. I had to add the following method because I couldn't instantiate the class:

Code: [Select]
void onSeek()
{
}


The module import/dsfml/audio/soundstream.d defines the abstract  SoundStream and the onSeek() method has these comments:

Code: [Select]

/**
* Called each time the stream is seeked
*/
abstract void onSeek();

/**
* Called each time the stream needs new data.
* This method will be call by an other thread, take care of possible synchronisation issues.
*
* Params:
* data = array of samples to stream
*
* Returns:
* true to continue streaming, false to stop
*/


If it returns a bool, it can't have a void return type. I had to make the implementing class define this method as a void because I can't redefine the return value of a method, since that is an error.

Here's the sample modules which I've edited so they compile:
pong.d (http://pastebin.com/Sf8CM64w)
soundstream.d (http://pastebin.com/wPj9PwDH)

I've compiled with:
Code: [Select]
xfbuild FILE.d +v +xcore +xstd +o..\bin\ -release -O -inline -I..\..\..\import

Hope that helps..
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 25, 2010, 10:41:25 pm
Quote from: "AndrejM"
Removing audio-related code in Pong will stop the app from crashing at exit. I couldn't hear the sound anyway so there's definitely something broken somewhere.

Sound perfectly works for me.

Quote
In that example code [soundstream.d], there's a MySoundStream class that inherits from the abstract class SoundStream.

Well most of the code in audio is still from old DSFML1 times because I've only used sound and music so far.
The soundstream example compiles now but doesn't play anything. Probably need to fix the whole dsfml soundstream module.

Quote
The module import/dsfml/audio/soundstream.d defines the abstract  SoundStream and the onSeek() method has these comments:

Code: [Select]

/**
* Called each time the stream is seeked
*/
abstract void onSeek();

/**
* Called each time the stream needs new data.
* This method will be call by an other thread, take care of possible synchronisation issues.
*
* Params:
* data = array of samples to stream
*
* Returns:
* true to continue streaming, false to stop
*/


If it returns a bool, it can't have a void return type. I had to make the implementing class define this method as a void because I can't redefine the return value of a method, since that is an error.

The second comment belongs to onGetData.

Quote
Here's the sample modules which I've edited so they compile:
pong.d (http://pastebin.com/Sf8CM64w)

Thanks. I've edited them to really account for the property syntax though. Check my commit.
Code: [Select]
End.characterSize = 60; and so on
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 25, 2010, 11:07:59 pm
Quote from: "Trass3r"

Sound perfectly works for me.

Wait, you're right. I must of had the volume muted. :x
But the soundstream module doesn't make a sound, just like you've confirmed.

Do the examples crash for you as well?

Quote from: "Trass3r"

The second comment belongs to onGetData.

My bad! :)

Quote from: "Trass3r"
I've edited them to really account for the property syntax though. Check my commit.

This makes the code much more readable, imo. All those parentheses are a thorn in the eye. :)

I'll see if I can get more examples to compile. I'm pretty new to SFML so I'm just blindly replacing calls with new properties.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 25, 2010, 11:16:25 pm
Quote from: "AndrejM"
Do the examples crash for you as well?

Not so far. Do they always crash?

Quote
This makes the code much more readable, imo. All those parentheses are a thorn in the eye. :)

Yep, that's why I chose this path :)
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 25, 2010, 11:38:38 pm
Quote from: "Trass3r"

Not so far. Do they always crash?

On exit, yeah.

I'm compiling SFML & CSFML with TDM-GCC, so maybe that has something to do with it. I could try compiling with VS2008 and see if it makes a difference.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 12:25:39 am
Here's view.d:http://pastebin.com/UfmRMutf

There's some weird indentation next to if statements, but I left that as it is. I've replaced (hopefully all) calls to properties with the syntax obj.property and obj.property = value.

This one doesn't crash at exit.

Edit: Btw, is Pastebin an ok place to put these files? I don't know where else to host them.. I could use dropbox if you prefer that.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 12:35:53 am
Any idea what "PostFX" has been renamed to? It appears to be some global variable somewhere in graphics/system/window but searching "post" or "fx" doesn't find it.

Speaking of which, is there a way in D to get all the names defined in a module and output it in some text file? Well I guess I would need an IDE for that.. but I prefer a text editor. ^^
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 01:04:31 am
Here's sound3d.d:
http://pastebin.com/eZT3rk8S

The sound seems to loop for a while, but after a few seconds it stops. The app crashes on exit like the other audio modules. Otherwise it seems to work ok, I can move the car left-right and hear the stereo effect.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 26, 2010, 10:11:34 am
Quote from: "AndrejM"
Any idea what "PostFX" has been renamed to?

Shader

Quote
Speaking of which, is there a way in D to get all the names defined in a module and output it in some text file? Well I guess I would need an IDE for that.. but I prefer a text editor. ^^

Yep, Descent shows a list of all members while programming.

Quote from: "AndrejM"
Here's view.d:http://pastebin.com/UfmRMutf

There's some weird indentation next to if statements, but I left that as it is. I've replaced (hopefully all) calls to properties with the syntax obj.property and obj.property = value.

Thanks :D
The frame is incorrect though. The mouse is more in the middle of it when you drag. I fixed it, was a bug due to changed Rect layout.

Quote
is Pastebin an ok place to put these files? I don't know where else to host them.. I could use dropbox if you prefer that.

Totally ok.

Quote from: "AndrejM"
Here's sound3d.d:
http://pastebin.com/eZT3rk8S

The sound seems to loop for a while, but after a few seconds it stops. The app crashes on exit like the other audio modules. Otherwise it seems to work ok, I can move the car left-right and hear the stereo effect.

Indeed it stops :x
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 06:29:03 pm
dsfml\window\event.d has a typo,
line 111 in the enum KeyCode:
Code: [Select]
Substract,
should be
Code: [Select]
Subtract,


dsfml\window\context.d has an import to a missing file at line 29:
Code: [Select]
import dsfml.window.common;

Removing it compiles the libraries (I have removed that before when I compiled the lib but I forgot to mention it).


I've done a partial fix of the PostFX sample. I have a few problems however:
1. I had to change the EFFECTS type to string[5]. This was a char[][5] type before, but I couldn't compile the lines that called Text.text(), which takes a string as it's argument, for example:

Code: [Select]
curFXStr.text("Current effect is " ~ EFFECTS[actualIndex]);

The literal is a string type (array of immutable chars), but EFFECTS would be a char[], and the compiler can't convert this to a string implicitly. An alternative is to use to!string from std.conv, but that's overkill imo.
This is one of those things that's different between D1 and D2. Are you still keeping D1 compatibility?

2. At line 110 in my fix there was this call:
Code: [Select]
app.draw(currentEffect);

I haven't found a draw method that directly takes a shader, and the one I found needs an IDrawable as a first argument. So I tried to pass it the background, which makes the code compile:
Code: [Select]
app.draw(background, currentEffect);
But I don't know if this is correct.

3. The example crashes on entry, and I seem to get almost chopped out text (e.g. "framebuffe" instead of "framebuffer") in the errors:

Code: [Select]

C:\sfml2\DSFML\samples\dsfml\bin>postfx
Failed to compile shader:
0(4) : error C0000: syntax error, unexpected '{' at token "{"
0() : error C0501: type name expected at token "{"
0(4) : warning 7022: unrecognized profile specifier "effect"
0(4) : warning C702: unrecognized profile specifier "framebuffer"
0(4) : warning C022: unrecognized profile specifier "texture"
0(6) : error C0000 syntax error, unexpected '}' at token "}"
0(6) : error C0501: tpe name expected at token "}"

Failed to compile shader:
0(2) : warning C7022: unrecognized profile specifier "framebuffe"
0(2) : warning C7022: unrecognized profile specifier "texture"0(2) : error C0502: syntax er
ror at token "texture"
0(4) : errorC0000: syntax error, unexpected identifier, expecting ',' or ';'at token "effec
t"
0(4) : error C0501: type name expected at toke "effect"
0(4) : error C1014: "effect" is not a function
(15) : atal error C9999: *** exception during compilation ***

Failed to compile shader:
0(2) : warning C7022: unrecognized profile specifier "framebuffe"
0(2) : warning C7022: unrecognized profile specifier "texture"0(2) : error C0502: syntax er
ror at token "texture"
0(4) : errorC0000: syntax error, unexpected identifier, expecting ',' or ';'at token "effec
t"
0(4) : error C0501: type name expected at toke "effect"
0(4) : error C1014: "effect" is not a function
(9) : ftal error C9999: *** exception during compilation ***

Failed to compile shader:
0(2) : warning C7022: unrecognized profile specifier "framebuffe"
0(2) : warning C7022: unrecognized profile specifier "texture"0(2) : error C0502: syntax er
ror at token "texture"
0(4) : errorC0000: syntax error, unexpected identifier, expecting ',' or ';'at token "effec
t"
0(4) : error C0501: type name expected at toke "effect"
0(4) : error C1014: "effect" is not a function
0(6) : rror C1115: unable to find compatible overloaded function "distace(error, vec2)"
(11) : fatal error C9999: *** exception during ompilation ***

Failed to compile shader:
0(3) : warning C7022: unrecognized profile specifier "wave"
0(3): warning C7022: unrecognized profile specifier "texture"
0(3) :warning C7022: unrecognized profile specifier "framebuffer"
0(3): error C0502: syntax error at token "framebuffer"
0(5) : error 0000: syntax error, unexpected identifier, expecting ',' or ';' t token "effec
t"
0(5) : error C0501: type name expected at token"effect"
0(5) : error C1014: "effect" is not a function
(11) : ftal error C9999: *** exception during compilation ***

object.Error: Access Violation

[/list]

Here's the sample module (you'll have to fix the 2 lib files as above and recompile the lib before compiling the example):

http://pastebin.com/d6fedtzY
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 26, 2010, 07:13:52 pm
Quote from: "AndrejM"
I've done a partial fix of the PostFX sample. I have a few problems however:

I haven't dealt with such things yet. Here's Laurent's explanation:
http://www.sfml-dev.org/forum/viewtopic.php?t=1791

Quote
This is one of those things that's different between D1 and D2. Are you still keeping D1 compatibility?

Nope. Also the few version(Tango) parts are just remains and probably don't even compile anymore.

Quote
At line 110 in my fix there was this call:
Code: [Select]
app.draw(currentEffect);

I haven't found a draw method that directly takes a shader, and the one I found needs an IDrawable as a first argument. So I tried to pass it the background, which makes the code compile:
Code: [Select]
app.draw(background, currentEffect);
But I don't know if this is correct.

Well all that Drawable and render() stuff is a little bit hacky :roll:
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 07:31:59 pm
Quote from: "Trass3r"

I haven't dealt with such things yet. Here's Laurent's explanation:
http://www.sfml-dev.org/forum/viewtopic.php?t=1791

Ok I'll have a look.

Quote
This is one of those things that's different between D1 and D2. Are you still keeping D1 compatibility?
Well all that Drawable and render() stuff is a little bit hacky :roll:

Hehe, ok.

The OpenGL example compiles and runs fine (it needs Derelict, and works with the latest revision). I'm having a look at the dfl.d example but I need to compile DFL first.

I don't know what to do about the socket and voip examples. I have *no* experience with networking, and Phobos is in a state of flux so it might break these examples for each new release of Phobos.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 26, 2010, 08:00:56 pm
Just leave the network samples alone for now.
Phobos usage examples don't belong in dsfml anyway :wink:
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 08:59:18 pm
If anyone else is having a hard time building the libs with that cranky xfbuild, I'm using this silly - but working - batch file which I run from the DSFML\import dir:

Code: [Select]

@echo off
setlocal EnableDelayedExpansion
@echo on

@echo off
set "files="
for %%i in (dsfml\audio\*.d) do set files=!files! %%i
@echo on
dmd -lib -ofdsfml-audio.lib -I%cd%\dsfml\audio -I%cd%\dsfml\graphics -I%cd%\dsfml\system -I%cd%\dsfml\window %files%
cd..
copy %cd%\import\dsfml-audio.lib %cd%\lib

cd import
@echo off
set "files="
for %%i in (dsfml\graphics\*.d) do set files=!files! %%i
@echo on
dmd -lib -ofdsfml-graphics.lib -I%cd%\dsfml\audio -I%cd%\dsfml\graphics -I%cd%\dsfml\system -I%cd%\dsfml\window %files%
cd..
copy %cd%\import\dsfml-graphics.lib %cd%\lib

cd import
@echo off
set "files="
for %%i in (dsfml\system\*.d) do set files=!files! %%i
@echo on
dmd -lib -ofdsfml-system.lib -I%cd%\dsfml\audio -I%cd%\dsfml\graphics -I%cd%\dsfml\system -I%cd%\dsfml\window %files%
cd..
copy %cd%\import\dsfml-system.lib %cd%\lib

cd import
@echo off
set "files="
for %%i in (dsfml\window\*.d) do set files=!files! %%i
@echo on
dmd -lib -ofdsfml-window.lib -I%cd%\dsfml\audio -I%cd%\dsfml\graphics -I%cd%\dsfml\system -I%cd%\dsfml\window %files%
cd..
copy %cd%\import\dsfml-window.lib %cd%\lib


Otherwise I can't use xfbuild for building the lib. Either it doesn't link the object files, or it enters an infinite loop. Beats me what's going wrong..
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on August 26, 2010, 09:36:50 pm
Why would you want to build it?
I thought building the samples with xfbuild worked for you?

I get an OutOfMemoryError sometimes from it, but if I compile again it mostly works.
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 26, 2010, 09:45:02 pm
Quote from: "Trass3r"
Why would you want to build it?
I thought building the samples with xfbuild worked for you?

No, they do. But there was a DSSS script in there for building a static library.

In any case, xfbuild gets so unstable for me. Sometimes I get back things like:

Code: [Select]
openwindoopwe.ndw(i2n5d)o:w .Edr(r2o5r)::  uEnrdreofri:n eudn diedfeinnteidf iiedre nb
taicfkigerro ubnadc
kgroundo
penwindoopwe.ndw(i2n6d)o:w .Edr(r2o6r)::  uEnrdreofri:n eudn diedfeinnteidf iiedre nst
tirf,i edri ds tyro,u  dmieda ny oium pmoeratn  sitmdp?o
rt std?
openwinodpoewn.wdi(n2d7o)w:. dE(r2r7o)r::  Eurnrdoerf:i nuendd eifdiennetdi fiideern t
si,f ideird  sy,o ud imde ayno ui mmpeoarnt  ismtpdo?r
t std?
openwoipnednowwi.ndd(o2w7.)d:( 2E7r)r:o rE:r ruonrd:e fuinndeedf iindeedn tiidfeinetri
 fsi,e rd isd,  ydoiud  myeoaun  miemapno ritm psotrdt?
std?
Build failed: 'dmd @xfbuild.a00e00.rsp' returned 1.
2010-08-26 21:35:07,172 Info [root] - Build failed: 'dmd @xfbuild.a27a00.rsp' returned
 1.


Because I made a mistake in naming a variable. /end rant
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on August 28, 2010, 05:36:29 pm
I've fixed the syntax errors for DFLSample, but I'm having build errors:

Code: [Select]

xfbuild DFLSample.d +v +xcore +xstd +o..\bin\ -release -O -inline -I..\..\..\import -IC:\dfl\import\

..\..\..\import\Derelict\opengl\gl.di: Error: module derelict.opengl.gl from
file ..\..\..\import\Derelict\opengl\gl.di conflicts with another module gl from
file ..\..\..\import\Derelict\opengl\gl.di

..\..\..\import\Derelict\opengl\glu.di: Error: module derelict.opengl.glu from
file ..\..\..\import\Derelict\opengl\glu.di conflicts with another module glu from
file ..\..\..\import\Derelict\opengl\glu.di


Maybe you could make it work, I'm tired of building errors. :p

Here's the new DFLSample.d
http://pastebin.com/Sic5KcLe
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on September 08, 2010, 06:30:29 pm
Quote from: "Trass3r"
Why would you want to build it?
I thought building the samples with xfbuild worked for you?

Sorry for that brainfart. I initially thought I needed an import library, but DSFML uses dynamic loading but on application startup (is that correct?).

So I don't need to create any import libraries (and really I wasn't creating an import lib, that build script only creates a static library..).

It's really interesting how you've combined the use of mixins with DLL loading. :)
Title: Anybody using DSFML/DSFML2?
Post by: AndrejM on September 08, 2010, 07:37:05 pm
The build errors for the dfl example seem to be coming from DFL unable to link to DSFML modules, I dunno why.. But expanding the build call from dfl and using it with xfbuild instead will compile the example.

I get a window with a nice 3d cube, and I can select mouse or keyboard input, but nothing seems to react to the mouse or keyboard. But at least the example doesn't crash. :)

Anyway, here's my batch file to build samples\dfl\dflsample.d:

Code: [Select]

@echo off
setlocal EnableDelayedExpansion
set "files="
set "derelict_libfiles="

REM ~ Configure these as needed:
set "dfl_import=C:\dfl\import"
set "dfl_lib=C:\DMD\dmd2\windows\lib\dfl.lib"
set "derelict_dir=..\..\..\lib\derelict"

for %%i in (*.d) do set files=!files! %%i
for %%i in (%derelict_dir%\*.lib) do set derelict_libfiles=!derelict_libfiles! %%i

@echo on

xfbuild %files% +v +xcore +xstd +o..\bin\ -release -O -inline -I..\..\..\import -I%dfl_import% -L/exet:nt/su:windows:4.0 %dfl_lib% -version=DFL_EXE %derelict_libfiles%
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on September 12, 2010, 10:24:00 pm
Quote from: "AndrejM"
Sorry for that brainfart. I initially thought I needed an import library, but DSFML uses dynamic loading but on application startup (is that correct?).

So I don't need to create any import libraries (and really I wasn't creating an import lib, that build script only creates a static library..).

It's really interesting how you've combined the use of mixins with DLL loading. :)

Yeah, dll loading is done dynamically at program startup. It's a bit of a construction site. Some time ago I thought about replacing it with static linking but in the end I do need function pointers to do the magic behind simulated class inheritance (see Drawable implementation)

Thank you for your work on the DFL example. I don't have much time at the moment but while still try to fold your changes in :)
Title: Anybody using DSFML/DSFML2?
Post by: Klaim on October 29, 2010, 09:04:19 pm
Hi

I'm starting to get interested in trying to make something in D.

I wanted to use something like SFML so it's a good thing that there is a port!

Now I just need to know if it's compatible with the last dmd? I want to get with D2.
Title: Anybody using DSFML/DSFML2?
Post by: Trass3r on October 30, 2010, 02:29:33 am
It's targeted at D2.
Title: Anybody using DSFML/DSFML2?
Post by: Klaim on November 02, 2010, 05:20:35 pm
Perfect! Thanks!
Title: Re: Anybody using DSFML/DSFML2?
Post by: vuonmatong on June 13, 2017, 06:50:48 am
Although I think you should keep on developing this, one day when D gets more fame surely this will come in handy!