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

Author Topic: sfMouse_getPosition with sfRenderWindow*?  (Read 7422 times)

0 Members and 1 Guest are viewing this topic.

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
sfMouse_getPosition with sfRenderWindow*?
« on: May 01, 2012, 12:46:09 pm »
I have an sfRenderWindow*, but sfMouse_getPosition() wants an sfWindow*. I couldn't find any method to make/get an sfWindow* from an sfRenderWindow* without modifying the source. Is there an orthodox (and fast) method, or should I just hack CSFML?

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Re: sfMouse_getPosition with sfRenderWindow*?
« Reply #1 on: May 01, 2012, 12:52:41 pm »
Hm... trying casting from sfRenderWindow* to sfWindow*. I'll write the results here once I'm finished.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: sfMouse_getPosition with sfRenderWindow*?
« Reply #2 on: May 01, 2012, 01:02:57 pm »
If you'd use SFML with C++ it wouldn't matter since sf::RenderWindow is inherited from sf::Window.

I'm just curious what's the advantage of using C instead of C++?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Re: sfMouse_getPosition with sfRenderWindow*?
« Reply #3 on: May 01, 2012, 01:30:01 pm »
Ok, it works that way ^^

Well, I want to write a game in Haskell using SFML. So I make the rendering engine, keyboard and mouse handling and sound in sfml using C, because Haskell interfaces better with C, then with C++.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sfMouse_getPosition with sfRenderWindow*?
« Reply #4 on: May 01, 2012, 06:32:00 pm »
In fact there should be overloads for sfRenderWindow, I forgot to implement them. There's no clean workaround, any attempt to cast types produces undefined behaviour.
Laurent Gomila - SFML developer

 

anything