SFML community forums

Help => Window => Topic started by: Train on August 26, 2009, 03:22:25 am

Title: Possible to embed a rendering window inside a window
Post by: Train on August 26, 2009, 03:22:25 am
Is it possible to embed a rendering window inside a window?

As in a viewport inside a map editor.

Like this
(http://www.dbarnes.com/game-map-editor/simple-game-map-editor-1.png)
Title: Possible to embed a rendering window inside a window
Post by: crazy2be on August 26, 2009, 04:46:04 am
You would want to use something like wxWidgets to make the window and the controls on the left, then integrate that with a SFML OpenGL rendering on the right. You can read the tutorial (http://www.sfml-dev.org/tutorials/1.5/graphics-wxwidgets.php) on how to do with with wxWidgets, you can use other GUI libraries as well.
Title: Possible to embed a rendering window inside a window
Post by: Train on August 26, 2009, 07:03:14 am
yay, exactly what I wanted....but now I remember how much I hate w32's window code
Title: Possible to embed a rendering window inside a window
Post by: Meltra Bour on August 26, 2009, 08:29:28 am
Aldo it would be easier and more efective using QT (or wxWidgets), you could also make your own gui in sfml and use views to create the different maps ....
http://www.sfml-dev.org/tutorials/1.5/graphics-views.php

We used the views for our first editor but atm we are switching to qt to manage/edit texture maps, scripts, shaders and so on ...
Title: Possible to embed a rendering window inside a window
Post by: Hiura on August 26, 2009, 10:56:16 am
@Meltra Bour : QT == QuickTime ; Qt == nokia's lib.
Title: Possible to embed a rendering window inside a window
Post by: Laurent on August 28, 2009, 02:15:15 pm
If you just want to separate drawing areas, the sf::View class has been improved in SFML 2 to allow that.

Otherwise, using SFML together with Qt or wxWidgets will do the job.
Title: Possible to embed a rendering window inside a window
Post by: Train on August 29, 2009, 08:03:10 pm
Switched to Qt but am having a few issues

My EditorCanvas extends QSFMLCanvas

and when i do

Code: [Select]
class Editor : public QMainWindow
{
public:
....
private:
EditorCanvas canvas;
}



and then do

Code: [Select]
canvas = EditorCanvas(...)

I get

Quote
Error   2   error C2248: 'QTimer::operator =' : cannot access private member declared in class 'QTimer'   c:\documents and settings\administrator\my documents\visual studio 2008\projects\sfmlengine\sfmlengine\QSFMLCanvas.h   27



also, since Editor extends QMainWindow, should I pass this as the parent of EditorCanvas?
Title: Possible to embed a rendering window inside a window
Post by: Laurent on August 29, 2009, 08:18:51 pm
Widgets are not copyable, you should declare a pointer (EditorCanvas*) and allocate it using new. Then Qt will take care about deleting the instance for you, if it has a parent widget.
Title: Possible to embed a rendering window inside a window
Post by: Train on August 29, 2009, 08:24:47 pm
should the Editor be considered its parent?
Title: Possible to embed a rendering window inside a window
Post by: Laurent on August 30, 2009, 12:31:11 am
If the EditorCanvas is a sub-widget of the Editor, then yes.