Skip to content

dabbertorres/Input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftInputManager

A C++11 input manager for SFML.

Pretty simple to use, and header-only, so nice and easy to include in a project.

#Example:

#include <SFML/System.hpp>
#include <SFML/Window.hpp>

#include "InputManager.hpp"

int main(int argc, char** argv)
{
	sf::Window window(sf::VideoMode(800, 600, 32), "SFML");
	
	swift::InputManager<sf::Keyboard::Key> keyboard;
	swift::InputManager<sf::Mouse::Button> mouse;
	
	keyboard.add(sf::Keyboard::Escape, [&window]()
	{
		window.close();
	});
	
	mouse.add(sf::Mouse::Right, [&window]()
	{
		window.close();
	});
	
	while(window.isOpen())
	{
		sf::Event event;

		while(window.pollEvent(event))
		{
			keyboard(event);
			mouse(event);
			
			switch(event.type)
			{
				case sf::Event::Closed:
					window.close();
					break;
				default:
					break;
			}
		}

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

#License MIT License

About

A C++11 input manager for SFML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages