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

C++ setMap函数代码示例

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

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



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

示例1: setProperty

bool CFullTestIOInWindow::eventFilter(QObject *obj, QEvent *event)
{
    if (event->type() == QEvent::MouseButtonPress)
    {
        for(int i=0;i<_vec32IO.size();i++)
        {
            if(obj == _vec32IO[i])
            {
                //***PLC
                PLCCommandFrame_0x80 c={0};
                ((CApp*)qApp)->_tjob->initFrame80(&c);
                //***仪表
                hardwareTestFrame_0x30 b={_METER_FRAME_HARDWARE_TEST_,0x00};
                QByteArray tmp1=QByteArray::fromRawData((const char*)&b,sizeof(b));
                ((CApp*)qApp)->_tjob->sendTestData232(tmp1);

                if(property("in").toInt())
                {
                    setProperty("in",0);

                    setMap(&c,0,i);
                    c.ifeedback = _bReadCurrent->isChecked()?0x1:0x0;
                    QByteArray tmp2=QByteArray::fromRawData((const char*)&c,sizeof(c));
                    ((CApp*)qApp)->_tjob->sendTestData485(tmp2);

                    _statusLabel->setText(tr("请观察低电平有效的IO量是否变红,同时观察相应的激励电流(mA)。"));
                    _statusLabel_1->setText(tr("当前电平:低电平,当前IO通道:")+ QString::number(i));
                }
                else
                {
                    setProperty("in",1);
                    setMap(&c,1,i);
                    c.ifeedback = _bReadCurrent->isChecked()?0x1:0x0;
                    QByteArray tmp2=QByteArray::fromRawData((const char*)&c,sizeof(c));
                    ((CApp*)qApp)->_tjob->sendTestData485(tmp2);

                    _statusLabel->setText(tr("请观察高电平有效的IO量是否变红。"));
                    _statusLabel_1->setText(tr("当前电平:高电平,当前IO通道:")+ QString::number(i));
                }

                break;
            }
        }

        return true;
    }

    return QWidget::eventFilter(obj, event);
}
开发者ID:jiacheng2012,项目名称:311_tester,代码行数:49,代码来源:cfulltestioinwindow.cpp


示例2: main

int main(void){
	char* map = initMap();
	banner(map);
	int input = 0;
	int turn;
	for(turn=5; turn != 0; turn-- ){
		printf("Dein Zug: ");
		if(scanf("%d", &input) <= 0){
			printf("\nFehler bei der Eingabe!\n");
			while(getchar() != '\n');
			turn++;
			continue;
		}
		if(setMap(map, input) == 0){
			if(check(map) != 0) break;
			outMap(map);
			printf("Gegner ist am Zug:\n");
			setNPC(map);
			outMap(map);
			if(check(map) != 0) break;
		}
		else{
			turn++;
		}
	}
	printf("Der Sieger ist...\n");
	//Das kann man bestimmt auch besser machen..
	int result = check(map);
	if(result == 0) printf("Niemand\n");
	else if(result == 1) printf("Der Spieler\n");
	else if(result == 2) printf("Der Computer\n");
	free(map);
	writeRecord(result);
	return 0;
}
开发者ID:TUCircle,项目名称:homework,代码行数:35,代码来源:tictactoe.c


示例3: SpaceEngine

