bool Tweaker::Update() { if(s_isInit && s_enabled) { if(s_monitorMode && Pi::player) { Body* nt = Pi::player->GetNavTarget(); Body* ct = Pi::player->GetCombatTarget(); //Body* target = nt != nullptr ? nt : ct; // Prioritize navtarget over combat target Body* target = ct != nullptr ? ct : nt; // Prioritize combattarget since we only care about ships now // Check if target changed if(target != s_monitorCurrentTarget) { // Target changed. // Remove active monitor if necessary if( s_activeMonitor && target && s_monitorCurrentTarget && target->GetType() == s_monitorCurrentTarget->GetType()) { // Keep the same monitor } else { // Change monitor TwDeleteBar(s_activeMonitor); s_activeMonitor = nullptr; if(target) { // Only add new monitor if there is a valid target s_activeMonitor = CreateMonitor(target); } } s_monitorCurrentTarget = target; } // Updated monitors UpdateMonitor(target); } return true; } else { return false; } }
void CDebugHelperImplementation::RemoveBar(const std::string& bar) { // TODO: eliminar una ventana de debug TwDeleteBar(m_Bars[bar]); m_Bars.erase(bar); }
void CompleteBoxPruningTest::Deselect() { if(mBar) { TwDeleteBar(mBar); mBar = null; } }
void BipartiteBoxPruningTest::Deselect() { if(mBar) { TwDeleteBar(mBar); mBar = null; } }
void OBBMeshQuery::Deselect() { if(mBar) { TwDeleteBar(mBar); mBar = null; } }
Gui::~Gui() { if(m_tweakbar) { TwDeleteBar(m_tweakbar); } TwTerminate(); }
void MaterialDialog::setMaterial(int pIndex) { if (m_dialog) TwDeleteBar(m_dialog); // Create a tweak bar m_dialog = TwNewBar("Material"); int barSize[2] = {200, 1060}; TwDefine(" Material position='1710 10' "); TwSetParam(m_dialog, NULL, "size", TW_PARAM_INT32, 2, barSize); m_material = Scene::GetInstance()->GetMaterial(pIndex); TwAddVarCB(m_dialog, "MaterialName", TW_TYPE_CDSTRING, SetName, GetName, (void*)this, " label='Name: '"); TwAddVarRW(m_dialog, "Ambient", TW_TYPE_COLOR3F, (void*)&m_material->ambient, " help='Light color.' group='Properties'"); TwAddVarRW(m_dialog, "Diffuse", TW_TYPE_COLOR3F, (void*)&m_material->diffuse, " help='Light color.' group='Properties'"); TwAddVarRW(m_dialog, "Specular", TW_TYPE_COLOR3F, (void*)&m_material->specular, " help='Light color.' group='Properties'"); TwAddVarRW(m_dialog, "Emissive", TW_TYPE_COLOR3F, (void*)&m_material->emissive, " help='Light color.' group='Properties'"); TwAddVarRW(m_dialog, "Opacity", TW_TYPE_FLOAT, (void*)&m_material->opacity, " help='Light color.' group='Properties' min=0.0 max=1.0 step=0.01"); TwAddVarRW(m_dialog, "Reflectivity", TW_TYPE_FLOAT, (void*)&m_material->reflectivity, " help='Light color.' group='Properties' min=0.0 max=1.0 step=0.01"); TwAddVarRW(m_dialog, "Shininess", TW_TYPE_FLOAT, (void*)&m_material->shininess, " help='Light color.' group='Properties' min=0.0 max=100.0 step=1.0"); TwAddVarRW(m_dialog, "Texture Scale", TW_TYPE_FLOAT, (void*)&m_material->textureScale, " help='Light color.' group='Properties' min=0.0 max=10.0 step=0.01"); TwAddButton(m_dialog, "Load Diffuse Texture", LoadDiffuse, this, " label='Diffuse Texture' key=c help='Load an Agile file into the editor.' group='Load'"); TwAddButton(m_dialog, "Load Specular Texture", LoadSpecular, this, " label='Specular Texture' key=c help='Load an Agile file into the editor.' group='Load'"); TwAddButton(m_dialog, "Load Glow Texture", LoadGlow, this, " label='Glow Texture' key=c help='Load an Agile file into the editor.' group='Load'"); TwAddButton(m_dialog, "Load Normal Texture", LoadNormal, this, " label='Normal Texture' key=c help='Load an Agile file into the editor.' group='Load'"); TwAddButton(m_dialog, "Load Displacement Texture", LoadDisplacement, this, " label='Displacement Texture' key=c help='Load an Agile file into the editor.' group='Load'"); TwAddButton(m_dialog, "Load Gradient Texture", LoadGradient, this, " label='Gradient Texture' key=c help='Load an Agile file into the editor.' group='Load'"); TwStructMember tessMembers[] = { { "Edge1", TW_TYPE_FLOAT, offsetof(AglVector4, x), " Step=0.1 min=1.0 max=64.0" }, { "Edge2", TW_TYPE_FLOAT, offsetof(AglVector4, y), " Step=0.1 min=1.0 max=64.0" }, { "Edge3", TW_TYPE_FLOAT, offsetof(AglVector4, z), " Step=0.1 min=1.0 max=64.0" }, { "Internal", TW_TYPE_FLOAT, offsetof(AglVector4, w), " Step=0.1 min=1.0 max=64.0" }}; TwType tessType = TwDefineStruct("TESSELATIONFACTORS", tessMembers, 4, sizeof(AglVector4), NULL, NULL); TwAddVarRW(m_dialog, "Tess", tessType, &m_material->tesselationFactor, " group='Properties' "); TwAddVarRW(m_dialog, "Displacement", TW_TYPE_FLOAT, (void*)&m_material->displacement, " group='Properties' min=0.0 max=10.0 step=0.01"); TwAddButton(m_dialog, "Add Layer", AddLayer, this, " label='Add Layer' key=c help='Load an Agile file into the editor.' group='Gradient Mapping'"); TwAddButton(m_dialog, "Delete", Delete, this, ""); if (m_material->gradientDataIndex >= 0) { AglGradient* g = Scene::GetInstance()->GetGradient(m_material->gradientDataIndex); vector<AglGradientMaterial*> layers = g->getLayers(); for (unsigned int i = 0; i < layers.size(); i++) { AddLayer(g, layers[i], i); } } show(); }
void BipartiteBoxPruningTest::Deselect() { #ifdef USE_ANTTWEAKBAR if(mBar) { TwDeleteBar(mBar); mBar = null; } #endif //USE_ANTTWEAKBAR }
void Tweaker::NotifyRemoved(const Body* removed_body) { if (!s_isInit || !s_enabled) { return; } if(removed_body && s_monitorCurrentTarget == removed_body) { s_monitorCurrentTarget = nullptr; if(s_activeMonitor) { TwDeleteBar(s_activeMonitor); s_activeMonitor = nullptr; } } }
// ***************************************************** Figure::destruction ~FigureAnt() { // Terminate AntTweakBar TwDeleteBar( _bar ); TwTerminate(); glfwSetWindowShouldClose(_window, GL_TRUE); if(_window) glfwDestroyWindow( _window); if( _offscreen ) { glDeleteRenderbuffers( 1, &_render_buf ); utils::gl::check_error(); glDeleteFramebuffers( 1, &_fbo ); utils::gl::check_error(); } }
static void Terminate() { ReleaseTerrain(); for(int i=0;i<MAX_NB_TESTS;i++) { gCollisionTests[i]->Release(); DELETESINGLE(gCollisionTests[i]); } if(gMainBar) { TwDeleteBar(gMainBar); gMainBar = null; } TwTerminate(); }
void APP_SpotRotate::ClearMenu() { TwDeleteBar(m_bar); //reset the gui }
vector<int*> outPut::choosePoints() { glfwEnable( GLFW_KEY_REPEAT ); _points.clear(); TwBar *b_points = TwNewBar("Points stratégiques"); coords<int> curPoint((float)_dimensions.x/2.0, (float)_dimensions.y/2.0); bool done(false), addCurrent(false), addRandom(false); coords3d<float> vertex(0,0,0); TwAddVarRW(b_points, "x", TW_TYPE_INT32, &(curPoint.x), "keyincr = RIGHT keydecr = LEFT" ); TwAddVarRW(b_points, "y", TW_TYPE_INT32, &(curPoint.y), "keyincr = UP keydecr = DOWN" ); TwAddVarRW(b_points, "Fini", TW_TYPE_BOOLCPP, &(done), "key = RETURN" ); TwAddVarRW(b_points, "Ajouter courant", TW_TYPE_BOOLCPP, &(addCurrent), "key = SPACE" ); TwAddVarRW(b_points, "Ajouter au hasard", TW_TYPE_BOOLCPP, &(addRandom), "key = 'r'" ); TwAddVarRW(b_points, "Pente max", TW_TYPE_INT32, &(_status.maxDiff), "keyincr=o keydecr=l"); while((!done || _points.size() < 2) && _status.running) { setScene(); drawScene(); glDisable(GL_DEPTH_TEST); glUseProgram(_sNolight.getProgramID()); curPoint.x = clamp(curPoint.x, 1, _dimensions.x-1); curPoint.y = clamp(curPoint.y, 1, _dimensions.y-1); vertex = getVertex<float>(curPoint.x,curPoint.y); _scene3d.focus.x = curPoint.x; _scene3d.focus.y = curPoint.y; if(addRandom) { addCurrent = true; addRandom = false; curPoint.x = rand()%(_dimensions.x-1); curPoint.y = rand()%(_dimensions.y-1); } if(addCurrent) { _points.push_back(curPoint); addCurrent = false; } glBegin(GL_POINTS); glColor3ub(0,255,0); glVertex3d(vertex.x, vertex.y, vertex.z); glEnd(); display(); } unsigned int n = _points.size(); std::cout << "nb de bombes : " << n << std::endl; vector<int*> bombList(n, NULL); for(unsigned int i = 0; i<n;i++) { bombList[i] = new int[n+2]; for(unsigned int j = 0; j < n+2; ++j) { bombList[i][j] = 0; } bombList[i][n+2-2] = _points[i].x; bombList[i][n+2-1] = _points[i].y; } TwDeleteBar(b_points); TwDefine(" Scene/x keyincr = RIGHT keydecr = LEFT"); TwDefine(" Scene/y keyincr = UP keydecr = DOWN"); return bombList; }
void IntroOpenGl::ClearMenu() { TwDeleteBar(m_bar); //reset the gui }
Toolbar::~Toolbar() { if(tweakBar != nullptr) TwDeleteBar(tweakBar); }
void GUI::terminate(){ TwDeleteBar(m_bar); TwTerminate(); }
void UiPropertyGrid::DeInit() { DeleteGrid(); TwDeleteBar(m_panel); }
void CDebugHelperImplementation::RegisterBar(const SDebugBar& bar) { // TODO: registrar una ventana de debug int status = 0; std::unordered_map<std::string, TwBar*>::iterator it = m_Bars.find(bar.name); if (it != m_Bars.end()) { status = TwDeleteBar(it->second); assert(status); } TwBar* twBar = TwNewBar(bar.name.c_str()); for (int i = 0; i < bar.variables.size(); ++i) { if (bar.variables[i].type == BUTTON) { status = TwAddButton(twBar, bar.variables[i].name.c_str(), bar.variables[i].callback, bar.variables[i].data, ""); assert(status); } else { TwType type = TW_TYPE_FLOAT; const char* params = ""; switch (bar.variables[i].type) { case BOOL: type = TW_TYPE_BOOLCPP; break; case FLOAT: type = TW_TYPE_FLOAT; break; case INT: type = TW_TYPE_INT32; break; case COLOR32: type = TW_TYPE_COLOR32; params = " coloralpha=true colororder=argb "; break; case COLOR: type = TW_TYPE_COLOR4F; break; case STRING: type = TW_TYPE_CSSTRING(100); break; case POSITION_ORIENTATION: type = m_PosRotType; break; default: break; } switch (bar.variables[i].mode) { case READ: status = TwAddVarRO(twBar, bar.variables[i].name.c_str(), type, bar.variables[i].ptr, params); assert(status); break; case READ_WRITE: status = TwAddVarRW(twBar, bar.variables[i].name.c_str(), type, bar.variables[i].ptr, params); assert(status); break; default: break; } } } m_Bars[bar.name] = twBar; }
void ParticleSystemDialog::setPS(int pIndex) { mPSIndex = pIndex; if (m_dialog) TwDeleteBar(m_dialog); // Create a tweak bar m_dialog = TwNewBar("ParticleSystem"); int barSize[2] = {200, 1060}; TwDefine(" ParticleSystem position='1710 10' "); TwSetParam(m_dialog, NULL, "size", TW_PARAM_INT32, 2, barSize); TwAddVarCB(m_dialog, "Spawn Point", TW_TYPE_DIR3F, SetSpawn, GetSpawn, (void*)this, "key=o"); TwAddVarCB(m_dialog, "Particle Age", TW_TYPE_FLOAT, SetParticleAge, GetParticleAge, (void*)this, "key=o step=0.01 min=0.0"); TwAddVarCB(m_dialog, "Spawn Speed", TW_TYPE_FLOAT, SetParticleSpeed, GetParticleSpeed, (void*)this, "key=o step=0.01 min=0.0"); TwAddVarCB(m_dialog, "Spawn Direction", TW_TYPE_DIR3F, SetParticleDirection, GetParticleDirection, (void*)this, "key=o"); TwAddVarCB(m_dialog, "Spread", TW_TYPE_FLOAT, SetSpread, GetSpread, (void*)this, "key=o step=0.01 min=0.0 max=1.0"); TwAddVarCB(m_dialog, "Spawn Frequency", TW_TYPE_FLOAT, SetFrequency, GetFrequency, (void*)this, "key=o step=0.01 min=0.0"); TwAddVarCB(m_dialog, "Color", TW_TYPE_COLOR4F, SetColor, GetColor, (void*)this, "key=o"); TwAddVarCB(m_dialog, "Fade-In Stop", TW_TYPE_FLOAT, SetFadeIn, GetFadeIn, (void*)this, "key=o step=0.01"); TwAddVarCB(m_dialog, "Fade-Out Start", TW_TYPE_FLOAT, SetFadeOut, GetFadeOut, (void*)this, "key=o step=0.01"); TwAddVarCB(m_dialog, "Spawn Offset", TW_TYPE_FLOAT, SetSpawnOffset, GetSpawnOffset, (void*)this, "key=o step=0.01 min=0.0"); TwAddVarCB(m_dialog, "Maximum Opacity", TW_TYPE_FLOAT, SetMaxOpacity, GetMaxOpacity, (void*)this, "key=o step=0.01 min=0.0 max=1.0"); //Offset types TwAddButton(m_dialog, "On Sphere", SetOffsetOnSphere, (void*)this, " label='On Sphere' group='Offset Type'"); TwAddButton(m_dialog, "In Sphere", SetOffsetInSphere, (void*)this, " label='In Sphere' group='Offset Type'"); TwAddButton(m_dialog, "On Circle", SetOffsetOnCircle, (void*)this, " label='On Circle' group='Offset Type'"); TwAddButton(m_dialog, "In Circle", SetOffsetInCircle, (void*)this, " label='In Circle' group='Offset Type'"); //Spawn types TwAddButton(m_dialog, "Once", SetSpawnOnce, (void*)this, " label='Once' group='Spawn Type'"); TwAddButton(m_dialog, "Continuously", SetSpawnContinously, (void*)this, " label='Continuously' group='Spawn Type'"); //Spread Types TwAddButton(m_dialog, "In Plane", SetSpreadPlane, (void*)this, " label='In Plane' group='Spread Type'"); TwAddButton(m_dialog, "In Space", SetSpreadSpace, (void*)this, " label='In Space' group='Spread Type'"); //Particle Size TwAddVarCB(m_dialog, "Width", TW_TYPE_FLOAT, SetParticleSizeX, GetParticleSizeX, (void*)this, "key=o step=0.01 min=0.0"); TwAddVarCB(m_dialog, "Height", TW_TYPE_FLOAT, SetParticleSizeY, GetParticleSizeY, (void*)this, "key=o step=0.01 min=0.0"); TwAddButton(m_dialog, "Restart", Restart, (void*)this, " label='Restart'"); TwAddButton(m_dialog, "Load Texture", LoadTexture, this, " label='Load Texture'"); //Particles per spawn TwAddVarCB(m_dialog, "Particles Per Spawn", TW_TYPE_UINT32, SetParticlesPerSpawn, GetParticlesPerSpawn, (void*)this, "key=o"); //Particle Alignment //TwDefine("ParticleSystem/'Billboard Alignment' opened=false "); TwAddButton(m_dialog, "Screen Alignment", SetScreenAlignment, (void*)this, " label='Screen Alignment' group='Billboard Alignment'"); TwAddButton(m_dialog, "World Alignment", SetWorldAlignment, (void*)this, " label='World Alignment' group='Billboard Alignment'"); TwAddButton(m_dialog, "Velocity Alignment", SetVelocityDirAlignment, (void*)this, " label='Velocity Alignment' group='Billboard Alignment'"); TwAddButton(m_dialog, "Observer Alignment", SetObserverAlignment, (void*)this, " label='Observer Alignment' group='Billboard Alignment'"); //Spawn Angular Velocity TwAddVarCB(m_dialog, "Spawn Angular Velocity", TW_TYPE_FLOAT, SetSpawnAngularVelocity, GetSpawnAngularVelocity, (void*)this, "key=o step=0.01"); //Blend Modes TwAddButton(m_dialog, "Alpha", SetBlendAlpha, (void*)this, "group='Blend Mode'"); TwAddButton(m_dialog, "Additive", SetBlendAdditive, (void*)this, "group='Blend Mode'"); TwAddButton(m_dialog, "Multiply", SetBlendMultiply, (void*)this, "group='Blend Mode'"); //Blend Modes TwAddButton(m_dialog, "Alpha", SetBlendAlpha, (void*)this, "group='Blend Mode'"); TwAddButton(m_dialog, "Additive", SetBlendAdditive, (void*)this, "group='Blend Mode'"); TwAddButton(m_dialog, "Multiply", SetBlendMultiply, (void*)this, "group='Blend Mode'"); //Rasterizer modes TwAddButton(m_dialog, "No Culling", SetCullNone, (void*)this, "group='Culling'"); TwAddButton(m_dialog, "Z-Culling", SetCullZ, (void*)this, "group='Culling'"); //Particle space TwAddButton(m_dialog, "Global", SetGlobalSpace, (void*)this, "group='Particle Space'"); TwAddButton(m_dialog, "Local Spawn", SetLocalSpawn, (void*)this, "group='Particle Space'"); TwAddButton(m_dialog, "Local Life", SetLocalLife, (void*)this, "group='Particle Space'"); TwAddButton(m_dialog, "Screen Space", SetScreenSpace, (void*)this, "group='Particle Space'"); //Clone TwAddButton(m_dialog, "Clone", Clone, (void*)this, " label='Clone'"); //Remove TwAddButton(m_dialog, "Remove", Remove, (void*)this, " label='Remove'"); show(); }
void APP_OBJLoader::ClearMenu() { TwDeleteBar(m_bar); //reset the gui }