Skip to content

Commit

Permalink
Fix key codes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeDralliam committed Nov 1, 2015
1 parent dc3a186 commit e1bf506
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions OcsfmlWindow/ocsfml_window_stub/Keyboard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,26 @@

#include <SFML/Window/Keyboard.hpp>

custom_enum_conversion( sf::Keyboard::Key );
custom_enum_affectation( sf::Keyboard::Key );
namespace camlpp
{
template<>
struct affectation_management<sf::Keyboard::Key>
{
static void affect(value& v, sf::Keyboard::Key d)
{
v = Val_int(d + 1);
}
};

template<>
struct conversion_management<sf::Keyboard::Key>
{
sf::Keyboard::Key from_value( value const& v)
{
return static_cast<sf::Keyboard::Key>( Int_val( v ) - 1 );
}
};
}


#endif

0 comments on commit e1bf506

Please sign in to comment.