Sign in to follow this  

GTK+/gtkmm and DirectX?

Recommended Posts

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 { ... }



// wait for threads to end
[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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this