Jump to content
  • Advertisement
Sign in to follow this  
Sunsharior

How should i process about embedding a SDL2 game into QT to make a level editor.

This topic is 1392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone.

 

The video game engine i'm working on is amost complete. Right now i'm working on refactoring part i don't like. One of the part i do not like is the current level editor.

It's currently a seperate window that have the basic fonctionality (see screenshot). So i wants to make everything nicer and do a level editor using QT.

 

I want to make a basic QT Dialog that have embedded inside the game engine. However, i'm very confused about how i should do it. Right now, i'm struggling to make SDL2 work within QT and i'm not even sure if it's the right approche i'm doing. I'm currently able to draw with SDL2 within QT, but i really don't know how to make my game work inside.

 

Some detail: i'm using QT 5.3.x via Vs2012 (not qteditor). My game engine is an executable that use SDL2 for graphic, sound and key inputs. I've heard i might have problem with graphic rendering and sound, so i'm hesitant on how to proceed. Should i make my game engine a DLL to run within QT or is a .Exe okay? If more information is needed, i will give it.

 

As always, thank you very much for your time.

ps. Sorry for my english.

 

Share this post


Link to post
Share on other sites
Advertisement

Nothing prevents you from creating a window with SDL and capturing the input events inside it, while you use Qt for the second window.

But you probably want to render inside the window, in a frame of some sort, so you'll probably have work around this.

 

The first possibility that pops in my mind is to use Qt's OpenGL API, to get the rendering target and such, and return whatever you need to SDL2 so it can render in a QtWidget.

 

What you could do as weel is trying and turning an SDL_Surface into a QtImage, and only use SDL to render to that surface. I don't really know how to do that, but it may be more googleable.

Share this post


Link to post
Share on other sites

Thank you for your reply Dejaime. It helped me do the initial setup.

 

After fiddling this weekend, and doing additional researches, i've partially solved my problem. I'm not done yet but i've successfully draw something in QT using Sdl2. Now, what i'm missing is just the Inter-process communication between the QT application and my game. I should be able to do that during this week.

 

So, it's looking good, at the moment :).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!