本文整理汇总了C++中setMap函数的典型用法代码示例。如果您正苦于以下问题:C++ setMap函数的具体用法?C++ setMap怎么用?C++ setMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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++;
}
示例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);
}
示例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);
}
示例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++;
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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 ());
}
示例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;
}
示例15: setMap
void App::updateMetadata() {
if(bNewData) {
metadata.update(json_data);
bNewData = false;
bConnected = true;
setMap();
}
}