Working on a messaging system for sf events

This commit is contained in:
MitchellHansen
2017-01-10 08:46:12 -08:00
parent 475a879b51
commit 3c91614f45
10 changed files with 249 additions and 29 deletions

30
include/Input.h Normal file
View File

@@ -0,0 +1,30 @@
#pragma once
#include <SFML/Graphics.hpp>
#include <list>
#include "Pub_Sub.hpp"
class Input : public SfEventPublisher {
public:
Input();
~Input();
// Keep track of keys that are not released
// Keep track of mouse up and downs in conjunction with dragging
// Keep track of joystick buttons
void consume_events(sf::RenderWindow *window);
void set_flags();
void dispatch_events();
private:
std::vector<sf::Keyboard::Key> held_keys;
std::vector<sf::Mouse::Button> held_mouse_buttons;
std::vector<bool> keyboard_flags;
std::vector<bool> mouse_flags;
private:
std::list<sf::Event> event_queue;
};