1
Window / [MAC OS X - SFML2] GetMouseX() after SetCursorPosition(x,y)
« on: December 09, 2010, 02:39:44 pm »
Any news on this fix? I really need it
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.
int WINAPI CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
// do sfml stuff
return 0;
}
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <map>
#include <math.h>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Shader");
// Create a clock to measure the total time elapsed
sf::Clock clock;
// Start the game loop
while (window.IsOpened())
{
// Process events
sf::Event event;
while (window.GetEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();
if (event.Type == sf::Event::KeyPressed)
{
// Escape key : exit
if (event.Key.Code == sf::Key::Escape)
window.Close();
if (event.Key.Code == sf::Key::S)
{
window.SetCursorPosition(400, 300);
printf("%d %d\n", window.GetInput().GetMouseX(), window.GetInput().GetMouseY());
}
}
if (event.Type == sf::Event::MouseMoved)
{
printf("%d %d\n", event.MouseMove.X, event.MouseMove.Y);
}
}
printf("%d %d\n", window.GetInput().GetMouseX(), window.GetInput().GetMouseY());
// Finally, display the rendered frame on screen
window.Display();
}
return EXIT_SUCCESS;
}
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <map>
#include <math.h>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Shader");
// Create a clock to measure the total time elapsed
sf::Clock clock;
// Start the game loop
while (window.IsOpened())
{
// Process events
sf::Event event;
while (window.GetEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();
if (event.Type == sf::Event::KeyPressed)
{
// Escape key : exit
if (event.Key.Code == sf::Key::Escape)
window.Close();
if (event.Key.Code == sf::Key::S)
{
window.SetCursorPosition(400, 300);
printf("%d %d\n", window.GetInput().GetMouseX(), window.GetInput().GetMouseY());
}
}
if (event.Type == sf::Event::MouseMoved)
{
printf("%d %d\n", event.MouseMove.X, event.MouseMove.Y);
}
}
// Finally, display the rendered frame on screen
window.Display();
}
return EXIT_SUCCESS;
}
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <map>
#include <math.h>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Shader");
// Create a clock to measure the total time elapsed
sf::Clock clock;
// Start the game loop
while (window.IsOpened())
{
// Process events
sf::Event event;
while (window.GetEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();
if (event.Type == sf::Event::KeyPressed)
{
// Escape key : exit
if (event.Key.Code == sf::Key::Escape)
window.Close();
}
if (event.Type == sf::Event::MouseMoved)
{
printf("%d %d\n", event.MouseMove.X, event.MouseMove.Y);
}
}
// Finally, display the rendered frame on screen
window.Display();
}
return EXIT_SUCCESS;
}
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL");
// Start game loop
while (window.IsOpened())
{
// Process events
sf::Event event;
while (window.GetEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();
// Escape key : exit
if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))
window.Close();
}
// Clear the depth buffer & color buffer
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
// Finally, display the rendered frame on screen
window.Display();
}
return EXIT_SUCCESS;
}