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.


Messages - Xander314

Pages: [1] 2 3 ... 5
1
Graphics / Animated sprite in SFML
« on: February 05, 2012, 10:34:37 am »
Quote from: "Elgan"
Hope this helps, though I am terrible at explaining.

No, that's okay. I see what you mean. It will be good to design a good way of packaging animations, but I think I'll get the animation itself working first...

Quote from: "Nexus"
non-intrusive approach that just modifies one or multiple existing sprites

That's an interesting approach, and certainly one of the neater ones I should think. I'll take a look at Thor when I have a minute - looks like a pretty cool library in general! However, for my own animation class, I want to make it -- in the name of object oriented-ness -- a single self contained class if possible.

However, it's tricky. As you say, inheriting sf::Sprite will give you a load of unwanted member functions. The best approach would be to inherit from sf::Sprite and override those member functions, but they're not virtual in sf::Sprite, so it's not an option.

Option 2 would be inheriting from sf::Drawable. Then, if the animation has a sprite, all the position, colour, etc applied to the animation have to be duplicated to the sprite for drawing, which seems somewhat wasteful.

Finally, you could inherit from sf::Drawable and not have a sprite, but then you'd just end up re-implementing most of the sprite functionality in the animation...

Hmm... it's a difficult choice, I can see why you went for the `non-intrusive' option ;)

What if I inherited sf::Sprite privately and just duplicated all the desired repeated functions with public inline 'proxy' functions which just called the corresponding private ones? If they were inline, there probably wouldn't even be performance loss that way. Mind you, RenderTarget is a friend of Drawable, so I guess this might break something...

Quote from: "HKei"
You think it makes sense to say "An animation is a sprite"?

I think it makes sense to say ``an animated sprite is a sprite'' ;) And that's exactly what I'm making, an animated sprite. That said, I don't think inheritance will work in practice.

2
Graphics / Animated sprite in SFML
« on: February 03, 2012, 09:04:18 pm »
I'm planning a little animated sprite class for SFML. I think it makes sense to inherit from sf::Drawable or sf::Sprite (the first seems nicer in theory, but I think the second might work better, or at least more easily, in practice).

Anyway, I have two little questions to help me decide on implementation.

1. Is there much of a performance difference between loading lots of small textures as opposed to one large one?
2. Is either of sf::Sprite::SetTexture or sf::Sprite::SetSubRect likely to be significantly faster (I don't know if this question can be easily answered, if not I guess I could use a profiler if I really wanted to...)

Thanks,
Xander

3
Graphics / Using sf::RenderWindow::Capture() efficiently
« on: January 10, 2012, 09:48:33 pm »
I noticed today that sf::Image::CopyWindow has been replaced by sf::RenderWindow::Capture().

I wanted to ask how to use this function efficiently, given the performance overhead of copying an image.

Is there something better than this:
Code: [Select]

sf::Image screenshot = Window.Capture();


I know the copy related to the return of an sf::Image can be optimised out, but how can I get around the overhead of the assignment operation?

I suppose I could do this:
Code: [Select]

sf::Image& screenshot = Window.Capture();

but in some circumstances I imagine there would be issues of scope/lifetime of the returned temporary.

4
Graphics / Text Problem - Funny dotted lines
« on: November 05, 2011, 02:43:53 pm »
When displaying text in SFML, strange dotted lines can be seen as shown in the picture.



I pulled the latest SFML source from the Git repository just a few minutes ago and this did not fix the problem. The font I am using is FreeSerif.ttf (with a Unix system), but it similarly occurred with the SFML default font.

The code used to load the font:
Code: [Select]

    sf::Font Main;
    cout << "-> /usr/share/fonts/truetype/freefont/FreeSerif.ttf...";
    if (!Main.LoadFromFile("/usr/share/fonts/truetype/freefont/FreeSerif.ttf"))
        return 1;


The code used to create the text:
Code: [Select]

 // victory message
        sf::Text VictoryMessage("", Main, 100U * VMode.Height / 900);
        VictoryMessage.SetColor(sf::Color::White);

(plus an additional bit to set the string and centre the text). And finally it's drawn with sf::RenderWindow::Draw().

Any ideas what could be causing this?

PS: I'm right now trying a minimal example and will post back the results soon.

5
General / SFML 2.0 Dependencies - Ubuntu
« on: August 13, 2011, 06:28:41 pm »
Thanks :) I knew it was a stupid question... I should have rechecked the tutorial before asking :oops:

