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

Pages: [1] 2
1
Network / Re: problems with sf::TcpSocket
« on: December 29, 2013, 07:14:48 pm »
So the question is : what ip i must write?

You use whatever IP address the host (server side) is at. If the IP address is 81.25.53.137, then on the client side you use that. If it's something else, then you use that. However, you just cannot use some arbitrary IP address. That is not how networking works.

Also, use a port other than 21 (FTP).
But it isnt work with this ip adress and I dont know why. If I ask program to show remote ip after connection fail, it s show me 0.0.0.0 but I told him "search 812553137 adress. I m god here." It doesnt like me.
I chose another port (15 and 46644) finaly - no changes.

2
Network / Re: problems with sf::TcpSocket
« on: December 29, 2013, 06:01:16 pm »
Go to cmd and type ipconfig or call system("ipconfig") in your program.
Then it will show you the IPv4 address. Use that address.

It`s show me two IPv4 starts with 10.40.*.* it`s local network, isnt it? It works on my computer, but if separate it on different computers it`s show again 0.0.0.0 (and remote port = 0)

3
Network / Re: problems with sf::TcpSocket
« on: December 29, 2013, 01:25:28 pm »
There are two programms (server and client) that recived information from each other. when server(at first computer) and client (at another computer)active they must send some information. But connection always fail. Client says remote adress 0.0.0.0  and remote port = 0. i think there is trouble in adress.
So the question is : what ip i must write? my IPv4 is 81.25.53.137 (that i found in the internet) (or maybe local ip that i found  by cmd in windows /netstat) or something another?
Also it doesnt work with my ip (IPv4), but if i run server and client on the same computer with my local  ip, it works. I need working at another computers.

4
Network / problems with sf::TcpSocket
« on: December 28, 2013, 08:38:59 pm »
I wrote two comments where it`s a trouble. I`ll be realy happy if u help me. I love to make fails at start of learning something.
It works if i run it on my computer, but if i run it on the computer and laptop it isn`t works..

Windows 7, Visual studio 10.

// SERVER
int main()
{

        std::cout<<"It`s start to work"<<std::endl;

sf::TcpListener listener;

listener.listen(21);

short int port = listener.getLocalPort();
std::cout<<port<<std::endl;  


sf::TcpSocket socket;
listener.accept(socket);
std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl;


getch();
}



// CLIENT


int main(){
sf::TcpSocket socket;
int port, port2;


sf::Socket::Status status = socket.connect("ip", 21);   /* Is there i need to choose my ip? Or some specific
adress, becouse it doesn`t work with my ip adress : remote port show zero and no messages on the server
*/


if (status != sf::Socket::Done)
{
   std::cout<<"error";
}

else {
        std::cout<<"done"; }


port = socket.getRemotePort();
std::cout<<"Remote "<<port<<std::endl;   /* here remote port show zero (i told about it) */
port2 = socket.getLocalPort();
std::cout<<"Local "<<port2<<std::endl;


getch();
}

5
Window / Re: Strange thing with mouse
« on: December 06, 2013, 06:16:19 pm »
Thank you so much=)

6
Window / Strange thing with mouse
« on: December 06, 2013, 06:06:27 pm »
Hi guys. I have a little problem. It happens when i`m moving picture in the window and a mouse cursor (in that window) at the same time.. Picture starts to move rather quickly than when coursor don`t move or moving in not my window.. It`s normal?

Maybe it depends ..

#include <SFML/Graphics.hpp>




int main()
{


 
        sf::RenderWindow window(sf::VideoMode(380, 390), "Happines!");
 
       
        sf::RectangleShape s;
        s.setSize(sf::Vector2f(10, 50));
        s.setPosition(10, 50);
        s.setFillColor(sf::Color::Red);


    while (window.isOpen())
    {
       
                 

               
               

               

        sf::Event event;
        while (window.pollEvent(event))
        {

                       

            if (event.type == sf::Event::Closed)
                                window.close();

                       
                       
                       

                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
                               
                                s.move(1, 0);
                               
                               
                        }

               
       
       
                }
               
                window.clear(sf::Color::White);
                       
               
                window.draw(s);
                window.display();
               
                }
       
    return 0;
        }

Video :
http://www.youtube.com/watch?v=3QqN92AKbM4&feature=youtu.be

7
Graphics / Re: Coordinates of Rect. I don`t know how to find them.
« on: November 17, 2013, 05:46:52 pm »
Yes, that`s stupid, but when i asked, u said nothing aboute vector 2f..

8
Graphics / Re: Coordinates of Rect. I don`t know how to find them.
« on: November 17, 2013, 04:41:12 pm »
Don`t be so sad.. English isn`t my first language, so it probably my mistake.. Thank you anyway for trying to help  ;)

