1
Window / [SFML 1.6]Not Getting KeyPressed events?
« on: November 20, 2011, 02:30:40 am »
So, I usually wouldn't resurrect a topic this old, but my problem is still the same, but I have more information .
So the problem seems to be when I pass an sf::Event reference to a function. When I take care of the event locally, everything is fine, but once I pass that reference to another function, things get a little weird.
I do not get key press events for any letters, numbers, symbols, spaces/carriage returns, or the escape key. Every other key (F1-F12, Ctrl, Alt, Delete, Arrow Keys, etc.) still work with key press, though.
Before you tell me to make a stripped down example, I did and here it is :
Same problem persists between the two. I didn't see any issue with KeyRelease, only KeyPress... So, help please ?
So the problem seems to be when I pass an sf::Event reference to a function. When I take care of the event locally, everything is fine, but once I pass that reference to another function, things get a little weird.
I do not get key press events for any letters, numbers, symbols, spaces/carriage returns, or the escape key. Every other key (F1-F12, Ctrl, Alt, Delete, Arrow Keys, etc.) still work with key press, though.
Before you tell me to make a stripped down example, I did and here it is :
Code: [Select]
#include <SFML/Window.hpp>
#include <iostream>
bool HandleEvents(sf::Event& event)
{
if(event.Type == sf::Event::Closed)
{
return false;
}
if(event.Type == sf::Event::KeyPressed)
{
return false;
}
return true;
}
int main()
{
sf::Window* window = new sf::Window(sf::VideoMode(600, 800, 32), "Test");
sf::Event event;
bool running = true;
while(running)
{
while(window->GetEvent(event))
{
running = HandleEvents(event);
}
}
return 0;
}
Same problem persists between the two. I didn't see any issue with KeyRelease, only KeyPress... So, help please ?