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.


Topics - anttton

Pages: [1]
1
Graphics / Sf::Text goes to left
« on: October 29, 2017, 08:41:44 pm »
Hello guys!
I have a problem when it comes to the text. The text goes to the left side when I type longer
sentences and I want it to the right side instead.
sf::Text::setPosition(this->window->getSize().x / 2 - sf::Text::getGlobalBounds().width / 2 - 30, this->window->getSize().y - sf::Sprite::getGlobalBounds().height - 280);


If you see the picture you will probably understand what the problem is :P

2
General discussions / IOS support?
« on: March 19, 2017, 08:47:37 pm »
Hello, I have started to think about to create a mobile game. I have read some old posts from 2013 and noticed that sfml had started to working on the ios function. I dont get it but have the sfml team fix so you can start to develop game to the ios?

3
SFML projects / Jump & Slide
« on: March 06, 2017, 09:52:07 pm »
Hello guys, this is my first project with SFML and im very proud of it:P
The game is a Jump & Slide game and are inspired by the game geometry dash.

Controls :
Run with the left and right arrow keys
Jump with space
Slide with the down arrow key
Join a room with the up arrow key

Game includes:
4 diffrent levels
Charachter design
Level system
2 Spells

Download the game : http://www.mediafire.com/file/6oa23tnqalqcyc8/Jump+%26+Slide++version+1.0.rar

Some screenshots



4
Graphics / Event, is it a diffrent between Debug and Release mode
« on: March 04, 2017, 03:19:05 pm »
Hello, I started to wondering if its a diffrent between Debug and Release when it comes to Sf::Event. When I run my program in debug mode the events are very fast(Like when I type a letter it will pop up fast). But in Release mode the events are so slow so I cant type a letter, I moust spam my keyboard around 5 - 10 seconds befor it pop up.
I wonder why it is so.

5
Graphics / Why does it delete the last charachter
« on: March 02, 2017, 05:46:32 pm »
Hello, I always get "out of range" when I delete a the invisble charachter. I dont know why I run into this error. I have search and include the s1.getSize so I can see how big the string is but I dosent seem to work.

S1 is a SF::string
CharachterName is a SF::Text


if (event.type == sf::Event::TextEntered)
                {
                                if (event.text.unicode == '\b' && s1.getSize() > 0)
                                {
                                        s1.erase(s1.getSize() - 1, 1);
                                        this->characterName->setString(s1);
                                }
                       
               
                                if (event.text.unicode < 128)
                                {
                                        s1 += static_cast<char>(event.text.unicode);
                                }              
                        else
                        {
                        }
                        break;
                }
 

6
Network / Send player Information through packets
« on: February 10, 2017, 09:48:52 pm »
Hey :D!

When I was working to send the player information (movement and animation) I ended up like, how should I send all these kind of stuff to the server and then send it to the other client on the server.
I rellay nedd some tips how I can send this kind of information to the server.
Should I try to send the whole main_player() class through a packet?

I should be were pleasent if I can get some advice, thanks!

7
Network / Packets send wrong information to the server?.
« on: February 07, 2017, 06:04:35 pm »
Hello guys!

I was wondering why the client  are not sending the information to server when I have typed socket->send(..);
I would be glad if someone could take a look at my code and give me suggestion whats wrong.
In the last pice of code in the server code, thats is were i get my "Error" and dont recive the packet

The SERVER CODE:
std::cout << "Server Running" << std::endl;

        //se om server får några connections från någon client, bara om dom pekar man kan säga att listener håller i connectins
        sf::TcpListener listener;
       
        //tar imot connections, så flera kan ta imot connections
        sf::SocketSelector selector;
       
        bool done = false;
       
        //clienterna som ansluter sig till servern
        std::vector<sf::TcpSocket*> clients;
        int Connected;
        unsigned short port;
        std::cout << "Type the portnumber:";
        std::cin >> port;
 
        //listenern hör till denna port alltså ervern
        listener.listen(port);

        selector.add(listener);
       

        while (!done)
        {
                if (selector.wait())
                {
                        if (selector.isReady(listener))
                        {
                                sf::TcpSocket *socket = new sf::TcpSocket;
                                listener.accept(*socket);
                               
                                                sf::Packet ready;
                                                bool isready = true;
                                                ready << isready;
                                                socket->send(ready);
                               
                                sf::Packet packet;
                                std::string id;
                                if (socket->receive(packet) == sf::Socket::Done)
                                        packet >> id;

                                std::cout << id << " Has connected to the room" << std::endl;
                                clients.push_back(socket);
                                selector.add(*socket);

                               
                                sf::Packet leave;
                                int dis;
                                if (socket->receive(leave) == sf::Socket::Done)
                                {

                                        leave >> dis;
                                        selector.remove(*socket);


                                        //std::cout << id << " " << "has left" << std::endl;
                                        std::cout << dis << std::endl;
                                }
                        }
                       
 


And this is what i want to send through my client to the server.
void Client::Leave()
{
        sf::Packet leave;
        int dis = true;
        leave << dis;
        socket->send(leave);
}
 

Pages: [1]
anything