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

Pages: [1]
1
Network / SFML TCP as server for MUD
« on: September 06, 2019, 08:12:44 pm »
Hello,

I want to make MUD (Multi User Dungeon) game and looking for best library for networking. The game would be text based RPG, without any heavy graphics, but with expanded command system, lot of items etc. World will be built from "rooms", each room has 4 possible exits, connected with other room. Is choosing SFML good option? Can it handle multiple connections at the same time and will it be hard to make such server with barely no experience?

2
Window / Combining multiple windows
« on: May 29, 2019, 11:33:14 am »
Hello, I am making a program which is a physical simulation. I would like to have big lattice with atoms, next to it, on right - plots and charts and on left - sliders and buttons with options. I am wondering if I can make 3 different classes, which contains separate windows and than just combine them with single, one, big window? Or maybe there is a better solution for that?

EDIT: Just found views tutorial - is it a correct way to do that?

3
Network / Web interface for C++ application
« on: November 07, 2018, 10:34:15 pm »
Hello. I have a program written in C++, but at this moment it works in console. I was using SFML for making graphic interface previously, but this time I want to try something new. My program is suppose to work on embedded system (like Raspberry Pi), so I won't have display screen for it. Instead of that, I wanted to make some web browser interface for it. User has to type Raspberry Pi IP in own browser, along with port (for example 192.168.48.5:8888) and than he should see the simple interface (not much, just a few buttons). After clicking button, certain things should happen in C++ program. Am I able to achieve that with SFML? Where should I search? Is it CGI/REST API?

Example: UV4L with it's webRTC server (it has interface I am looking for - https://i.stack.imgur.com/w5Yhz.png?fbclid=IwAR1UexTVjdM8rDe5O8apC6_lULzVMJsT9rL1qDk9mAjyEPqnVOFvBjZ5PyA)

Thanks for help

4
General / SFML as overlay for other window
« on: May 27, 2018, 04:12:10 pm »
Hello. I working on project, where I have some OpenCV window with transforms, draws etc. Is there an option to "embedded" this window into SFML project, so it would looks like an overlay?

5
Network / UDP Socket does not connect
« on: March 10, 2018, 12:03:10 am »
Hey, I want to send some packet which contains: command, pin number and value from my PC to Raspberry Pi via UDP. I made this code:

PC:
#include <SFML/Network.hpp>
#include <iostream>

int main() {

        sf::UdpSocket socket;
        socket.setBlocking(false);

        sf::Packet packet;
        sf::String command = "write";
        sf::Uint16 pin = 23;
        sf::Uint16 value = 0;

        packet << command << pin << value;

        sf::IpAddress recipient = "192.168.1.102";
        unsigned short port = 54000;

        while (1) {
                if (socket.send(packet, recipient, port) != sf::Socket::Done)
                {
                        std::cout << "Couldn't send" << std::endl;
                }
                else {
                        std::cout << value << std::endl;
                        value++;
                }
        }


        return 0;
}

Rpi:
#include <SFML/Network.hpp>
#include <iostream>

int main() {

        sf::UdpSocket socket;
        socket.setBlocking(false);

        if (socket.bind(54000) != sf::Socket::Done)
        {
                std::cout << "Cannot bind socket" << std::endl;
        }

        sf::Packet packet;
        sf::IpAddress remoteIP = "192.168.1.101";
        unsigned short remotePort = 54000;
       
        while (1) {
                if (socket.receive(packet, remoteIP, remotePort) == sf::Socket::Done) {
                        std::cout << "Got it" << std::endl;
                        sf::String command;
                        sf::Uint16 pin;
                        sf::Uint16 value;

                        packet >> command >> pin >> value;
                        std::cout << "Command: " << command.toAnsiString().c_str() << " " << pin << " " << value << std::endl;
                }
                else if (socket.receive(packet, remoteIP, remotePort) == sf::Socket::NotReady) {
                        std::cout << "Some error while recieving" << std::endl;
                }
        }


        return 0;
}
 

But I have some error while running both programs, cause it says packet is sent from PC, but it's still "Some error while recieving" on Rpi. What thing I failed and missunderstand?

6
Graphics / Problem with text
« on: June 19, 2017, 06:48:33 pm »
Hey. I have a code:

Quote
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>
#include <iostream>

using namespace sf;
int main()
{
   
   sf::RenderWindow window(sf::VideoMode(320, 240), "Font Test");
   Font font;
   font.loadFromFile("ditr.ttf");
   Text text;
   text.setFont(font);
   text.setString("Hello World");
   text.setFillColor(Color::Red); //Maybe a color
   text.setCharacterSize(24);

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

      }
      text.setPosition(250, 250);
      window.clear(Color::White);
      window.draw(text);
      window.display();
   } //while
   return 0;
}

But when I compile, I have a white screen, without text. Can you tell me why?

7
General / Working in console, showing in window
« on: June 10, 2017, 11:39:16 pm »
Hello,

I just started to learn SFML and have to do a project for my university. The task is to work with console and SFML window at the same time, using object orientated C++. For example I want to have menu in my console:

1. Draw circle
2. Draw rectangle
...

And when I type 1 in console, the SFML window updates and show circle. I don't know how to achieve that, because in every course of SFML I saw while loop for displaying window. It prevents from using console, unless I close the window. I need them both opened. I have two classes:

Scheduler -> while loop for taking numbers from console
SFMLWind -> for displaying the primitive in window

But I totaly don't know how to connect them to work simultanously. Can you show me the way? What I need to learn?

EDIT:

I've heard about threds - do I need them here?

Pages: [1]
anything