Hi guys. I am new to sfml, so i am still testing it.
First here is the beginning of my Game class:
class c_Game
{
private:
sf::RenderWindow* screen;
sf::Event* events;
c_Object* player;
c_Object* object;
float eTime;
const sf::Input input;
public:
c_Game()
{
screen = new sf::RenderWindow(VideoMode(800,600,32), "hi");
screen->UseVerticalSync(true);
player=new c_Object(0,0,100,100,sf::Color(0,255,0,100));
object=new c_Object(300,300,100,100,sf::Color(100,100,0,100));
events=new sf::Event();
input=screen->GetInput();
}
.
.
.
So, you can see it contains my window, events, my timer...and my sf::Input. And there is my problem: The function screen->(GetInput) returns a constant sf::Input. But i can't declare a const before, because i don't have my window yet.
Is there a way to get sf::Input without const?
Normally i wanted to handle my input like this:
if (input.IsKeyDown(Key::D))
{
player->Move(500*eTime,0);
}
If i leave out the variable input and use screen->GetInput() it works, but i don't think it's very efficient.
if (screen->GetInput().IsKeyDown(Key::D))
{
player->Move(500*eTime,0);
}