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 - Zefz

Pages: [1] 2
1
Graphics / Re: sf::Text missing glyphs [Bug]
« on: June 28, 2012, 10:07:15 pm »
I've tried adding mutexes as well, but it did not help.

2
Graphics / Re: sf::Text missing glyphs [Bug]
« on: June 25, 2012, 11:51:56 pm »
I can confirm that this still is a problem.

This is probably the same issue as:
http://en.sfml-dev.org/forums/index.php?topic=2073.msg13545#msg13545

I did some more research and looked into SFML part of the code. The problem seems to be in Font::loadGlyph(). I have determined this by checking if everything above this level was working correctly (the entire Text class seems to be working correctly). Is it possible that it finds something wrong in the glyph cache and returns an empty glyph?

I had a few problems with the program crashing and complaining that Texture size was too big. As mentioned in the forum post I linked above the problem does not appear on text assigned in the constructor, only through setString. Very strange.

3
Graphics / Re: Get Size and Position of texture/sprite
« on: June 10, 2012, 01:25:07 pm »
What you want is to use either %u (unsigned integer) or %f (float) for each of the X and Y values in the vector.

For example:
Vector2u PlayerSize = tBackground[0].getSize();
char test[512];
wsprintf(test, "%u, %u", PlayerSize.x, PlayerSize.y);
MessageBox(NULL, test, NULL, NULL);
 

4
SFML projects / Re: RoveNet Network Library
« on: June 02, 2012, 01:21:43 pm »
What are you using from Enet to make it a dependency?

5
Graphics / Re: Trouble with sf::Text
« on: June 02, 2012, 01:18:55 pm »
Isn't that a lot slower? Having to reallocate a Text object and recalculate the text geometry every frame?

6
It's to check if the socket has new data ready without pulling the data at the same time. This is useful in my specific code for both debugging and readable code.

I also encountered a problem where SocketSelector was reporting new data when there wasn't really anything. I guess this is rather a bug in the socket selector. Could be related to the non-blocking sockets connect bug in windows (issue 194). In any case, my implementation solved the problems this was causing.

7
I found this feature useful so I implemented this myself in my code.

I can see why a socket.isSocketReady would be useful if you do not want to use a SocketSelector.

8
Network / Re: SFML network library vs ?
« on: May 27, 2012, 01:24:13 pm »
Quote
-or if I should stick to low level socket programming

SFML is already in my opinion a low-level socket programming library (as compared to RakNet or the like). 

Two very useful tools SFML provides however, are the SocketSelector (for handling multiple socket connections on the server side) and most importantly the Packet abstraction (as opposed to stream-based sockets on TCP). Additionally, SFML is fully cross-platform between Windows, Linux and Macintosh. For these reasons I would definitively recommend using SFML instead of implementing network on low-level OS functions.

9
Audio / Re: Memory released ..
« on: May 11, 2012, 12:15:54 pm »
std::vector does not need to hold pointers.

std::vector<SoundBuffer> myVector;

//Load some sounds
myVector.resize(3);
myVector[0].loadFromFile("sound1.wav");
myVector[1].loadFromFile("sound2.wav");
myVector[2].loadFromFile("sound3.wav");

myVector.clear();  //all memory is freed! no memory leaks
 

10
Network / Re: Packet reception - interoperability with Java (?)
« on: May 11, 2012, 12:12:02 pm »
Another problem with java is that it only supports Signed data types. Since SFML and C++ in general uses a lot of unsigned data types (like the header in a sf::Packet) this can become a problem. You would need to write your own number converters and store Uint32 in the java Long type. UInt64 cannot be represented in Java at all (unless you use some special BigNumber class wrapper).

11
SFML website / Re: SFML 2.0 Error message
« on: May 10, 2012, 12:25:26 pm »
Try downloading it to a different folder.... like your desktop.

It sounds like either a corrupt download (still happens sometimes) or a permission problem for that folder.

12
Network / Re: Packet reception - interoperability with Java (?)
« on: May 10, 2012, 12:08:57 pm »
You shouldn't rely on SFML's packet abstraction for this. Both Java and SFML use the same low level stream based socket communication, so it is entirely possible to build your own Packet protocol on top of that (but you have to code both the Java and C++ side).

13
Graphics / Re: Integer to sf::Text
« on: May 09, 2012, 01:16:41 pm »
Doing some more research into std::to_string() and I found out that it is not fully supported on Windows by MinGW because of a bug (Bug 52015)

This bug was last confirmed 2012-02-27 in GCC 4.6.1 (I can confirm this myself my MinGW compiler does not find any deceleration of std::to_string()). So I guess you have to use one of my previous solutions until this bug is fixed.

14
Graphics / Re: Intenger to sf::Text
« on: May 09, 2012, 01:03:41 pm »
Ah true. Thanks for reminding me :) I guess I'm still not used to all the fancy new stuff c++11 supports. Assuming you are compiling with the latest C++11 standard then you should definitively use to_string (defined in <string>):

Text myText;
Int32 myInteger = 1000;
myText.setString(to_string(myInteger));
 

15
Graphics / Re: Intenger to sf::Text
« on: May 09, 2012, 12:56:12 pm »
Both of these functions can be used to convert Integer to a String (using SFML data types). Both solutions should be cross-platform and compiler friendly.
#include <sstream>
using namespace std;

String toString(Int64 integer)
{
    ostringstream os;
    os << integer;
    return os.str();
}
 

#include <string>
using namespace std;

String toString(Int32 integer)
{
    char numstr[10]; // enough to hold all numbers up to 32-bits
    sprintf(numstr, "%i", integer);
    return numstr;
}
 

As Laurent mentioned above, you could then do something like this:
Text myText;
Int32 myInteger = 1000;
myText.setString( toString(myInteger) );
 

Pages: [1] 2
anything