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

Author Topic: Is SFML Window Events Are Compatible WinForm Events  (Read 1724 times)

0 Members and 1 Guest are viewing this topic.

gokaysatir

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Is SFML Window Events Are Compatible WinForm Events
« on: September 20, 2015, 12:02:48 pm »
Hi,

I am using sfml nearly for 3 years, and i love it=) I am not an active form member since i can find nearly all answers about sfml. Now i am stuck in a situation.

I moved my sfml window into a winform control, following the way described here:
http://en.sfml-dev.org/forums/index.php?topic=9141.0

It works, i only had to cast hwnd like this (for those who might look for solution):

HWND hwnd = (HWND)(splitContainer1->Panel2->Handle.ToInt32());

After moving SFML RenderWindow into winControl, i didn't change the pollEvents function calls. I use them like this:

while (sfRenderWindow->pollEvent(event)){
  switch (event.type){
  case sf::Event::Closed:{
  sfRenderWindow->close();
  break;
  }
case sf::Event::KeyPressed:{
break;
}...

But it gets the events mismatched. When i move the mouse, renderWindow gets a leftMouse press event i guess.

How i can prevent this, or what i did wrong, thanks  :)

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Is SFML Window Events Are Compatible WinForm Events
« Reply #1 on: September 20, 2015, 12:11:08 pm »
But it gets the events mismatched. When i move the mouse, renderWindow gets a leftMouse press event i guess.

Have you recently updated SFML? If so it sounds like you got mismatched header/lib files as SFML recently added a few new events.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

gokaysatir

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Is SFML Window Events Are Compatible WinForm Events
« Reply #2 on: September 20, 2015, 12:22:11 pm »
Thanks for the reply :)

Yes i updated the SFML libraries few days ago. But i didn't change the poll events calling functions.

gokaysatir

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Is SFML Window Events Are Compatible WinForm Events
« Reply #3 on: September 20, 2015, 12:25:10 pm »
In addition: Your answer looks reasonable, i will check the libraries again now.

gokaysatir

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Is SFML Window Events Are Compatible WinForm Events
« Reply #4 on: September 20, 2015, 12:31:04 pm »
Thanks a lot, i replaced dll files again. Now mouse wheel press event matches There is one more mismatched event, and i know where to look :)