if (event.type == Event::KeyPressed) {
if (event.key.code == Keyboard::D) { p_move.x = 1; }
if (event.key.code == Keyboard::A) { p_move.x = -1; }
}
if (event.type == Event::KeyReleased) {
p_move.x = 0;
p_move.y = 0;
}
That lags:
if (event.type == Event::KeyPressed) {
if (event.key.code == Keyboard::D) { p_move.x = 1; }
if (event.key.code == Keyboard::A) { p_move.x = -1; }
}
if (event.type == Event::KeyReleased && event.type != Event::KeyPressed) {
p_move.x = 0;
p_move.y = 0;
}
Event::KeyReleased
called every time, while Event::KeyPressed
Idk why is that, but it is so uncomfortable and i can't realize it. (edited)KeyPressed
and KeyReleased
are not a pairif (event.type == Event::KeyPressed) {
if (event.key.code == Keyboard::D) { p_move.x = 1; }
if (event.key.code == Keyboard::A) { p_move.x = -1; }
}
if (event.type == Event::KeyReleased) {
p_move.x = 0;
p_move.y = 0;
}
That lags:
if (event.type == Event::KeyPressed) {
if (event.key.code == Keyboard::D) { p_move.x = 1; }
if (event.key.code == Keyboard::A) { p_move.x = -1; }
}
if (event.type == Event::KeyReleased && event.type != Event::KeyPressed) {
p_move.x = 0;
p_move.y = 0;
}
Event::KeyReleased
called every time, while Event::KeyPressed
Idk why is that, but it is so uncomfortable and i can't realize it. (edited)if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
// move left...
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
// move right...
}
(edited)if (event.type == Event::KeyPressed) {
if (event.key.code == Keyboard::D) { p_move.x = 1; }
if (event.key.code == Keyboard::A) { p_move.x = -1; }
}
if (event.type == Event::KeyReleased) {
p_move.x = 0;
p_move.y = 0;
}
That lags:
if (event.type == Event::KeyPressed) {
if (event.key.code == Keyboard::D) { p_move.x = 1; }
if (event.key.code == Keyboard::A) { p_move.x = -1; }
}
if (event.type == Event::KeyReleased && event.type != Event::KeyPressed) {
p_move.x = 0;
p_move.y = 0;
}
Event::KeyReleased
called every time, while Event::KeyPressed
Idk why is that, but it is so uncomfortable and i can't realize it. (edited)if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
// move left...
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
// move right...
}
(edited)if
and with sf::Keyboard::isKeyPressed
function.Windows.h
scancode function. Is it present in sfml?~/
^^ (edited)tmux-sessionizer.sh