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

Pages: [1]
1
Graphics / Re: sf::Text crashing on draw
« on: July 27, 2014, 10:58:26 am »
Hahaha, but the bug got crushed this time through the good fortune bestowed upon me by RNGesus.

2
Graphics / Re: sf::Text crashing on draw
« on: July 27, 2014, 09:43:04 am »
OMG! IT LIVETH!

I went back to my older compiled version but gave it the include path of a freshly downloaded copy and it worked. Idk how the include folder originally got messed up  or why it even built other things (besides text) but I won't question my good fortune.

I would still be interested in knowing what the hell just happened though.

3
Graphics / Re: sf::Text crashing on draw
« on: July 27, 2014, 08:59:05 am »
I have to copy paste dlls if I wanted to run the executable from explorer but not from Qt creator itself. But just to get rid of the whole dll problem I compiled again, this time with the newer mingw32 4.8 with the static_std libs option. It compiles fine but now I keep getting undefined reference errors when trying to build.

I know it must be the .pro file settings but what am I doing wrong? I read elsewhere on the forums that using static sfml libs tends to stop the sf::Text issues so that's why I decided to do this. Here's my .pro file settings.

Is the order of my libs wrong?

If I just try to use -lsfml-system-s , -lsfml-window-s & -lsfml-graphics-s, this is what I get:
0) Putting graphics before window creates 70+ errors as seen in the attached picture.
1) Doing system, window, graphics      gets 34 errors
2) Doing window, system, graphics      gets 14 errors
3) Doing window, graphics, system      gets 14 errors (same as above)



QT       -= gui
TARGET = TextTest
CONFIG += c++11 console
CONFIG   -= app_bundle
TEMPLATE = app

SOURCES += main.cpp
DEFINES += SFML_STATIC

LIBS        += -LE:/TunaBattle/SFMLBUILD3/lib
LIBS        += -lsfml-audio-s -lsfml-graphics-s -lsfml-main -lsfml-network-s -lsfml-window-s -lsfml-system-s
INCLUDEPATH += E:\TunaBattle\SFMLBUILD3\include\
DEPENDPATH  += E:\TunaBattle\SFMLBUILD3\include\

4
Graphics / Re: sf::Text crashing on draw
« on: July 27, 2014, 06:09:37 am »
I'm still stuck on this guys. If anyone has any insight or alternatives to draw text on screen, I'd appreciate it. I do believe that I must've messed up cMake somehow even though it threw no errors. I followed the tutorial about it thoroughly so I'm at wits end currently :S

5
Since the game is gonna be very real-time, I think I should use UDP . From what I recall, using TCP will halt the stream of incoming data if a segment is lost and wait until it is resent from the source (to simulate ordered delivery of data). That seems very undesirable unless of course I'm mistaken.

6
Graphics / Re: sf::Text crashing on draw
« on: July 24, 2014, 04:03:44 pm »
Using Qt Creator as the IDE so I couldn't quite follow those steps exactly. I added -verbose and --verbose to compiler and linker flags. Here is the output :

(click to show/hide)

7
Graphics / Re: sf::Text crashing on draw
« on: July 24, 2014, 11:48:16 am »
Hapax, just because a font isn't loaded will not cause a segault.

To the OP, make sure you compiled SFML with the same compiler that you are using for your application - and make sure you aren't mixing debug/release libs.

