• Advertisement
Sign in to follow this  

GTK+/gtkmm and DirectX?

This topic is 1976 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

I want to use GTK to add a user interface to my world editor but i'm not sure how? Can't find anything on the subject.

Share this post


Link to post
Share on other sites
Advertisement
I use Java and OpenGL but the main idea may help you.

I tend to use three separate threads: the "main()", the GUI with the tools and an instance of the game "window" (working as the "world editor"). The "main" has a simple job: start the GUI and the "game" and link both with each other. The way to "link" them is by using java "interfaces" (implementing Listener pattern): GUI implements something like WorldBuilderEventListener and WorldEditor implements something like GUIEventListener (with methods as "setPlayerPos(x,y,z)" and the like). So, the "main()" is like:

[font=courier new,courier,monospace]main(){[/font]

gui = GUI(); // class GUI implements WorldBuilderListener { ... }

worldBuilder = WorldBuilder(); // class WorldBuilder implements GUIListener { ... }


gui.setGUIListener(worldBuilder);
worldBuilder.setWorldBuilderListener(gui);

gui.start();
worldBuilder.start();

// wait for threads to end
gui.join();
worldBuilder.join();
[font=courier new,courier,monospace]}[/font]

There's another option: using processes instead of threads (as may be the case if there's no natural integration between GTK+ and DirectX). In this case, my advice is to use sockets to communicate between GUI and WorldEditor.

Share this post


Link to post
Share on other sites
Actually i meant how do i actually use the GTK API to get a handle to a window to draw to or something.

Share this post


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

  • Advertisement