Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


GTK+/gtkmm and DirectX?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 27 September 2012 - 07:17 AM

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.
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

Sponsor:

#2 pacobarter   Members   -  Reputation: 115

Like
0Likes
Like

Posted 27 September 2012 - 07:59 PM

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:

main(){

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();
}

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.

#3 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 28 September 2012 - 04:59 AM

Actually i meant how do i actually use the GTK API to get a handle to a window to draw to or something.
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS