Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - Cyntalan

Pages: [1]
1
Window / Input usage out of scope
« on: August 18, 2008, 08:46:52 pm »
So I guess what I was getting at is that this is something that's meant only to be declared in scope. Declaring the standalone input variable within any function that needs it.

Basically, calling the line sf::Input &Input = App.GetInput(); at some point in the beginning of any function that would like to use it. Is that about right?

2
Window / Input usage out of scope
« on: August 18, 2008, 07:39:26 pm »
Maybe I'm confused on the whole process of how I should be using it, but the reference information provided left me with slightly vague usage in my confusion. Not to mention this has got to be something that has been done before, as no one REALLY makes their entire program in one giant main. :lol:

The reference documentation and tutorials for the whole process of declaring and using sf::Input seems to rely on being called within the scope of a single function. Is there a method in which this class type can be declared out of scope and loaded within a function for other functions to use? Maybe this is something a little rudimentary, but I'm totally at a loss at this point.

What I'd like to do is something akin to:

Code: [Select]

sf::Input *Input;

void initInput(sf::RenderWindow *a)
{
   Input = a->GetInput();
}


But it claims to want a constant, which means I can't exactly declare it out of scope AND load it. Is this the wrong way to go about it, or is there a way to do this? Or should I just be calling this in scope at the beginning of each function I need it in, with it being destroyed at the end of the function?

Pages: [1]
anything