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

Pages: [1]
1
General discussions / Re: The Steam Direct fee is $100
« on: July 11, 2017, 05:42:37 pm »
I hope this stops asset flippers long-term. Unless they have thousands of dollar in bank.

2
SFML projects / SFML + RakNet example
« on: July 11, 2017, 05:37:52 pm »
I recently made a semi-fully working SFML + RakNet example on Github so other people can learn from example. ;D

You can play as a rectangle and see other people (Who is automatically blue)
Other people will automatically disappear on leave or disappear after timeout and there's more functionality to it, too!

I hope this helps people looking for an example
https://github.com/vertchrite/SFML-RakNet-Example/blob/master/main.cpp

3
Network / Re: IpAddress turns into "0.0.0.0" in vector?
« on: April 07, 2017, 02:57:23 pm »
Did you create a new project to test my code?

I recommend you check your project settings, to make sure you're not mixing debug and release modes.
Yes, I created a new project with the same project settings to test the code.
(It's compiled using the way to compile .cpp programs on linux with command-line)

4
Network / Re: IpAddress turns into "0.0.0.0" in vector?
« on: April 07, 2017, 02:06:57 pm »
You should also print cilents.size() (maybe the address you push to the array is not at position 0 for some reason).

And it's client, not cilent ;D
It prints out a size of "1" right after the push-back
Oh I always thought it was "cilent"  :P

Does this example work for you?

#include <SFML/Network.hpp>
#include <vector>
#include <iostream>

int main()
{
        std::vector<sf::IpAddress> clients;
        sf::IpAddress test(10, 0, 0, 1);
        std::cout << test << "\n";
        clients.push_back(test);
        std::cout << clients.back() << "\n";
}

It seems to run fine on my end.

That's strange, they both print out "10.0.0.1" fine
(If it helps, I also tried the "back()" method instead of "[ 0 ]" and that returns 0.0.0.0, too)

5
Network / IpAddress turns into "0.0.0.0" in vector?
« on: April 07, 2017, 02:48:09 am »
I've been using Udp and trying to find a way to handle cilents.
Right now I'm just using a vector of ip addresses to hold ips that send stuff (std::vector<sf::IpAddress> cilents)

(Snippet of code)
if(socket.receive(packet, new_cilent, port) != sf::Socket::NotReady){
    std::cout << new_cilent << std::endl; //<-- This prints out actual ip address
    if(cilents.empty()){
        cilents.push_back(new_cilent);
        std::cout << cilents[0] << std::endl; //<-- This prints out "0.0.0.0"
    }

 

Are ip addresses unable to work with vectors or was it something wrong on my end?
Thanks!

6
General / Deleting RectangleShape pointer crashes window?
« on: October 08, 2016, 12:13:45 am »
Hello!
I'm starting to get into the feel of using pointers and attempted making a RectangleShape using them.
It worked, I was able to make it be displayed, but when I tried deleting it with a Keyboard event the Window proceeded to crash with "has stopped working"
Any reason this is happening and how to fix it?

int main() {
        RenderWindow window(VideoMode(800,600), "Game");
        window.setFramerateLimit(60);


        RectangleShape * Obj1 = new RectangleShape(Vector2f(40, 40));
       

        while (window.isOpen()) {

                Event event;
                while (window.pollEvent(event)) {
                        switch (event.type) {
                                case Event::Closed:
                                        window.close();

                                case Event::KeyPressed:
                                        if (Keyboard::isKeyPressed(Keyboard::Escape))
                                                window.close();

                                        else if (Keyboard::isKeyPressed(Keyboard::W))
                                                delete Obj1;

                        }

                }
                window.clear(Color::Red);
                window.draw(*Obj1);
                window.display();
               
        }
        return 0;
}

 

Pages: [1]