• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Tool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Tool的典型用法代码示例。如果您正苦于以下问题:C++ Tool类的具体用法?C++ Tool怎么用?C++ Tool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Tool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: switch

void GLWidget::mousePressEvent(QMouseEvent *event)
{
    if(!_isActive) Workspace::setActiveWidget(this);

    if(!toolIsOn) startPosition = lastPosition = QVector2D(event->x() - _width / 2, _height / 2 - event->y());
    if(quickAccess) return;

    switch(event->buttons())
    {
    case Qt::LeftButton:
    {
        Tool *aT = activeTool();
        //  ! stage2     hasStage2 == true && stage2 == false
        //               hasStage2 == false
        //  hasStage2 ? !stage2 : true
        if(aT->hasStage2() ? !aT->stage2() : true) aT->function(START, event);

        break;
    }
    case Qt::RightButton:
    {
        quickAccessToolOrbit();
        quickAccess = true;
        break;
    }
    case Qt::MiddleButton:
    {
        quickAccessToolPan();
        quickAccess = true;
    }
    }
}
开发者ID:ustinski,项目名称:3dModeler,代码行数:32,代码来源:glwidget.cpp


示例2: PointTranslate

void GameController::Update()
{
	ui::Point pos = gameView->GetMousePosition();
	gameModel->GetRenderer()->mousePos = PointTranslate(pos);
	if (pos.X < XRES && pos.Y < YRES)
		gameView->SetSample(gameModel->GetSimulation()->GetSample(PointTranslate(pos).X, PointTranslate(pos).Y));
	else
		gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y));

	Simulation * sim = gameModel->GetSimulation();
	sim->update_particles();

	//if either STKM or STK2 isn't out, reset it's selected element. Defaults to PT_DUST unless right selected is something else
	//This won't run if the stickmen dies in a frame, since it respawns instantly
	if (!sim->player.spwn || !sim->player2.spwn)
	{
		int rightSelected = PT_DUST;
		Tool * activeTool = gameModel->GetActiveTool(1);
		if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos)
		{
			int sr = activeTool->GetToolID();
			if ((sr>0 && sr<PT_NUM && sim->elements[sr].Enabled && sim->elements[sr].Falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT || sr == PT_LIGH)
				rightSelected = sr;
		}

		if (!sim->player.spwn)
			sim->player.elem = rightSelected;
		if (!sim->player2.spwn)
			sim->player2.elem = rightSelected;
	}
	if(renderOptions && renderOptions->HasExited)
	{
		delete renderOptions;
		renderOptions = NULL;
	}

	if(search && search->HasExited)
	{
		delete search;
		search = NULL;
	}

	if(activePreview && activePreview->HasExited)
	{
		delete activePreview;
		activePreview = NULL;
	}

	if(loginWindow && loginWindow->HasExited)
	{
		delete loginWindow;
		loginWindow = NULL;
	}

	if(localBrowser && localBrowser->HasDone)
	{
		delete localBrowser;
		localBrowser = NULL;
	}
}
开发者ID:JoeyJo0,项目名称:The-Powder-Toy,代码行数:60,代码来源:GameController.cpp


示例3: EmergencyStop

// Turn off the heaters, disable the motors, and deactivate the Heat and Move classes. Leave everything else working.
void RepRap::EmergencyStop()
{
	stopped = true;

	// Do not turn off ATX power here. If the nozzles are still hot, don't risk melting any surrounding parts...
	//platform->SetAtxPower(false);

	Tool* tool = toolList;
	while (tool != nullptr)
	{
		tool->Standby();
		tool = tool->Next();
	}

	heat->Exit();
	for(size_t heater = 0; heater < HEATERS; heater++)
	{
		platform->SetHeater(heater, 0.0);
	}

	// We do this twice, to avoid an interrupt switching a drive back on. move->Exit() should prevent interrupts doing this.
	for(int i = 0; i < 2; i++)
	{
		move->Exit();
		for(size_t drive = 0; drive < DRIVES; drive++)
		{
			platform->SetMotorCurrent(drive, 0.0, false);
			platform->DisableDrive(drive);
		}
	}
}
开发者ID:chrishamm,项目名称:RepRapFirmware,代码行数:32,代码来源:RepRap.cpp


