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

Pages: [1]
1
Window / Re: Centering mouse
« on: February 14, 2017, 09:03:59 pm »
Updated to latest version, now Im using 2.4.2 64 bit version compiled under VS 2015...and its definitely not a problem of my code, which manages my camera...made this little program:

#include <SFML\Graphics.hpp>
#include <iostream>

int main()
{
        sf::RenderWindow window(sf::VideoMode(1280, 720), "Test", sf::Style::Default);

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

                while (window.pollEvent(event))
                {
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                                window.close();
                }

                sf::Vector2i mousePosition = sf::Mouse::getPosition(window);
                sf::Mouse::setPosition(sf::Vector2i(640, 360), window);
                std::cout << sf::Mouse::getPosition(window).x << " " << sf::Mouse::getPosition(window).y << std::endl;

                window.clear();
                window.display();
        }
       
        return EXIT_SUCCESS;
}
 

...and bug is still there...on my laptop monitor it works fine but when I switch to second monitor and moves a mouse a little, it is centered at wrong position and stays there while not moving mouse.


2
Window / Re: Centering mouse
« on: February 13, 2017, 09:45:28 pm »
immediately after setPosition
std::cout << sf::Mouse::getPosition(window).x << " " << sf::Mouse::getPosition(window).y << std::endl;
 

Working on Windows 10 and sfml 2.4.0

3
Window / Centering mouse
« on: February 12, 2017, 01:37:43 pm »
Hi. Im using sfml for implementing fps style camera and Ive recently noticed some strange behaviour. Code structure looks like this

int main()
{
  sf::RenderWindow window(sf::VideoMode(1280, 720), "test");
  // ...
  // ...

  // main loop
  while(!exitLoop)
  {
      //...
     sf::Vector mousePosition = sf::Mouse::getPosition(window);
     sf::Mouse::setPosition(sf::Vector2i(640, 360), window);

     update(mousePosition);
    // ...
  }
}
 

The thing is I use laptop with another monitor. When I set laptop window as a main screen and run an app, everything works fine. But when I set my second monitor as a main screen, sometimes setting the mouse into the center of a screen actually sets the mouse position into slightly diffrent values like (639, 360), (640, 359) etc...which causes some small offset against the center and constantly moves my camera, even when Im not touching my mouse. Sorry if its some stupid mistake. Thanks for help.

4
General / 360 degree camera
« on: August 27, 2016, 03:23:19 pm »
Hi! In next couple of days Im starting to work on first big project and I want to ask about some tips and advices on how to correctly implement 360 degree camera (not sure about terminology). I want to achieve camera similar to adventures like Scratches, Process or Nikopol. Thanks!

Pages: [1]
anything