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 - Celtic Minstrel

Pages: 1 2 3 [4] 5 6
46
Graphics / Re: sf::Text missing glyphs [Bug]
« on: June 26, 2012, 02:45:30 am »
Do you use only one thread?
I've experienced similar problems when drawing from diffrent threads but nobody really cared to explain what goes wrong.
I did too; I solved it by locking mutexes in my text draw/measure functions, though I'm not sure I really like that solution.

47
Graphics / Re: Lots of Objects in Game and SFML2
« on: June 26, 2012, 02:44:03 am »
Interesting... I had a drawing queue that I set up using a custom struct, a fixed number of layers, and an unordered_map with the tile location as the key (and actual screen location among the attributes), but now I'm wondering if I should think about switching over to a multimap... it sounds like it could be a lot simpler, provided I can make it work for what I need.

(The aforementioned system was written before I switched from SDL to SFML, so it may have been flavoured by that somewhat; I didn't really have an equivalent of the Sprite object to work with.)

48
Graphics / Re: [solved] Resizing the view with the window
« on: June 26, 2012, 02:16:50 am »
I know it's valid; I just haven't seen it used as a function argument before (that I can remember). Mostly I've seen (and sometimes used) it in if statements.

49
System / Re: [SFML 2.0 RC] - Threads
« on: June 26, 2012, 02:11:04 am »
It's generally not a good idea to pass this in the initializer list because at that point it's not finished being constructed. However, in this case you know that Thread isn't going to access it until you later call .launch(), so it's safe to ignore the warning.

I don't think there's a way to avoid the warning given the current API.

50
System / Re: [SFML 2.0 RC] Mouse and moving sprite
« on: June 26, 2012, 02:07:08 am »
No, key repeat is enabled by default, so you'd continue to get KeyPressed events until you released the key.

EDIT: Argh, I got confused and bumped up an old post. Sorry!

51
General / Re: Weird graphical bug
« on: June 25, 2012, 04:00:56 am »
Through some investigating I found out that at the end of each main loop(it ends right after the calls to App.Draw) eniter always points a non-existent object.
This is intentional; a pointer to a non-existent object just past the end of the list is the STL's way of signalling the end of an iteration. You'll find that Entities.end() also returns an iterator that points to a non-existent object, and that it's the same one; and that's why the loop terminates.

52
General discussions / Re: SFML 2.0 RC
« on: June 24, 2012, 04:20:25 pm »
Why do you call it "set intersection operator"? This one has the symbol ∩. If I had to choose the most appropriate C++ operator for set intersection, it would probably be & (because the intersection contains the elements that are in the first set and the second set) -- on the contrary, | would rather denote set union.
Huh. You're right, of course. (Duh.) Anyway, I think it's reasonably obvious that what operator& would mean for rectangles, since the logical and set operators are closely related, and documentation would clear up any confusion.

That said, I don't really care that much if it's added. It's just a thought thrown out.

53
General / Re: a problen when making .exe with release
« on: June 24, 2012, 04:16:22 pm »
Of course, some parameters are necessary, but they mainly concern constructors. The passed argument can then be stored as class member and is automatically visible in member functions, but local to the class only.
This does kinda make sense. I actually did this to reduce the usage of one of my globals a little while ago.

54
General / Re: Thor and CMake Error - OSX
« on: June 24, 2012, 04:11:53 pm »
Although clang 3.1 is supposed to support lambda expressions, the version Apple ships crashes when it encounters them in the source.

55
Graphics / Re: Best way to measure text?
« on: June 24, 2012, 03:51:56 pm »
Should I make a ticket on the issue tracker?

56
General discussions / Re: SFML 2.0 RC
« on: June 24, 2012, 09:04:29 am »
It might be nice to have an operator| for Rects.
Code: [Select]
template<typename Num> sf::Rect<Num> operator| (sf::Rect<Num> lhs, sf::Rect<Num> rhs) {
sf::Rect<Num> intersect;
if(!lhs.Intersects(rhs, &intersect)) return sf::Rect<Num>();
return intersect;
}

template<typename Num> sf::Rect<Num>& operator|= (sf::Rect<Num>& lhs, sf::Rect<Num>& rhs) {
lhs = lhs | rhs;
return lhs;
}

Using the set intersection operator makes sense for this context, and it's slightly different than the member function which returns a boolean rather than the intersecting rectangle. Of course, it's not that important, since these are global functions and therefore I can just do this myself if I need it. Just a random thought in passing.

(It'd also be nice to have a "contains" operator that takes a Rect and a Vector, but I can't think of a reasonably logical operator symbol to use for that one.)

57
Feature requests / Re: Few suggestions
« on: June 24, 2012, 08:58:08 am »
This isn't necessarily an indication of it being allowed by the standard, but clang 3.1 accepts the following code:
Code: [Select]
union test {sf::Vector2f test;};

58
Graphics / Best way to measure text?
« on: June 24, 2012, 08:55:28 am »
Since there's no measureText function anywhere, I've been measuring the size of a string by constructing a Text object, getting the bounds, and then discarding it. Is that a reasonable way to measure text, or would you say I should be using just a Font and calculating the size one character at a time by accessing the glyphs?

To put this another way, does constructing a text object with a string do anything towards rendering, or does it just store the string and font attributes and calculate the size of the string, leaving any rendering to when draw() is called?

I'll note that the lack of a measureText function in Font surprised me at first, since this is kind of an important thing to have. I've actually been having small performance issues in rendering large quantities of text and have figured out that the measuring, wrapping algorithm, and rendering take the most time overall. I think my wrapping algorithm could also use some work, but I'd like to know if there's any point in changing the measuring algorithm as well.

59
General / Re: Cannot add text to window
« on: June 24, 2012, 08:46:14 am »
You should probably try to give either a path to a font relative to your program, or an absolute path to a font in the global Fonts directory (which I'd guess is something like "C:\Windows\Fonts"). Since this is Arial, I'd recommend the absolute path. (Of course, this does mean your program will only work properly on Windows.) If you were using some obscure font you found somewhere that you don't expect someone else to have, I'd do what Exploiter said and put the font in your project folder.

60
General / Re: Crosscompiling and console application?
« on: June 24, 2012, 08:41:57 am »
I vaguely recall being told how to do this in Dev C++ (no, I don't use it), and I think it's something to do with the linking stage; I can't remember the details, but I found this which might possibly help you?

Pages: 1 2 3 [4] 5 6