SparrowInput/main.cpp
2015-07-17 20:04:19 +02:00

55 lines
1.5 KiB
C++

#include <iostream>
#include <SFML/Window.hpp>
#include "input.h"
using namespace std;
int main()
{
cerr << "Hello World!"<< endl;
sf::Window* window= new sf::Window(sf::VideoMode(400,200),"testSparrowInput");
Input myInput(window, "test.esk",2);
enum {ACTION_1,ACTION_2};
std::vector<int> myvector;
myvector.push_back(ACTION_2);
/* KeysMap* keymap = new KeysMap("test", 2);
keymap->setKeyBinding(ACTION_1,0,sf::Keyboard::A);
keymap->setKeyBinding(ACTION_1,1,sf::Keyboard::Z);
keymap->setTypeAction(ACTION_1,KeysMap::HOLD);
// cerr << keymap->getKeyBinding(ACTION_1,0) << endl;
cerr << keymap->getTypeAction(ACTION_1) << endl;
*/
//KeyBindings keybind(myvector,keymap);
//cerr << " Action : " << keybind.getPressedAction(sf::Keyboard::A) << endl;
myInput.setkeyBinding(ACTION_1,1,sf::Keyboard::A);
myInput.setkeyBinding(ACTION_1,2,sf::Keyboard::Z);
myInput.setkeyBinding(ACTION_2,1,sf::Keyboard::I);
myInput.setkeyBinding(ACTION_2,2,sf::Keyboard::O);
myInput.setTypeAction(ACTION_1, KeysMap::RELEASED);
myInput.test();
myInput.createContext("test", myvector);
myInput.setCurrentContext("test");
// myInput.reloadKeyBindings();
bool run = true;
while(run){
//myInput.updateEvents();
if (myInput.isCloseRequested()){
window->close();
run = false;
}
while (myInput.getAction() != NO_ACTION)
cout << "test " << myInput.getAction() << endl;
/* if (myInput.getAction() == ACTION_2)
cout << "hello" << endl;*/
window->display();
}
return 0;
}