1
Graphics / Movement and Views
« on: February 09, 2012, 12:49:09 am »
-nevermind, wrong-
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#ifndef BULLWHIP_INPUT_H
#define BULLWHIP_INPUT_H
#include <SFML/Graphics.hpp>
class bc_Input
{
public:
bc_Input();
bool bm_KeyHit(sf::Key::Code key);
bool bm_KeyDown(sf::Key::Code key);
int bm_MouseX();
int bm_MouseY();
void bm_init(sf::RenderWindow& app);
private:
sf::RenderWindow& App;
sf::Input& bv_input;
};
#endif
#include "Input.h"
bool bc_Input::bm_KeyDown(sf::Key::Code key)
{
return bv_input.IsKeyDown(key)
}
bool bc_Input::bm_KeyHit(sf::Key::Code key)
{
sf::Event event;
while(App.GetEvent(event) && event.Type == sf::Event::KeyPressed)
{
switch(event.Key.Code)
{
case key: return true; break;
default:
break;
}
}
}
void bc_Input::bm_init(sf::RenderWindow& app)
{
App = app;
bv_input = App.GetInput();
}
int bc_Input::bm_MouseX()
{
return bv_input.GetMouseX();
}
int bc_Input::bm_MouseY()
{
return bv_input.GetMouseY();
}
bc_Input::bc_Input()
{
bv_input = App.GetInput();
}