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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - malkierian

Pages: [1]
1
Window / Moving Borderless Windows
« on: February 13, 2014, 12:51:53 am »
Alright, so I know that you can make a window that is completely borderless, meaning no title bar, no Exit/Max/Min buttons, no resizing frame, but there are plenty of examples out there of borderless windows that you can still move around.  How would I go about doing this in SFML?

2
Audio / SFML In Windows Won't Play Sound
« on: January 29, 2014, 07:12:40 am »
OK, here's the stats:

Windows 7
Visual Studio 2012
SFML 2.1 custom build (through VS)

So I'm trying to make a setup to test my playback device selection modification to SFML, but I can't get a sound to play in the first place.  I have the libs, includes, dlls and path setup properly (it's finding everything).  I copied the code over from the VS setup tutorial, and the window shows up, the green circle is drawn.

I have load a sound into a buffer and set it to a Sound, and also set it to change the circle's color on mouse click (which is where I have the Sound.play() call), but though it seems to load the sound file just fine (no errors, no returning -1 before the window opens), it just doesn't play at all.  Here's my code:

http://pastebin.com/naP4ub28

The only place I can think of that it would be disconnecting is the buffer set on Sound.  But I have no way of diagnosing or debugging that.  I am using a custom build of SFML, of course.  Any idea what's wrong?

3
Audio / Creating Device Selection for Playback
« on: January 06, 2014, 04:08:05 am »
OK, so it's gotten to the point where, either SFML will need to be adapted, or I will need to use libsndfile and openAL directly myself and bypass SFML altogether for audio playback.  However, I was looking at the changes that were done to make SoundRecorder's device selectable, and I think I could do it myself, but I wanted to discuss with the dev(s) on here how exactly they would prefer to have it done.  I have thought of two ways thus far:

Expose a setDevice() function somewhere (like in SoundRecorder), but have it change the global AudioDevice variable, or
Have Sound.cpp have its own device and context values that default to those provided by the AudioDevice (much more complex).

It would make more sense to have an overall selection, I think, rather than each sound being able to have its own, but how do I expose a setDevice() function to modify AudioDevice, and where?  I assume, since AudioDevice and ALcheck are in the priv namespace, they aren't visible outside of the SFML code itself, but if a setDevice() function were to be placed in Sound that then called an AudioDevice.setDevice() function to change the global variable, then nothing in AudioDevice itself would need to be exposed to public usage.  I definitely think the current functionality still needs to be the default, because a lot of people would have no use for the new stuff, and would be thrown off if it wasn't included.  But there are those of us who want to stay in the family, as it were, and still have functionality such as this.  It would certainly make things easier for me in my soundboard program.

Laurent, what do you think?

4
D / String, Dstring, and Char[] oh my...
« on: December 20, 2013, 03:50:23 am »
OK, so I'm trying to use SFML's Audio module to play a sound, and I'm using the Windows headers to open the file (default Windows file dialog).  SoundBuffer.loadFromFile takes a "string" argument.  The Windows file dialog process takes a char[] array, and I am trying to use the return I get from the file select window to also form the default "tag", or in-program identifier, as a label as part of a sound actor class (custom class that handles play, stop and open buttons for a group, as well as the label), which also means I need to use a substring of the file name returned from the file select.  So essentially I need to go from char[] to string, and char[] to sub-dstring.  But I keep getting this error after picking the file and trying to load it:

std.utf.UTFException@E:\Dlang\dmd2\windows\bin\..\..\src\phobos\std\utf.d(1113): Invalid UTF-8 sequence (at index 1)

I am running the file selector in a separate function.  I have tried passing a pointer argument to the function to return through, and I've tried returning it directly, both fail.  How do I properly return a string/dstring argument from a function, and how do I properly/effectively convert between those three formats?

5
D / Font Issues
« on: December 06, 2013, 07:58:11 am »
So I'm trying to get a Text going in a class of mine, and in order to do that, I need a Font.  However, when I try this, and use font.loadfromFile(), I get 6 errors related to it:
Code: [Select]
unexpected ( in declarator
basic type expected, not "fonts/OratorStd.ttf"
found '"fonts/OratorStd.ttf"' when expecting ')'
no identifier for declarator font.loadFromFile(int)
semicolon expected following function declaration
declaration expected, not ')'
And when I hover over the line, I see "Parser Error: <Identifier> expected, <Literal> found!".  The issue I can see is that, for some reason, Font isn't showing as having any of the methods necessary to utilizing the class.  Whenever I type a period after my font object, NOTHING shows up.

Here's my code:
module sound;

import dsfml.graphics;
import scene2d.actor;

class Sound: Actor
{
        Sprite playSprite;
        Sprite stopSprite;
        Sprite folderSprite;

        auto font = new Font();
        font.loadFromFile("fonts/OratorStd.ttf");
        Text label = new Text("Uninitialized", font);
        this(Texture *play, Texture *stop, Texture *folder, int index)
        {
                int x, y;
                x = (index % 10) * 96 + (index % 10) * 16;
                y = (index % 9) * 16 + (index % 10) * 64;

                playSprite = new Sprite(play);
                playSprite.position(Vector2f(x, y + 32));
                stopSprite = new Sprite(play);
                stopSprite.position(Vector2f(x + 32, y + 32));
                folderSprite = new Sprite(play);
                folderSprite.position(Vector2f(x + 64, y + 32));
        }

        ~this()
        {
                ~playSprite();
                ~stopSprite();
                ~folderSprite();
        }

        override draw(Drawable surface)
        {
                surface.draw(label);
                surface.draw(playSprite);
                surface.draw(stopSprite);
                surface.draw(folderSprite);
        }
}

EDIT: Well, that was weird.  I moved the font loading into my main class and passed it as a parameter to the SoundActor constructor (the new name for the class), and everything seems to be working fine, though I still don't get the lookup window when calling a member...

6
Audio / Multiple Simultaneous Audio Output
« on: December 06, 2013, 02:39:33 am »
Is it possible, in 2.0, to output a single audio stream to two devices simultaneously?  I'm trying to make a virtual soundboard, but I need to be able to hook into at least two devices (a virtual cable that also has my microphone writing to it, and then to my headset speakers) to make it even worthwhile.  Even if it's not possible in SFML, is it possible, period?

7
D / Window Style Values
« on: December 05, 2013, 05:19:26 am »
Where are they located?  Using Style.DefaultStyle, like in renderwindow.d, tells me Style is an unknown identifier.

8
D / dsfml\system.d cannot be read?
« on: December 04, 2013, 05:43:31 am »
So I get Xamarin up and running with Mono-d, wonderful code lookup and such, get a very basic window coded out (took me a while to realize I didn't need to use the :: anymore and instead needed to use package names directly, and . for struct members), but when I go to compile, I get "Error: module system is in file 'dsfml\system.d' which cannot be read".  I have tried both having the imports set to the folder where the lib files are for DSFML, and having it set to the source files in the git repo I downloaded (not at the same time).  The lib files are listed in the linker.  Looking at the tooltips, it looks like I'm supposed to have it pointed to the lib folder.  But I don't understand why it's giving me this error.  Any ideas?

9
D / Problems Compiling DSFML-C
« on: November 18, 2013, 05:46:26 am »
OK, so I understand the reasoning behind wanting people to build on their own systems, but sometimes...

Anyway, so I can't actually get DSFML-C to compile because CMakeGUI won't find or let me choose entire MinGW installations.  I can assign gcc and g++, but then it starts looking for other things in the default folder instead of where those two programs are found.  How do I go about building this so I can build DSFML and start using it?

10
D / LibGDX's Scene2d in SFML
« on: November 07, 2013, 06:35:20 pm »
Anyone know of anything that people have made that's like LibGDX's Scene2d for SFML?  I have a game that I was programming in Java with LibGDX, and I was just going to get into D because it looks like it could finally handle things like I would need them to and be native code (security), but without a Scene2d equivalent, it's going to be much harder than I was expecting.

By the way, I posted this in the D section because from what I understand, D would be required to even write something like Scene2d for SFML.

11
Window / Clicking in Window Doesn't Give Focus
« on: October 17, 2013, 03:53:30 am »
So I just started developing games using SFML, and I've got a major problem.  I have my main loop set up thusly:

while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
                        if (event.type == sf::Event::LostFocus)
                                paused = true;
                        if (event.type == sf::Event::GainedFocus)
                                paused = false;
        }
                if(paused)
                        continue;
                ship.resetDirections();
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
                {
                        ship.direction[3] = true;
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                {
                        ship.direction[1] = true;
                }

                ship.updatePosition();

        window.clear();
        window.draw(ship);
        window.display();
    }
Now, you'll notice, in the polling loop, I have a pausing thing going on.  Losing focus pauses the game, gaining focus resumes the game.  Pretty basic pausing system for now (I'll make a pause menu eventually).  But, when I click inside the window frame (anywhere but the title bar, or the outline around the black that the background currently is), the window isn't actually getting focus.  It doesn't, unless I actually go and click the window frame, or click the program's icon on my start bar (Windows 7).  I'm using VS2012, and have it going through the System package to maintain compatibility.

Pages: [1]
anything