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 - eliburgi

Pages: [1]
1
General / Re: InputManager(single KeyPress)
« on: February 26, 2014, 08:18:49 pm »
Ahh ok that makes things clear ;)
Maybe I should read the SFML book, but partly the structure is very complex(commands), even if the princip behind that is genius, I like the traditional way ;)

2
General / Re: InputManager(single KeyPress)
« on: February 26, 2014, 08:04:17 pm »
No you understood me false ;)
I know what Real-Time Input(sf::Keyboard) is, and at least something about events but if I want to detect a single Key press (for example: pressing the Space bar to jump) everywhere in the programm, so my idea was to create a class InputManager. Because so far I understood it, with RealTime Input I only can detect if a key is down but I canĀ“t detect a single Key press with it
But thanks for your patient and help ;)

3
General / Re: InputManager(single KeyPress)
« on: February 26, 2014, 07:33:42 pm »
Ok thanks that already helped a lot, but how do I transfer that to my class?
Because I want to be able to call InputManager::isKeyPressed(//key) in the whole game ;)

4
General / Re: InputManager(single KeyPress)
« on: February 26, 2014, 07:19:38 pm »
int the main:
while (mainWindow->pollEvent(event))
      {
         switch (event.type)
         {
            case sf::Event::Closed:
               mainWindow->close();
               break;

            case sf::Event::KeyPressed:
               InputManager::Update(event);
         }
      }

5
General / Re: InputManager(single KeyPress)
« on: February 26, 2014, 07:18:48 pm »
Ok thanks, but heres some example:

void InputManager::Update(sf::Event event)
{
   mEvent = event;
}

bool InputManager::isKeyPressed(sf::Keyboard::Key key)
{
   if (mEvent.key.code == key)
      return true;

   return false;
}

6
General / InputManager(single KeyPress)
« on: February 26, 2014, 07:13:01 pm »
Hello guys,
I am new to SFML, but have some experience in C++. I am not new to Game programming, because I have already created some games with C# and Java.
So my question is: How do I detect a single Key press in SFML?
I want to create a class InputManager, and I already read about Events and Real-Time Input.
Sry for my english, i am from Austria ;)

Pages: [1]
anything