示例4: render

/**
 *	This method renders the terrain texture tool, by projecting the texture 
 *	onto the relevant terrain chunks as indicated in tool.relevantChunks().
 *
 *	@param	tool	The tool that we are viewing.
 */
void TerrainTextureToolView::render( const Tool & tool )
{
	EditorChunkTerrainPtrs spChunks;

	ChunkPtrVector::const_iterator it  = tool.relevantChunks().begin();
	ChunkPtrVector::const_iterator end = tool.relevantChunks().end();

	while (it != end)
	{
		Chunk * pChunk = *it++;
		
		EditorChunkTerrain * pChunkTerrain = 
			static_cast<EditorChunkTerrain*>(
				ChunkTerrainCache::instance( *pChunk ).pTerrain());

		if (pChunkTerrain != NULL)
		{
			spChunks.push_back( pChunkTerrain );
		}
	}

	EditorChunkTerrainProjector::instance().projectTexture(
			pTexture_,
			tool.size(),
			rotation_,			
			tool.locator()->transform().applyToOrigin(),
			D3DTADDRESS_BORDER,
			spChunks,
			showHoles_ );
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:36,代码来源:terrain_texture_tool_view.cpp


示例5: GrabTool

Tool *UIVR::create_tool(const char *type) {
  Displayable *parent = &(app->scene->root);
  Tool *newtool = NULL;
  if(!strupncmp(type, "grab", 10)) 
    newtool = new GrabTool(tool_serialno++, app, parent);
  else if(!strupncmp(type, "joystick", 10)) 
    newtool = new JoystickTool(tool_serialno++, app, parent);
  else if(!strupncmp(type, "tug", 10)) 
    newtool = new TugTool(tool_serialno++,app, parent);
  else if(!strupncmp(type, "pinch", 10)) 
    newtool = new PinchTool(tool_serialno++,app, parent);
  else if(!strupncmp(type, "spring", 10)) 
    newtool = new SpringTool(tool_serialno++,app, parent);
  else if(!strupncmp(type, "print", 10)) 
    newtool = new PrintTool(tool_serialno++, app, parent);
  
#ifdef VMDVRPN
  // XXX why is only this tool protected by the ifdef??
  else if(!strupncmp(type, "rotate", 10)) 
    newtool = new RotateTool(tool_serialno++,app, parent);
#endif
  else {
    msgErr << "Unrecognized tool type " << type << sendmsg;
    msgErr << "possiblities are:";
    for(int i=0;i<num_tool_types();i++) msgErr << " " << tool_types.name(i);
    msgErr << sendmsg;
    return NULL;
  }
  newtool->On();
  newtool->grabs = 0;
  return newtool;
}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:32,代码来源:P_UIVR.C


示例6: Widget

ToolBar::ToolBar()
  : Widget(kGenericWidget)
  , m_openedRecently(false)
  , m_tipTimer(300, this)
{
  m_instance = this;

  this->border_width.l = 1*jguiscale();
  this->border_width.t = 0;
  this->border_width.r = 1*jguiscale();
  this->border_width.b = 0;

  m_hotTool = NULL;
  m_hotIndex = NoneIndex;
  m_openOnHot = false;
  m_popupWindow = NULL;
  m_currentStrip = NULL;
  m_tipWindow = NULL;
  m_tipOpened = false;

  ToolBox* toolbox = App::instance()->getToolBox();
  for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) {
    Tool* tool = *it;
    if (m_selectedInGroup.find(tool->getGroup()) == m_selectedInGroup.end())
      m_selectedInGroup[tool->getGroup()] = tool;
  }
}
开发者ID:Julien-B,项目名称:aseprite,代码行数:27,代码来源:toolbar.cpp


示例7: outputLine

void outputLine( ostream &output, const Tool &record )
{
   output << left << setw( 10 ) << record.getRec()
      << setw( 16 ) << record.getTool()
      << setw( 5 ) << record.getQuant()
      << setw( 10 ) << setprecision( 2 ) << right << fixed
      << showpoint << record.getPrice()<<"$" << endl;
} // end function outputLine
开发者ID:NASD-Bulgaria,项目名称:egt-training,代码行数:8,代码来源:main.cpp


