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

Pages: [1]
1
General discussions / Re: Debian/Ubuntu packages for SFML
« on: May 24, 2013, 04:09:42 pm »
Hey thank you, it worked  :D
But I do not really understand why it does.
http://packages.ubuntu.com/de/precise/libsfml-dev
The package information show that the package libsfml-dev is still version 1.6. But why does my machine install sfml 2.0 now?
Would it be possible that adding your launchpad account to my repositories is the reason for this behaviour?

2
General discussions / Re: Debian/Ubuntu packages for SFML
« on: May 22, 2013, 08:09:18 am »
Am I the only one who is not able to download the sfml-development package? I already tried to use only libsfml but it's not possible to link with this version [there are no include files and some links are missing in /usr/lib]

3
General / Re: Linking sfml with g++
« on: May 17, 2013, 08:14:24 pm »
Quote
Why don't you have the libsfml-xxx.so symlinks? Whether you built SFML yourself, or downloaded it from the website, they should be there.
I installed the libsfml package of Sonkun. Strange to say, there weren't any include files so I downloaded them from the official site and extracted them to /usr/include. Where do I have to add these links? Unfortunately the package libsfml-development doesn't exist.

4
General / Linking sfml with g++
« on: May 17, 2013, 03:50:50 pm »
I am not able to link the libraries of sfml...
Code: [Select]
$g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: cannot find -lsfml-system
collect2: ld returned 1
Quote
/usr/lib$ ls | grep sfml
libsfml-audio.so.2
libsfml-audio.so.2.0
libsfml-graphics.so.2
libsfml-graphics.so.2.0
libsfml-network.so.2
libsfml-network.so.2.0
libsfml-system.so.2
libsfml-system.so.2.0
libsfml-window.so.2
libsfml-window.so.2.0
I also tried -L/usr/lib, but nothing changed.
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

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

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}
 

5
General discussions / Please update ubuntu package libsfml-dev
« on: May 15, 2013, 03:18:28 pm »
Unfortunately the ubuntu repositories still have the version 1.6. Because of my knowledge of linux isn't very good I am not able to install the latest version. The binaries need some additional libraries which I am not able to compile.
Thanks

6
Graphics / Re: [2.0]Drawing Sprite AND Shape
« on: January 10, 2013, 07:05:31 pm »
window.clear();
                        window.draw(sprite);
                        window.draw(circle);
                        //window.draw(rect);
                        window.display();

ouput:

7
Graphics / Re: [2.0]Drawing Sprite AND Shape
« on: January 10, 2013, 06:08:46 pm »
Thanks for the fast reply. Unfortunately my mistake with the event loop was not the cause of the displaying problems.
This code:
window.clear();
                        window.draw(sprite);
                        window.draw(circle);
                        window.draw(rect);
                        window.display();

produces this output:



and this code:
window.clear();
                        window.draw(circle);
                        window.draw(rect);
                        window.draw(sprite);
                        window.display();

produces this output, although I expected to see a picture.




This is my whole code:
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

int main() {
        sf::RenderWindow window;
        sf::Event myEvent;
        sf::Texture texture;
        sf::Sprite sprite;
        sf::CircleShape circle;
        sf::RectangleShape rect;
        //=========================>
        if (!texture.loadFromFile("gothic.bmp"))
                return -1;
        sprite.setPosition(0, 0);
        sprite.setTexture(texture);
        sprite.setScale(0.5, 0.5);

        circle.setPosition(100, 100);
        circle.setRadius(10);
        circle.setOutlineColor(sf::Color::Red);

        rect.setPosition(500, 300);
        rect.setSize(sf::Vector2f(20, 20));

        window.create(sf::VideoMode(800, 600), "MyWindow");
        while (window.isOpen()) {
                while(window.pollEvent(myEvent)) {
                                if (myEvent.type == sf::Event::Closed) {
                                        window.close();
                                }
                        }

                        window.clear();
                        window.draw(sprite);
                        window.draw(circle);
                        window.draw(rect);
                        window.display();
        }

        return 0;
}

