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

Author Topic: messing up with key events <_<  (Read 2028 times)

0 Members and 1 Guest are viewing this topic.

Razzeeyy

  • Newbie
  • *
  • Posts: 17
    • View Profile
messing up with key events <_<
« on: January 29, 2012, 02:27:09 pm »
Hi guys, what am I doing wrong?

Code: [Select]
               switch(Event.KeyEvent.Code)
                {
                    case sf::Key::Code::Num1:
                    {
                        SelectedColor=Black;
                        break;
                    }
                    case sf::Key::Code::Num2:
                    {
                        SelectedColor=Blue;
                        break;
                    }
                }


compiles with this error:
Quote
invalid use of ‘struct sf::Event::KeyEvent’


The Event object is obviously sf::Event Event..

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
messing up with key events <_<
« Reply #1 on: January 29, 2012, 02:32:05 pm »
Quote
Event.KeyEvent.Code

This should be "Event.Key.Code".

KeyEvent is the name of the struct, while Key is defined like this:
KeyEvent Key;
TGUI: C++ SFML GUI

Razzeeyy

  • Newbie
  • *
  • Posts: 17
    • View Profile
messing up with key events <_<
« Reply #2 on: January 29, 2012, 03:32:53 pm »
Oh, yeah. Thank you! :)