ObjectEditor::ObjectEditor(QString *patchProject,ELanguage *lan, QWidget *parent):
    SpaceEngine()
{
    SpaceEngineEvents->setParent(parent);
    addCamera();
    pack=new EResursePack();
    camera=getCamersList()->front();
   // camera->setLineWidth(5);
    connect(camera,SIGNAL(MouseClikedEvent(EMouseEvent*)),SLOT(cameraClick(EMouseEvent*)));
    connect(camera,SIGNAL(scrollEnd(EKord&)),this,SLOT(cameraSizeChanged(EKord&)));
    setCameraVirtual(camera,EKord(0.70,0.88),EKord(0,0.1));
    Projectpatch=patchProject;
    lang=lan;
    log=new ELoadScreen();
    addMap();
    ObjectRender=NULL;
    setMap(getMapsList()->front(),camera);
    createVerticalMenu();
    createHorizontalMenu();
    addQtWidget(log,EKord(0),EKord(1,0.1));
    log->setHidden(true);
    ugol=lastX=0;
    connect(getMain(),SIGNAL(EmouseMoveEvent(QMouseEvent*)),SLOT(MouseMove(QMouseEvent*)));
    connect(getMain(),SIGNAL(EkeyPressEvent(QKeyEvent*)),SLOT(press(QKeyEvent*)));
    connect(getMain(),SIGNAL(EkeyReleaseEvent(QKeyEvent*)),SLOT(release(QKeyEvent*)));
    alt=ShiftPressd=ctrlPresed=false;
}
开发者ID:EndrII,项目名称:Space_engine,代码行数:27,代码来源:ObjectEditor.cpp


示例4: tr

void CFunctionTestSpeedTableWindow::timerUpdate()
{
    //***PLC
    if(_cur>=cf->_function_tpoint["meter_speed"].size())
        _cur=0;
    int val = cf->_function_tpoint["meter_speed"][_cur];
    if(val<=cf->_function_param["low_speed"])
    {
        _signOutLabel->setStyleSheet("border-radius:15px;background:red;border:1px solid #666;");
        _statusLabel->setStyleSheet("font:bold 16px;color:red;max-height:50px;min-height:26px;background:#CCFF99;");
        _statusLabel->setText(tr("请观察速度表,现在的值应该是 ") + QString::number(val) + tr(" km/h,\n高低档切换指示灯点亮!"));
    }
    else
    {
        _signOutLabel->setStyleSheet("border-radius:15px;background:#fff;border:1px solid #666;");
        _statusLabel->setStyleSheet("font:bold 16px;color:#0099FF;max-height:50px;min-height:26px;background:#CCFF99;");
        _statusLabel->setText(tr("请观察速度表,现在的值应该是 ") + QString::number(val) + tr(" km/h,\n高低档切换指示灯熄灭!"));
    }
    _currentValue->setValue(val);
    PLCCommandFrame_0x80 c={0};
    ((CApp*)qApp)->_tjob->initFrame80(&c);
    QByteArray tb = arrangeByte( (double)val*((double)cf->_function_param["speed_pulse"]/3600.0),4);
    c.freqout[0] = tb[0];
    c.freqout[1] = tb[1];
    c.freqout[2] = tb[2];
    c.freqout[3] = tb[3];
    //***取力开关量置低位
    setMap(&c,2,0);
    QByteArray tmp2=QByteArray::fromRawData((const char*)&c,sizeof(c));
    ((CApp*)qApp)->_tjob->sendTestData485(tmp2);
    _cur++;
}
开发者ID:jiacheng2012,项目名称:311_tester,代码行数:32,代码来源:cfunctiontestspeedtablewindow.cpp


示例5: sprintf

void TclTextInterp::initialize_structure_cb(int molid, int code) {
  char molstr[30];
  sprintf(molstr, "%d", molid);
  char codestr[30];
  sprintf(codestr, "%d", code);
  setMap("vmd_initialize_structure", molstr, codestr);
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:7,代码来源:TclTextInterp.C


示例6: setWholeVeCmd

static void setWholeVeCmd(float value) {
	scheduleMsg(&logger, "Setting whole VE map to %f", value);
	if (engineConfiguration->algorithm != LM_SPEED_DENSITY) {
		scheduleMsg(&logger, "WARNING: setting VE map not in SD mode is pointless");
	}
	setMap(config->veTable, value);
}
开发者ID:jon-weisz,项目名称:rusefi,代码行数:7,代码来源:settings.cpp


示例7: while

void                          Map::initMap(bool const obstacles)
{
  int                         count = 0;
  int                         rand_x;
  int                         rand_y;

  this->obstacles = obstacles;
  for(int y = 0 ; y != this->height ; y++)
    {
      for(int x = 0 ; x != this->width ; x++)
        {
          if (y == 0 || y == (this->height - 1) || x == 0 || x == this->width -1)
            this->MapSnake[y][x] = WALL;
          else
            this->MapSnake[y][x] = EMPTY;
	}
    }
  this->printSnakeOnMap();
  this->addFood(FOOD);
  if (this->obstacles == true)
    {
      while (count != NB_WALL)
	{
	  rand_x = rand() % this->width;
	  rand_y = rand() % this->height;
	  if (this->MapSnake[rand_y][rand_x] == EMPTY && rand_x > 0 && rand_y > 0)
	    {
	      setMap(rand_x, rand_y, WALL);
	      count++;
	    }
	}
    }
}
开发者ID:kefranabg,项目名称:Nibbler,代码行数:33,代码来源:Map.cpp


示例8: setMap

void FloorItem::postInit(Map *const map, int subX, int subY)
{
    setMap(map);
    const ItemInfo &info = ItemDB::get(mItemId);
    if (map)
    {
        const int max = info.getMaxFloorOffset();
        if (subX > max)
            subX = max;
        else if (subX < -max)
            subX = -max;
        if (subY > max)
            subY = max;
        else if (subY < -max)
            subY = -max;
        mPos.x = static_cast<float>(mX * map->getTileWidth()
            + subX + mapTileSize / 2 - 8);
        mPos.y = static_cast<float>(mY * map->getTileHeight()
            + subY + mapTileSize - 8);
    }
    else
    {
        mPos.x = 0;
        mPos.y = 0;
    }

    mCursor = info.getPickupCursor();
    setupSpriteDisplay(info.getDisplay(), true, 1,
        info.getDyeColorsString(mColor));
    mYDiff = 31;
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:31,代码来源:flooritem.cpp


示例9: assert

bool
Map::push (int _x, int _y) {
  assert (!badCoords (xpos_, ypos_));
  assert (empty (xpos_, ypos_));

  int xd=0, yd=0;
  if (_x < xpos_) xd = -1;
  if (_x > xpos_) xd =  1;
  if (_y < ypos_) yd = -1;
  if (_y > ypos_) yd =  1;
  if (badDelta (xd, yd) || badCoords (_x+xd, _y+yd)) return false;

  int x=xpos_+xd, y=ypos_+yd;
  if (!object (x, y)) return false;
  if (!empty (_x+xd, _y+yd)) return false;

  while (!(x==_x && y==_y)) {
    x += xd;
    y += yd;
    if (!empty (x, y)) return false;
  }

  clearMap (xpos_+xd, ypos_+yd, OBJECT);
  setMap (_x+xd, _y+yd, OBJECT);

  xpos_ = _x;
  ypos_ = _y;

  return true;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:30,代码来源:Map.C


示例10: CollidingSpriteEntity

BaseCreatureEntity::BaseCreatureEntity(sf::Texture* image, float x = 0.0f, float y = 0.0f, int spriteWidth = -1, int spriteHeight = -1)
  : CollidingSpriteEntity (image, x, y, spriteWidth, spriteHeight )
{
  hurting = false;
  hurtingType = ShotTypeStandard;
  shadowFrame = -1;
  setMap(game().getCurrentMap(), TILE_WIDTH, TILE_HEIGHT, OFFSET_X, OFFSET_Y);
  hpDisplay = 0;
  armor = 0.0f;
  movingStyle = movWalking;
  for (int i = 0; i < NB_SPECIAL_STATES; i++)
  {
    specialState[i].type = (enumSpecialState)i;
    specialState[i].active = false;
    specialState[i].timer = 0.0f;
    specialState[i].param1 = 0.0f;
    specialState[i].param2 = 0.0f;
  }
  for (int i = 0; i < NB_RESISTANCES; i++)
  {
    resistance[i] = ResistanceStandard;
  }
  recoil.active = false;
  facingDirection = 2;
}
开发者ID:jjuhl,项目名称:witchblast,代码行数:25,代码来源:BaseCreatureEntity.cpp


示例11: assert

bool LuaScript::resume()
{
    assert(nbArgs >= 0);
    assert(mCurrentThread);

    setMap(mCurrentThread->mMap);
    const int tmpNbArgs = nbArgs;
    nbArgs = -1;
    int result = lua_resume(mCurrentState, tmpNbArgs);
    setMap(0);

    if (result == 0)                // Thread is done
    {
        if (lua_gettop(mCurrentState) > 0)
            LOG_WARN("Ignoring values returned by script thread!");
    }
    else if (result == LUA_YIELD)   // Thread has yielded
    {
        if (lua_gettop(mCurrentState) > 0)
            LOG_WARN("Ignoring values passed to yield!");
    }
    else                            // Thread encountered an error
    {
        // Make a traceback using the debug.traceback function
        lua_getglobal(mCurrentState, "debug");
        lua_getfield(mCurrentState, -1, "traceback");
        lua_pushvalue(mCurrentState, -3); // error string as first parameter
        lua_pcall(mCurrentState, 1, 1, 0);

        LOG_WARN("Lua Script Error:" << std::endl
                 << lua_tostring(mCurrentState, -1));
    }

    lua_settop(mCurrentState, 0);
    const bool done = result != LUA_YIELD;

    if (done)
    {
        // Clean up the current thread (not sure if this is the best place)
        delete mCurrentThread;
    }

    mCurrentThread = 0;
    mCurrentState = mRootState;

    return done;
}
开发者ID:jurkan,项目名称:manaserv,代码行数:47,代码来源:luascript.cpp


示例12: setMap

void cGRID::checkCollision(std::shared_ptr<cGAME_OBJECT>& obj, cSCENE_MAIN* scene)
{
	if (current_map_data_.data_grid[obj->getCellPos().y][obj->getCellPos().x] == 'l')
	{
		map_data_index_ = current_map_data_.potal_L_filename;		
		int y = obj->getCellPos().y;
		obj->setCellPos({ current_map_[map_data_index_].count_x - 2, y });
		setMap(obj);
	}
	if (current_map_data_.data_grid[obj->getCellPos().y][obj->getCellPos().x] == 't')
	{
		map_data_index_ = current_map_data_.potal_T_filename;
		int x = obj->getCellPos().x;
		obj->setCellPos({ x, current_map_[map_data_index_].count_y - 2 });
		setMap(obj);
	}
	if (current_map_data_.data_grid[obj->getCellPos().y][obj->getCellPos().x] == 'r')
	{
		map_data_index_ = current_map_data_.potal_R_filename;
		int y = obj->getCellPos().y;
		obj->setCellPos({ 1, y });
		setMap(obj);
	}
	if (current_map_data_.data_grid[obj->getCellPos().y][obj->getCellPos().x] == 'b')
	{
		map_data_index_ = current_map_data_.potal_B_filename;
		int x = obj->getCellPos().x;
		obj->setCellPos({ x, 1 });
		setMap(obj);
	}
	if (current_map_data_.data_grid[obj->getCellPos().y][obj->getCellPos().x] == 'd')
	{
		scene->changeSceneState(eSCENE_STATE::SELECT);
		int x = obj->getCellPos().x - 1;
		int y = obj->getCellPos().y;
		obj->setCellPos({ x, y });
		obj->setPos({ x* current_map_data_.width, y * current_map_data_.height });
	}
	if (current_map_data_.data_grid[obj->getCellPos().y][obj->getCellPos().x] == 'x')
	{
		//map_data_index_ = current_map_data_.potal_R_filename;
		int y = obj->getCellPos().y;
		obj->setCellPos({ 1, y });
		setMap(obj);
	}
	
}
开发者ID:hmgWorks,项目名称:MH2D,代码行数:47,代码来源:cGRID.cpp


示例13: QWidget

PrefSelectionWidget::PrefSelectionWidget (QWidget *parent, PreferenceValue *pref)
: QWidget (parent)
{
	QSettings s;
	setupUi (this);
	label->setText (pref->help ()); 
	setMap (pref->data ().toMap (), s.value (pref->key (), pref->defval ()).toString ());
}
开发者ID:caotic,项目名称:esperanza-caotic,代码行数:8,代码来源:prefselectionwidget.cpp


示例14: valueWithFallback

QMap<QString, QVariant> Settings::map(QString key, QMap<QString, QVariant> default_value)
{
  QMap<QString, QVariant> value = valueWithFallback(key, default_value).toMap();
  if (value==default_value)
  {
    setMap(key, default_value);
  }
  return value;
}
开发者ID:marc-sturm,项目名称:cppCORE,代码行数:9,代码来源:Settings.cpp


示例15: setMap

void App::updateMetadata() {
    if(bNewData) {
        metadata.update(json_data);

        bNewData = false;
        bConnected = true;
        setMap();
    }
}
开发者ID:miguelespada,项目名称:lescer_viewer,代码行数:9,代码来源:app.cpp


示例16: setMap

MapSearchable::MapSearchable(Map map, Position start, Location goal) {
	setMap(map);

	this->start = map.getGridPosition(start);
	this->goal = map.getGridLocation(goal);

	this->startState = State(map.getWorldLocation(this->start.getLocation()), 0, this->operator()(this->start.getLocation()), airDistance(this->start.getLocation(), this->goal));
	this->goalState = State(map.getWorldLocation(this->goal));
}
开发者ID:DeadNight,项目名称:robotics,代码行数:9,代码来源:MapSearchable.cpp


示例17: QGraphicsScene

MapView::MapView(Model::Map * m) :
    QGraphicsScene()
{
    gridStrategy = NULL;
    displayStrategy = NULL;
	paintStrategy = NULL;
	setMap(m);
	initCursor();
	modified = false;
}
开发者ID:BenjBoug,项目名称:Map-Editor,代码行数:10,代码来源:MapView.cpp


示例18: updateData

void MapDrawer::updateData(const LCreal dt)
{
    // Update our baseclass
    BaseClass::updateData(dt);

    // Set our map if we don't have one
    if (myMap == 0) {
        CadrgMap* map = dynamic_cast<CadrgMap*>(findContainerByType(typeid(CadrgMap)));
        if (map != 0) setMap(map);
    }
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:11,代码来源:MapDrawer.cpp


示例19: setMap

ActorSprite::~ActorSprite()
{
    setMap(NULL);

    mUsedTargetCursor = NULL;

    // Notify listeners of the destruction.
    Event event(Event::Destroyed);
    event.setActor("source", this);
    event.trigger(Event::ActorSpriteChannel);
}
开发者ID:B-Rich,项目名称:mana,代码行数:11,代码来源:actorsprite.cpp


示例20: if

bool JoystickMapper::setValue(string name, string value)
{
    if (name == "inputDevice")
        inputDevice = value;
    else if (name == "deviceId")
        deviceId = getOEInt(value);
    else if (name.substr(0, 4) == "axis")
        setMap(JOYSTICK_AXIS1 + getOEInt(name.substr(4)), value);
    else if (name.substr(0, 6) == "button")
        setMap(JOYSTICK_BUTTON1 + getOEInt(name.substr(6)), value);
    else if (name.substr(0, 15) == "sensitivityAxis")
        setSensitivity(JOYSTICK_AXIS1 + getOEInt(name.substr(15)), getFloat(value));
    else if (name.substr(0, 11) == "reverseAxis")
        setReverse(JOYSTICK_AXIS1 + getOEInt(name.substr(11)), getOEInt(value));
    else if (name.substr(0, 3) == "map")
        inputDeviceMap[name.substr(3)] = value;
    else
        return false;
    
    return true;
}
开发者ID:43z3com,项目名称:libemulation,代码行数:21,代码来源:JoystickMapper.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setMapper函数代码示例发布时间:2022-05-30
下一篇:
C++ setMainWidget函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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