Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


problem with Anttweakbar with multiple objects


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
No replies to this topic

#1 gboxentertainment   Members   -  Reputation: 766

Like
0Likes
Like

Posted 29 December 2013 - 05:24 AM

I've recently gotten Anttweakbar to work with my graphics engine.

I have done a quick test to be able to adjust the position of an object in space using the anttweakbar gui.

 

What I want to do now is to do this for multiple objects - so that I can change the active object and adjust the position of each different object individually.

 

Here's where I initialize the GUI:

bool init(void)
{
	TwInit(TW_OPENGL, NULL);
	myBar = TwNewBar("GiBOX");
	TwDefine(" GiBOX size='240 320' ");
	TwDefine(" GiBOX valueswidth=140 ");
    // - Directly redirect GLUT mouse button events to AntTweakBar
    glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
    // - Directly redirect GLUT mouse motion events to AntTweakBar
    glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    // - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
    glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    // - Directly redirect GLUT key events to AntTweakBar
    glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
    // - Directly redirect GLUT special key events to AntTweakBar
    glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT);
	TwAddVarRW(myBar, "Object Id", TW_TYPE_INT32, &objId, "");
	TwAddVarRW(myBar, "Object Position", TW_TYPE_DIR3F, &(models->objPos[objId]), "");

}

I use object id to specify which object would be active. So in the gui, I can change the object id.

The problem is even when I change the object id, it only adjusts the position of the first object (which is objId = 0).

 

It seems that when I set models->objPos[objId] it doesn't update the objId in this function.

Has anyone who's used Anttweakbar ever gotten it to work with multiple objects and can update their attributes individually?



Sponsor:



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