You were right! I was being silly and not using the right compiler. I had the wrong kit selected in qt :(
However, it has not helped. it is still crashing on draw() very hard. However the error seems to now be write access violation. I've attached a picture of the debugger.

8
Graphics / sf::Text crashing on draw
« on: July 23, 2014, 06:18:43 am »
EDIT: Added my 3rd post here cause I felt this describes the problem much clearly (as Strelok suggested). In a nutshell, every time I try to draw an sf::Text instance, it crashes the program.

So here is simple main code that always results in a crash for me. All I'm trying to do is to draw sf::Text instance. I see "drawing..." on console but never "finished". I've attached the windows APPCRASH message as well as what Qt Debugger is telling me (that it's a seg fault). Both of them specifically mention the msvcrt.dll so I must not have the right version where the SFML app is running?

EDIT: I used cMake with mingw32 compiler to compile SFML btw. I have now tried manually putting every version of the mscvrt.dll (on my computer) into the .exe's folder and tried running it but to no avail. All of them result in the same crash.

#include <SFML/Graphics.hpp>
#include <SFML/Graphics/Text.hpp>
#include <string>
#include <iostream>

std::string getAppPath()
{
    std::string appPath = "E:/TunaBattle/TextTest/Build/";
    #ifdef debug
        appPath += "debug/";
    #else
        appPath += "release/";
    #endif
    return appPath;
}

int main()
{
    sf::RenderWindow window(sf::VideoMode(1024,768,32),"sf::Text test");
    sf::Font font;
    sf::Text text;
    bool fontLoaded = font.loadFromFile(getAppPath() + "JOKERMAN.TTF");

    if(fontLoaded)
    {
        text.setFont(font);
        text.setString("Argh Matey!");
        text.setPosition(30,30);
        text.setCharacterSize(30);
    }

    while(window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::White);
        if(fontLoaded)
        {
            std::cout << "drawing...";
            window.draw(text);  
            std::cout << "finished\n";
        }
        window.display();
    }
    return 0;
}
 

9
ahh ok, I see. I am kind of new to adding a multiplayer component to my game. What would you suggest is the best way to go about it? I was thinking having a tcp connection so that the client/server know they are connected and then using udp to send data back and forth. Does that seem like a good idea.

I also ran into some troubles with sf::Text but I will post a question about that in the appropriate thread if I can't figure it out on my own. It was crashing a lot whenever I tried to draw it or .getlocalbounds().

10
Thank you for your prompt reply. setBlocking(false) was being called only once in another function but I pasted it there to make sure others knew it was called.

You were right though it wasn't just the ipAddress. After adding a temp unsigned int as the receiving port, it started running just fine. I wonder why that is :S

11
Hi all,

I have run into a few obstacles while coding in SFML but this one has been driving me crazy. After many hours of reading everything I could find through google and SFML 2.1 docs, I have decided to let out a desperate plea for help.

The goal here is for the client to spam "hello_server" until it gets a response from the server in recvMsg(). However, after it runs recvMsg(), the socket Status is constantly be sf::Socket::Error. What is weird is that if I don't run the recvMsg(), it will do exactly what I intended it to. Will spam "hello_server" successfully.

On recvMsg(), I get sf::Socket::NotReady obviously because the server is not there to respond.

Here is my code:
void mainLoop()
    {
        port = 12345;
        while(gameWindow->isOpen())
        {
            sf::Event event;
            while(gameWindow->pollEvent(event))
            {
                if(event.type == sf::Event::Closed)
                {
                    cout << "closing window\n";
                    gameWindow->close();
                }
            }
            logic();
            draw();
        }
    }

void logic()
    {
        playButton.update();
        socket.setBlocking(false);
        if(!handshakeSuccess)
        {
            const char msg[] = "hello_server";

            int sockStatus = socket.send(msg,sizeof(msg),serverIp, 50001);
            if     (sockStatus == sf::Socket::Done)                  std::cout << "Sending Hello Server!\n";
            else if(sockStatus == sf::Socket::NotReady)              std::cout << "Send socket not ready\n";
            else if(sockStatus == sf::Socket::Disconnected)          std::cout << "Send socket disconnected\n";
            else if(sockStatus == sf::Socket::Error)                 std::cout << "Send socket error\n";

            recvMsg();
        }
    }

void recvMsg()
    {
        char inMsg[1024];
        std::size_t received;
        int sockStatus = socket.receive(inMsg,sizeof(inMsg),received,serverIp,port);

        if(sockStatus == sf::Socket::Done)
        {
            std::cout << "message received : " << inMsg << endl;
            handShakeSuccess = true;
        }
}
 

Any help is appreciated. Thanks.

Pages: [1]
anything