9
Graphics / Re: Coordinates of Rect. I don`t know how to find them.
« on: November 17, 2013, 04:04:20 pm »
eXpl0it3r, thank you

10
Graphics / Re: Coordinates of Rect. I don`t know how to find them.
« on: November 17, 2013, 08:43:47 am »
Nope, i knew it. Thank you. The question is how
shape.getPosition();
   work..

Like
sf::RectangleShape shp(sf::Vector2f(50, 50));

        shp.setPosition(0, 334);

        shp.setFillColor(sf::Color::Red);
       
       
       
       
        shp.getPosition(); // [color=red]after that i need X and Y of my rectangle in the console.. [/color]

       
        while (window.isOpen())
    {
    and lalala..
Probably i try to write something like that :
//
int x, y;
x=y=0;
shp.getPosition(x, y);
std::cout<<x<<y;

But getPosittion don`t call any arguments..

11
Graphics / Re: LoadFromFile Problem
« on: November 16, 2013, 10:10:08 pm »
Maybe you should try put your image into the directory of your project (near your source like "source.cpp") and write only
if (!SFigur.loadFromFile("Spielfigur.png"))
{
//errore
}
It works by myself..

12
Graphics / Coordinates of Rect. I don`t know how to find them.
« on: November 16, 2013, 10:02:56 pm »
Pls help me with searching the function, that gives you coordinates of rect at the moment of asking( now it`s a rectangle shape ). I want to find thems and change it if any button is pressed. It probably the same as func :   s.move(X, Y), but it isnt what i need.. I looked at manuals and documentation and nothing more than   
const Vector2f& sf::Transformable::getPosition   (      )    const
get the position of the object

Returns
Current position
See Also
setPosition
There`re allot of information, so my young brain need a help.. Please :)
Oh, i have SFML 2,1.

13
Graphics / Re: Fail with loading textures. Texture doesn`t like me.
« on: November 10, 2013, 04:11:39 pm »
NEXUS, thank you very much for your help!
Pls, can u help me with a little problem?
How to link directory with picture for my project? :)

14
Graphics / Re: Fail with loading textures. Texture doesn`t like me.
« on: November 10, 2013, 03:19:23 pm »
yeap, u`re correct.

15
Graphics / Re: Fail with loading textures. Texture doesn`t like me.
« on: November 10, 2013, 02:47:40 pm »
1. i got SFML 2.1 for Visual Studio 10 (Express) c++ , x32 .
 i chose all cofuguration. Link directory of libs and includes, write full list of lib files in (linker->input->additional dependenciens) how it was in the tutorial. And write SFML_STATIC.
2. Microsoft Visual C++, probably i don`t know really version or name of my compiler.. Sorry=(
3.  In Debag doesn`t works. In release works. I think it must works in both types..
4. full list of files (.lib) in the directory from that website..

1>  "/OUT:C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.exe" "/LIBPATH:D:\SFML-2.1\lib" "sfml-audio.lib" "sfml-audio-d.lib" "sfml-audio-s.lib" "sfml-audio-s-d.lib" "sfml-graphics.lib" "sfml-graphics-d.lib" "sfml-graphics-s.lib" "sfml-graphics-s-d.lib" "sfml-main.lib" "sfml-main-d.lib" "sfml-network.lib" "sfml-network-d.lib" "sfml-network-s.lib" "sfml-network-s-d.lib" "sfml-system.lib" "sfml-system-d.lib" "sfml-system-s.lib" "sfml-system-s-d.lib" "sfml-window.lib" "sfml-window-d.lib" "sfml-window-s.lib" "sfml-window-s-d.lib" /NODEFAULTLIB:msvcrt.lib /MANIFEST "/ManifestFile:Debug\project_SFML.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.lib" /MACHINE:X86 Debug\source.obj
1>sfml-graphics-s.lib(RenderStates.cpp.obj) : error LNK2038: обнаружено несоответствие для "_ITERATOR_DEBUG_LEVEL": значение "0" не соответствует значению "2" в source.obj
1>sfml-graphics-s.lib(Transform.cpp.obj) : error LNK2038: обнаружено несоответствие для "_ITERATOR_DEBUG_LEVEL": значение "0" не соответствует значению "2" в source.obj
1>C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.exe : fatal error LNK1319: обнаружено несоответствий: 2



What does it mean?

Pages: [1] 2