示例8: ToolClick

void GameController::ToolClick(int toolSelection, ui::Point point)
{
	Simulation * sim = gameModel->GetSimulation();
	Tool * activeTool = gameModel->GetActiveTool(toolSelection);
	Brush * cBrush = gameModel->GetBrush();
	if(!activeTool || !cBrush)
		return;
	activeTool->Click(sim, cBrush, point);
}
开发者ID:Galacticfuzz,项目名称:PowderToypp-snd,代码行数:9,代码来源:GameController.cpp


示例9: gettool

int UIVR::set_buttons(int toolnum, const char *device) {
  Tool *tool = gettool(toolnum);
  if (!tool) return FALSE;
  if (device == NULL) {
    tool->add_buttons(NULL, NULL);
    return TRUE;
  }
  return add_device_to_tool(device, tool);
}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:9,代码来源:P_UIVR.C


示例10: ClearTemperatureFault

void Tool::ClearTemperatureFault(int8_t heater)
{
	Tool* n = this;
	while (n != nullptr)
	{
		n->ResetTemperatureFault(heater);
		n = n->Next();
	}
}
开发者ID:chrishamm,项目名称:RepRapFirmware,代码行数:9,代码来源:Tool.cpp


示例11: main

/*
 * Main will run auDiskTool. This tool will
 * scan disk data and send records to a report.
 * Configuration may be manipulated.
 */
int main()
{
	Tool auDiskTool;
	
	auDiskTool.init();
	auDiskTool.menu();
	auDiskTool.exit();
	return 0;
}
开发者ID:pandaorb,项目名称:DiskTool,代码行数:14,代码来源:project2_demo.cpp


示例12: update

/**
 *	Update method
 */
