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

Author Topic: Integrating SFML into existing engine + few other questions  (Read 2961 times)

0 Members and 1 Guest are viewing this topic.

Koobazaur

  • Newbie
  • *
  • Posts: 28
    • View Profile
So I just skimmed the tutorials, documentation and few quick forum searches and first of all - great job! SF seems so easy to get set up and provides a nice (altho a little basic) set of features.

That being said, I have my own engine I have been working on for a while and was thinking of integrating some parts of SFML in order to enhance cross-platform compatibility (windowing) and add new features (audio, threading, networking). So I have a few questions:

1) Firstly I assume I can just use parts of SFML (like windows, graphics) without the overhead/dependency on the rest of the stuff by including appropriate headers, right? So if I use SFML for JUST audio or networking I wont also need to include all the OpenGL libs, correct?

2) My engine is a 3D using DirectX9, but I would like to use SFML for Windowing and Events support - is that an option? I saw in the 2.0 tutorials that you can now create a Win32 window and then bind it to SFML (rather than the other way around), so I could still use the HWND for D3D, while keeping SFML for events.

But this is a bit cumbersome and takes away from cross-platform compatibility. Could I still use SFML method of creating windows and get the HWND for DX that way (if on windows)? And I also read somewhere that SFML creates an OpenGL context with every window, would that clash with my DX implementation? What if I tried to render DX and SFML to the same window (i.e. use SFML for 2D gui while DX for the 3D viewport)? If that is an issue, could I create non-OpenGL windows purely for DX and a separate "toolbar" window purely for SFML?

3) One feature sorely lacking in my engine is a good GUI system, are there any options for SFML? I saw SFUI but it only provides very basic widgets (Label, Text, Button) which is coincidentally all I have so far in my own engine, so there would be no benefit to using SFuI over it at this point.

4) Ignoring D3D, and if I was sticking to purely 2D games, what is SFMLs viability as a potential future iOS / Android platform? I read that this support is planned, but when could I expect that? I saw some people have already been experimenting with porting with some interesting, but mixed results.

Thanks for answering my queries! I did search the forums and found only partial answers (and many of those pre-2.0) so just wanted to double check :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Integrating SFML into existing engine + few other questions
« Reply #1 on: May 17, 2012, 10:05:19 am »
1) Yes

2) An SFML window always has an OpenGL context, but it should be ok if you keep it deactivated. I don't think you can mix OpenGL and D3D smoothly in the same window. With SFML 2 you can do what you want: create the SFML window and retrieve its system handle (HWND) to pass it to D3D.

3) SFGUI (see its presentation in the Projects forum) is the most advanced GUI library made for SFML. But you can also use any other GUI library which has an OpenGL back-end, such as CEGUI.

4) I can't answer this kind of question :)
Laurent Gomila - SFML developer

Koobazaur

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Integrating SFML into existing engine + few other questions
« Reply #2 on: May 18, 2012, 06:39:56 am »
Hey thanks for the quick reply! That's good to hear about SFML 2; how do I disable the OpenGL context (or does it not get enabled if I never draw to it)? And I was actually just reading about Crazy Eddie GUI, looks like it would be a perfect fit for my engine :)


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Integrating SFML into existing engine + few other questions
« Reply #3 on: May 18, 2012, 07:53:54 am »
Quote
how do I disable the OpenGL context
window.setActive(false);
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: Integrating SFML into existing engine + few other questions
« Reply #4 on: May 20, 2012, 02:09:41 pm »
I don't get it. You want to have cross-platform with DX
You do know that windows is the only platform that runs it? Xbox if I remember correctly uses a specific deprecated direct x 9 version and so on.

I am just wondering what you ment with supporting multiple platforms.  Are you planning to also write a opengl backend to switch to if not on windows?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio