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

Pages: [1]
1
General / Re: std::cout showing random bits and pieces of other strings?
« on: December 02, 2012, 04:15:36 pm »
Oh... I'm an idiot :X Now it worked! Thanks!

2
General / Re: std::cout showing random bits and pieces of other strings?
« on: December 02, 2012, 03:03:50 pm »
OK, I have a similar problem right now, trying to display the mouse's coordinates in a RenderWindow. This means I have to put them into a std::string and then set this string to a sf::Text. But trying to use your function results in these error messages:

D:\Projects\DoesItWork\main.cpp||In function 'std::string EEVarToStr(T)':|
D:\Projects\DoesItWork\main.cpp|9|error: invalid use of incomplete type 'std::stringstream {aka struct std::basic_stringstream<char>}'|
d:\mingw\bin\..\lib\gcc\mingw32\4.6.2\include\c++\iosfwd|107|error: declaration of 'std::stringstream {aka struct std::basic_stringstream<char>}'|
D:\Projects\DoesItWork\main.cpp||In function 'std::string EEVarToStr(T) [with T = int, std::string = std::basic_string<char>]':|
D:\Projects\DoesItWork\main.cpp:55|49|instantiated from here|
D:\Projects\DoesItWork\main.cpp|7|error: 'ss' has incomplete type|
D:\Projects\DoesItWork\main.cpp|10|warning: control reaches end of non-void function [-Wreturn-type]|
||=== Build finished: 3 errors, 1 warnings ===|

Any tips?

3
Graphics / Problem with strings in SFML 2.0
« on: December 02, 2012, 02:08:02 pm »
Hi! I'm trying to display Mouse coordinates in the render window. Here's my code:
...
sf::Font MyFont;

    if (!MyFont.loadFromFile("arial.ttf"))
    {
        return 1;
    }

    sf::Text myPos;
    std::string str;

while (window.pollEvent(event))
        {
         if (event.type == sf::Event::MouseMoved)
            {
                str=event.mouseMove.x+" "+event.mouseMove.y;
                myPos.setString(str);
                myPos.setFont(MyFont);
                myPos.setCharacterSize(20);
                myPos.setColor(sf::Color::Red);
                myPos.setPosition(0,0);
                std::cout<<str;
            }
        }
...
 

...but instead of the coordinates the string gets some weird system messages about problems with relocation:



[attachment deleted by admin]

Pages: [1]
anything