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

Pages: [1]
1
General discussions / idea needed
« on: April 18, 2015, 10:20:32 am »
Hello !

I need to do a server, but ideas are not comming ...
The server must accept new connections and pair clients 2 by 2.
After the server understands that those 2 clients must be paired, server accept package from one client and send to the other one.

Let's say that client1 connects to my server and client2 connects to my server.
They all send a string so my server could recognise them.Based on that string, my server knows that if client1 sends a pack, then the server must send that pack to client2, and if client2 sends a pack, then it must be send to client1.

Anyone have some ideas on how to build this thing ?
Thank you !  ;)

2
Network / Extracting Ip adress from a file
« on: March 12, 2015, 09:19:48 pm »
I have made a client that needs to connect to an IP adress that is stored in a file.
The file contains only the IP adress.
I have extracted the IP adress character by character and store it into a std::string.
The string is passed in the connecting function and doesn't work.

Here is the code :

#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <iostream>
#include <fstream>


int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
        sf::RenderWindow window(sf::VideoMode(800, 400), "The Game" );

        sf::Font font ;
        sf::Text text ;

        std::string IP ;  //The string that will be passed as the IP adress
        std::ifstream file_in( "IP.txt" ); //The file that contains the IP adress
        char input_line ;

        sf::TcpSocket socket_client ;

        font.loadFromFile( "Sansation.ttf" );
        text.setFont( font );
        text.setCharacterSize( 20 );
        text.setColor( sf::Color::White );
       
        while( file_in.get( input_line ))  //Extracting char from the line in the file
        {
                IP += input_line ;
        }
        file_in.close() ;

        sf::Socket::Status status_client = socket_client.connect( IP , 31111 );

        //In the line above, if I pass the IP adress as "192.168.10.10" instead of IP, it will connect

        if( status_client == sf::Socket::Done )
        {
                text.setString( "Connected" );
        }

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

                 window.draw( text );

                 window.display();
        }

    return 0;
}

3
General discussions / a rummy game
« on: June 26, 2014, 10:35:53 pm »
how much does a game of rummy cost, whrited with sfml ?
can anyone estimate ?

4
Graphics / Sprite
« on: November 17, 2013, 11:37:08 am »
So I have my class :

class myClass{
private :
sf::Sprite my_sprite;
public :
void set_position( sf::Vector2f my_vector ) { my_sprite.setPosition( my_vector ); }
}

in main I have :

myClass class ;
sf::Vector2f someVector ;

someVector.x = (float) 50 ;
someVector.y = (float) 100 ;

class.set_position( someVector ) ;   //DOES NOT WORK. WHEN I DRAW THE OBJECT , THE POSITION IS STILL 0, 0

5
General / resources
« on: July 28, 2013, 08:23:18 pm »
why the programas whrited in SFML consume lots of resources?
for example even a symple window consumes 40% RAM (I have 4GB).

6
Graphics / sprites
« on: April 27, 2013, 07:56:43 pm »
So I have two sprites.

Window.draw(sprite1);
Window.draw(sprite2);

The problem is when I drag the first shape, over the second shape, the second shape overlaps the first shape.

I've tried to redraw the first shape when dragging but with no results.
I'm using SFML 2.

7
General / mouse click's
« on: April 01, 2013, 01:11:07 pm »
Can anyone help me with a function that can count mouse left click's using SFML 2 ?
Thank you !

Pages: [1]