This is the picture I want to display [it's not for a special purpose].


For your information: I have an AMD graphics card. Maybe thats important to know for you because SFML 1.6 didn't work with it.

[attachment deleted by admin]

8
Graphics / [2.0]Drawing Sprite AND Shape
« on: January 10, 2013, 05:35:34 pm »
When I want to draw a shape and a sprite on my window there appear strange bugs.
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

int main() {
        sf::RenderWindow window;
        sf::Event myEvent;
        sf::Texture texture;
        sf::Sprite sprite;
        sf::CircleShape circle;
        sf::RectangleShape rect;
        //=========================>
        if (!texture.loadFromFile("gothic.bmp"))
                return -1;
        sprite.setTexture(texture);
        sprite.setScale(0.5, 0.5);

        circle.setPosition(100, 100);
        circle.setRadius(100);
        circle.setOutlineColor(sf::Color::Red);

        rect.setPosition(500, 300);
        rect.setSize(sf::Vector2f(20, 20));

        window.create(sf::VideoMode(800, 600), "MyWindow");
        while (window.isOpen()) {
                while(window.pollEvent(myEvent)) {
                        if (myEvent.type == sf::Event::Closed) {
                                window.close();
                        }

                        window.clear();
                        window.draw(circle);
                        window.draw(rect); //evil line. as soon as i have deleted this line everything works
                        window.draw(sprite);
                        window.display();
                }
        }

        return 0;
}

Result: ust the rectangle is drawed to the window.

If I change the order of the draw-calls and comment the "draw(rect)"-line out, everything works:
                        window.clear();
                        window.draw(sprite);
                        window.draw(circle);
                        //window.draw(rect); //evil line
                        window.display();

But this does not work.
window.clear();
                        window.draw(circle);
                        //window.draw(rect); //evil line. as soon as i have deleted this line everything works
                        window.draw(sprite);
                        window.display();
//Only the sprite is drawed

9
Network / Re: Get Number of Bytes before Receiving
« on: December 14, 2012, 01:54:18 pm »
Thank you, I understood it now. I've found this snippet in the documentation and think that I might have found a bug.
sf::SocketSelector

             sf::TcpSocket* client = new sf::TcpSocket;
             if (listener.accept(*client) == sf::Socket::Done)
             {
                 // Add the new client to the clients list
                 clients.push_back(client);

                 // Add the new client to the selector so that we will
                 // be notified when he sends something
                 selector.add(*client);
             }

If the listener.accept()-Method fails there is a memory leak because the client-pointer won't get deallocated.

             sf::TcpSocket* client = new sf::TcpSocket;
             if (listener.accept(*client) == sf::Socket::Done)
             {
                 // Add the new client to the clients list
                 clients.push_back(client);

                 // Add the new client to the selector so that we will
                 // be notified when he sends something
                 selector.add(*client);
             }
             else
             {
                 delete client;
             }

10
Network / Re: Global network
« on: December 13, 2012, 09:36:46 pm »
No, you just have to configure the router of the server. As soon as the tcp-connection is built both can send and receive. If you use udp-packets I am not sure how it exactly works  because I never used them but it should work the same.

11
Network / Re: Get Number of Bytes before Receiving
« on: December 13, 2012, 09:27:27 pm »
Thank you, that seems to be a good solution. I thought there would be something like the select-function of the WinApi which returns the number of bytes waiting in line.

12
Network / Re: Global network
« on: December 12, 2012, 08:02:57 pm »
For communicating over the internet you need to configure your router. Normally the router blocks every request from outside so no hacker shall get into your network. If you want to run a server in your intranet you need to open the ports at your router. It's called "Port Forwarding" and when searching it with google you will find a lot of tutorials.

As soon as everything is configured well clients can connect to your server with your global Ip address (the sf::IpAddress-class has a member function for retrieving it).

13
Network / Get Number of Bytes before Receiving
« on: December 12, 2012, 07:56:35 pm »
Good evening,
I am new to SFML and want to write a network (server) application which works with Linux and Windows. Certainly the client is not written in C++ so I can't use the sf::Packet-class because I don't know how to implement the receive-funktion in other programming languages.
Therefore i want to send/receive std::strings. Unfortunately I don't know how many bytes I gonna receive when using socket selectors.
//Note: this snippet isn't tested but it shows my problem
std::string sData1;
std::size_t BytesReceived, BytesToReceive = 300;
sData.resize(301); //not nice. I would like to know how many bytes i need to reserve BEFORE calling the receive-method
client.receive((void*)sData1.c_str(), BytesToReceive, BytesReceived);
mfg isReady

Pages: [1]