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

Author Topic: Possible to embed a rendering window inside a window  (Read 5346 times)

0 Members and 1 Guest are viewing this topic.

Train

  • Newbie
  • *
  • Posts: 4
    • View Profile
Possible to embed a rendering window inside a window
« 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

crazy2be

  • Newbie
  • *
  • Posts: 9
    • View Profile
Possible to embed a rendering window inside a window
« Reply #1 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 on how to do with with wxWidgets, you can use other GUI libraries as well.

Train

  • Newbie
  • *
  • Posts: 4
    • View Profile
Possible to embed a rendering window inside a window
« Reply #2 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

Meltra Bour

  • Newbie
  • *
  • Posts: 28
    • View Profile
Possible to embed a rendering window inside a window
« Reply #3 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 ...

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Possible to embed a rendering window inside a window
« Reply #4 on: August 26, 2009, 10:56:16 am »
@Meltra Bour : QT == QuickTime ; Qt == nokia's lib.
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Possible to embed a rendering window inside a window
« Reply #5 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.
Laurent Gomila - SFML developer

Train

  • Newbie
  • *
  • Posts: 4
    • View Profile
Possible to embed a rendering window inside a window
« Reply #6 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Possible to embed a rendering window inside a window
« Reply #7 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.
Laurent Gomila - SFML developer

Train

  • Newbie
  • *
  • Posts: 4
    • View Profile
Possible to embed a rendering window inside a window
« Reply #8 on: August 29, 2009, 08:24:47 pm »
should the Editor be considered its parent?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Possible to embed a rendering window inside a window
« Reply #9 on: August 30, 2009, 12:31:11 am »
If the EditorCanvas is a sub-widget of the Editor, then yes.
Laurent Gomila - SFML developer