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

Author Topic: Qt 5 & SFML 2 integration with events  (Read 2649 times)

0 Members and 1 Guest are viewing this topic.

Simonge

  • Newbie
  • *
  • Posts: 2
    • View Profile
Qt 5 & SFML 2 integration with events
« on: July 26, 2015, 09:15:01 pm »
Hello everyone.

I was working on a level editor, as such I decided to use Qt for native widgets and dialogs.
Unfortunately, SFML-specific events don't work out of the box in Qt 5.

I rolled a hacky solution that translates Qt events into SFML events. Left/right control, shift, system and alt buttons are currently undifferentiated as Qt sees them as one button, but everything else seems to work well.

This is based on the Qt + SFML 1.6 tutorial and this article, I simply got rid of multiple inheritance, added signals instead of forcing the user to inherit from Canvas and added code that translates events.

https://bitbucket.org/Simonge/qsf

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Qt 5 & SFML 2 integration with events
« Reply #1 on: July 26, 2015, 10:41:39 pm »
Quote
I rolled a hacky solution that translates Qt events into SFML events.
And why don't you just use Qt events directly?
Laurent Gomila - SFML developer

Simonge

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Qt 5 & SFML 2 integration with events
« Reply #2 on: July 26, 2015, 11:39:07 pm »
And why don't you just use Qt events directly?

I wanted to have the ability to try out a level inside of the editor. If I were to use Qt events directly, I would have to implement input logic twice as the game itself doesn't use Qt. Basically, I have a "Play" button inside of the editor that allows me to jump in and check things out without having to "run" the game.

 

anything