6
General / SFML 2.0 Dependencies - Ubuntu
« on: August 13, 2011, 12:41:13 pm »
Sorry if this has been asked before, but is there somewhere I could find a complete list of dependencies for SFML 2.0 on Ubuntu? (There's a dependency list in the 1.6 tutorial, but I was under the impression SFML has changed the libraries it uses quite a lot since then).

Thanks,
Xander

7
Some viewers of my blog and YouTube channel asked me if I could upload prebuilt SFML 2.0 binaries. What I was intending to do was upload the complete SFML 2.0 source from GitHub, but with the binaries added.

Having read SFML's license, it looks like I can do this, provided I leave the license.txt file in there. However, it would mean that I was also distributing binaries for OpenAL, libsndfile, FreeType, etc.

For example, GLEW is under the 2 clause BSD license which requires a copyright notice to be distributed with its binary. However, I could not find such a license. Laurent, how have you got around this when distributing the files with SFML? Do the license bits in the top of the extlibs/ header files suffice?

EDIT: Also, you say that SFML uses libpng, zlib, stb_vorbis and SOIL. There are no binaries or headers for any of these. Are they already linked to other external library binaries?

8
Audio / openal32.dll
« on: July 08, 2011, 10:43:40 am »
Quote
As in "outdated" and "buggy"

Mostly, I find that outdated implies buggy :P

Thanks for the help :)

9
Audio / openal32.dll
« on: July 08, 2011, 10:39:39 am »
Oh yes, so I do ;)

Quote
bad

As in outdated?

If I provide the other one in the project directory, will the application find that one before it searches system32?

10
Audio / openal32.dll
« on: July 08, 2011, 10:33:07 am »
I had always assumed this file to be necessary to any application using audio, or at least those using positional audio. However, the following code runs perfectly happily when linked statically to SFML and provided only with libsndfile-1.dll, not openal32.dl.

When is openal32.dll necessary?

Code: [Select]

#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

int main()
{
sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "SFML Sample Application");

sf::Image Image;
Image.LoadFromFile("image.png");
sf::Sprite Sprite(Image);
Sprite.Resize(800.0f, 600.0f);

sf::SoundBuffer Buffer;
Buffer.LoadFromFile("sound.wav");
sf::Sound Sound(Buffer, true);
  Sound.SetPosition(5.0f, 1.0f, 10.0f);
Sound.Play();
  sf::Listener::SetPosition(0.0f, 0.0f, 0.0f);

while (Window.IsOpened())
{
sf::Event Event;
while (Window.PollEvent(Event))
{
switch (Event.Type)
{
case sf::Event::Closed:
Window.Close();
break;
default:
break;
}
}

Window.Clear();
Window.Draw(Sprite);
Window.Display();
}

return 0;
}

11
Sorry to bump an old thread. However, I was having a similar problem and I fixed by swapping from using the x64 libsndfile-1.dll to the x86 libsndfile-1.dll.

I am also on Windows 7 64bit. However, unless you have specifically configured VC++ Express to work with the 64bit toolset of the Windows SDK, you are bound to 32bit compilation anyway.

I assume I could use the 64bit one if I compiled a 64bit application?

12
General discussions / SFML Logo License
« on: July 02, 2011, 12:54:39 pm »
So the logo is under the same license as the library? I wasn't sure as they are separate downloads ;)

13
General discussions / SFML Logo License
« on: July 02, 2011, 12:49:19 pm »
I want to modify the SFML logo to use as the logo for my (mainly SFML related) blog and videos which may in the future be used for advertising my products as well as with Google Adsense, etc. Would that be permitted under the logo's license?

Thanks
-Xander

14
Graphics / SFML Default Font is Working
« on: July 02, 2011, 11:32:26 am »
Excellent. That means I can almost leave it out of my SFML fonts and text tutorial (I'll just say if it you get the error then upgrade lol).

15
Graphics / SFML Default Font is Working
« on: July 02, 2011, 08:47:04 am »
I am using 2.0, but I have definitely had the issue previously with 2.0. At least, I have had an issue which involved unexplained crashes during the construction of sf::Text using an sf::Font object and during destruction of such objects too, which persisted even without the default font. Linking statically fixed it for me then.

Maybe this was in fact a separate bug and it has now been fixed?

Quote
using SFML1.6

So the infamous default font issue is not present in 2.0? How long ago was it fixed?

Pages: [1] 2 3 ... 5
anything