void MatrixPositioner::update( float dTime, Tool& tool )
{
	// see if we want to commit this action
	if (!InputDevices::isKeyDown( KeyEvent::KEY_LEFTMOUSE ))
	{
		if (matrix_->hasChanged())
		{
			// set its transform permanently
			matrix_->commitState( false );
		}
		else
		{
			matrix_->commitState( true );
		}


		// and this tool's job is over
		ToolManager::instance().popTool();
		return;
	}

	// figure out movement
	if (tool.locator())
	{
		if (!gotInitialLocatorPos_)
		{
			lastLocatorPos_ = tool.locator()->transform().applyToOrigin();
			gotInitialLocatorPos_ = true;
		}

		totalLocatorOffset_ += tool.locator()->transform().applyToOrigin() - lastLocatorPos_;
		lastLocatorPos_ = tool.locator()->transform().applyToOrigin();


		// reset the last change we made
		matrix_->commitState( true );


		Matrix m;
		matrix_->getMatrix( m );

		Vector3 newPos = m.applyToOrigin() + totalLocatorOffset_;

		SnapProvider::instance()->snapPosition( newPos );

		m.translation( newPos );

		Matrix worldToLocal;
		matrix_->getMatrixContextInverse( worldToLocal );

		m.postMultiply( worldToLocal );


		matrix_->setMatrix( m );
	}
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:59,代码来源:item_functor.cpp


示例13: SCASSERT

//cppcheck-suppress unusedFunction
void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
{
    QHash<quint32, VDataTool*>* tools = doc->getTools();
    SCASSERT(tools != nullptr);
    Tool *tool = qobject_cast<Tool*>(tools->value(node.getId()));
    SCASSERT(tool != nullptr);
    connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
    tool->setParentItem(this);
    doc->IncrementReferens(node.getId());
}
开发者ID:jessikbarret,项目名称:Valentina,代码行数:11,代码来源:vtooldetail.cpp


示例14: create_tool

int UIVR::change_type(int toolnum, const char *type) {
  if (toolnum < 0 || toolnum >= tools.num()) return FALSE;
  Tool *newtool = create_tool(type);
  if (!newtool) return FALSE;
  Tool *oldtool = tools[toolnum];
  newtool->steal_sensor(oldtool);
  delete oldtool;
  tools[toolnum] = newtool;
  return TRUE;
}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:10,代码来源:P_UIVR.C


示例15: getToolById

Tool* ToolBox::getToolById(const std::string& id)
{
  for (ToolIterator it = begin(), end = this->end(); it != end; ++it) {
    Tool* tool = *it;
    if (tool->getId() == id)
      return tool;
  }
  // PRINTF("Error get_tool_by_name() with '%s'\n", name.c_str());
  // ASSERT(false);
  return NULL;
}
开发者ID:dejavvu,项目名称:aseprite,代码行数:11,代码来源:tool_box.cpp


示例16: DrawFill

void GameController::DrawFill(int toolSelection, ui::Point point)
{
	Simulation * sim = gameModel->GetSimulation();
	Tool * activeTool = gameModel->GetActiveTool(toolSelection);
	gameModel->SetLastTool(activeTool);
	Brush * cBrush = gameModel->GetBrush();
	if(!activeTool || !cBrush)
		return;
	activeTool->SetStrength(gameModel->GetToolStrength());
	activeTool->DrawFill(sim, cBrush, point);
}
开发者ID:Galacticfuzz,项目名称:PowderToypp-snd,代码行数:11,代码来源:GameController.cpp


示例17: GetTool

void RepRap::PrintTool(int toolNumber, StringRef& reply) const
{
	Tool* tool = GetTool(toolNumber);
	if (tool != nullptr)
	{
		tool->Print(reply);
	}
	else
	{
		reply.copy("Error: Attempt to print details of non-existent tool.\n");
	}
}
开发者ID:chrishamm,项目名称:RepRapFirmware,代码行数:12,代码来源:RepRap.cpp


示例18: Unload

void Style::Unload()
{
    for( unsigned int i = 0; i < tools.Count(); i++ ) {
        Tool* tool = (Tool*) tools.Item( i );
        tool->Unload();
    }

    for( unsigned int i = 0; i < icons.Count(); i++ ) {
        Icon* icon = (Icon*) icons.Item( i );
        icon->Unload();
    }
}
开发者ID:libai245,项目名称:wht1,代码行数:12,代码来源:styles.cpp


示例19: InterpretManipulator

Command* TextFileView::InterpretManipulator (Manipulator* m) {
    Viewer* v = m->GetViewer();
    Editor* ed = v->GetEditor();
    Tool* tool = m->GetTool();
    Command* cmd = nil;

    if (tool->IsA(GRAPHIC_COMP_TOOL) || tool->IsA(RESHAPE_TOOL)) {
	// do nothing
    } else {
        cmd = TextOvView::InterpretManipulator(m);
    }

    return cmd;
}
开发者ID:barak,项目名称:ivtools-cvs,代码行数:14,代码来源:textfile.c


示例20: addTool

void HudLayer::addTool() {
	Tool *tool = (Tool *) _tools->objectAtIndex(_tools->count() - 1);
	int width = CCDirector::sharedDirector()->getWinSize().width;
	int toolX = width - ((width / 6) / 2);
	int toolY;
	if (tool->getType() == "Bridge") {
		toolY = 550;
		tool->setScale(0.5f);
		_numBridges++;
		sprintf(_bridges,"x %i",_numBridges);
		_bridgeLabel->setString(_bridges);
	} else if (tool->getType() == "Spring") {
		toolY = 400;
		_numSprings++;
		sprintf(_springs,"x %i",_numSprings);
		_springLabel->setString(_springs);
	} else if (tool->getType() == "Pole") {
		toolY = 220;
		_numPoles++;
		sprintf(_poles,"x %i",_numPoles);
		_poleLabel->setString(_poles);
	} else if (tool->getType() == "Catapult") {
		toolY = 0;
		_numCatapults++;
		sprintf(_catapults,"x %i",_numCatapults);
		_catapultLabel->setString(_catapults);
	} else if (tool->getType() == "Fan") {
		toolY = 0;
		_numFans++;
		sprintf(_fans,"x %i",_numFans);
		_fanLabel->setString(_fans);
	}
	tool->setPosition(ccp(toolX,toolY));
	this->addChild(tool, 11);
}
开发者ID:jackmichel,项目名称:Elis-Escape,代码行数:35,代码来源:HudLayer.cpp



注:本文中的Tool类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ToolBar类代码示例发布时间:2022-05-31
下一篇:
C++ ToneGenerator类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap