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

Author Topic: Anybody using DSFML/DSFML2?  (Read 49565 times)

0 Members and 1 Guest are viewing this topic.

AndrejM

  • Newbie
  • *
  • Posts: 29
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #30 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.

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #31 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 :)

AndrejM

  • Newbie
  • *
  • Posts: 29
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #32 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.

AndrejM

  • Newbie
  • *
  • Posts: 29
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #33 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.

AndrejM

  • Newbie
  • *
  • Posts: 29
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #34 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. ^^

AndrejM

  • Newbie
  • *
  • Posts: 29
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #35 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.

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #36 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

AndrejM

  • Newbie
  • *
  • Posts: 29
    • View Profile
Anybody using DSFML/DSFML2?
« Reply #37 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

    Trass3r

    • Jr. Member
    • **
    • Posts: 91
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #38 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:

    AndrejM

    • Newbie
    • *
    • Posts: 29
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #39 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.

    Trass3r

    • Jr. Member
    • **
    • Posts: 91
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #40 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:

    AndrejM

    • Newbie
    • *
    • Posts: 29
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #41 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..

    Trass3r

    • Jr. Member
    • **
    • Posts: 91
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #42 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.

    AndrejM

    • Newbie
    • *
    • Posts: 29
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #43 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

    AndrejM

    • Newbie
    • *
    • Posts: 29
      • View Profile
    Anybody using DSFML/DSFML2?
    « Reply #44 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