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

Pages: [1]
1
Thanks for replying, you understand correctly. I, too, was surprised it doesn't.

I don't understand how to proceed with your two-step process.
Does 'get a handle to the terminal window' refer to a SFML function/process or a more general C/++ function/process?
I would really appreciate any more help you could give me (e.g. specific search terms or documentation)?

2
EDIT: I had originally posted this in the Window forum. But I moved it after realising that I'm using the Graphics package (not the Window package) and I think that it is more likely that there is a general solution to this kind of problem.

I'm trying to write a program for manually recording some data. Some of the entry is in the command line with a basic menu system, but I'm using SFML for pop-up windows to record location data.
The problem is that when the window closes, the cursor doesn't return to the command line automatically. I have to manually move the mouse and click on the terminal before being able to enter keyboard input for the menu system on the command line. Is there a way so that this happens automatically?

I haven't been able to find any results on this topic by searching Google or this forum.
Any help or guidance would be greatly appreciated.

This is a simplified version that demonstrates the essence of the menu system and pop-up window.
#include <SFML/Graphics.hpp>
#include <iostream>

int locationCoordinates[2] = {0};

void locationWindow()
    {
    sf::RenderWindow window(sf::VideoMode(800, 600), "");
    window.setFramerateLimit(60);
    window.requestFocus();
   
    while (window.isOpen())
        {
        sf::Event event;
       
        while(window.pollEvent(event))
            {
            if (event.type == sf::Event::Closed)
                window.close();
            else if (event.type == event.MouseButtonPressed)
                {
                sf::Vector2i location = sf::Mouse::getPosition(window);
                locationCoordinates[0] = location.x;
                locationCoordinates[1] = location.y;
                window.close();
                }
            }
        window.clear(sf::Color::White);
        window.display();
        }
    }

int main()
    {
    bool done = false;
    int input = 0;
       
    while (done == false)
        {
        std::cout << "1. Locate" << std::endl;
        std::cout << "2. Exit" << std::endl;
        std::cin >> input;
        if (input == 1)
            {
            locationWindow();
            std::cout << locationCoordinates[0] << ", " << locationCoordinates[0] << std::endl;
            }
        else if (input == 2)
            done = true;
        }
       
    return 0;
    }
 

Details: SFML 2.4.2, Mac OS Sierra 10.12.6, Xcode 8.3.3

3
EDIT: Moved to General after realising that I have used the Graphics package not the Window package and also that the solution is more likely to be of a general type as opposed to something specific to the Graphics library.

I'm trying to write a program for manually recording some data. Some of the entry is in the command line with a basic menu system, but I'm using SFML for pop-up windows to record location data.
The problem is that when the window closes, the cursor doesn't return to the command line automatically. I have to manually move the mouse and click on the terminal before being able to enter keyboard input for the menu system on the command line. Is there a way so that this happens automatically?

I haven't been able to find any results on this topic by searching Google or this forum.
Any help or guidance would be greatly appreciated.

This is a simplified version that demonstrates the essence of the menu system and pop-up window.
#include <SFML/Graphics.hpp>
#include <iostream>

int locationCoordinates[2] = {0};

void locationWindow()
    {
    sf::RenderWindow window(sf::VideoMode(800, 600), "");
    window.setFramerateLimit(60);
    window.requestFocus();
   
    while (window.isOpen())
        {
        sf::Event event;
       
        while(window.pollEvent(event))
            {
            if (event.type == sf::Event::Closed)
                window.close();
            else if (event.type == event.MouseButtonPressed)
                {
                sf::Vector2i location = sf::Mouse::getPosition(window);
                locationCoordinates[0] = location.x;
                locationCoordinates[1] = location.y;
                window.close();
                }
            }
        window.clear(sf::Color::White);
        window.display();
        }
    }

int main()
    {
    bool done = false;
    int input = 0;
       
    while (done == false)
        {
        std::cout << "1. Locate" << std::endl;
        std::cout << "2. Exit" << std::endl;
        std::cin >> input;
        if (input == 1)
            {
            locationWindow();
            std::cout << locationCoordinates[0] << ", " << locationCoordinates[0] << std::endl;
            }
        else if (input == 2)
            done = true;
        }
       
    return 0;
    }
 

Details: SFML 2.4.2, Mac OS Sierra 10.12.6, Xcode 8.3.3

Pages: [1]
anything