boolean JLEDObj::updateProperty(JProperty& prop) { if (JModuleObj::updateProperty(prop)) return true; if (prop.getName() == JString("value")) { setValue(((JIntegerProperty*)&prop)->value); return true; } else if (prop.getName() == JString("color")) { color = ((JColorProperty*)&prop)->color; repaintView(*this); return true; } else if (prop.getName() == JString("bkgnd")) { bkgnd = ((JColorProperty*)&prop)->color; repaintView(*this); return true; } return false; }
void CityLordView::mousePressEvent(QMouseEvent * e){ showFieldColor(false, true); startMouse = mapToScene(e->pos()); Location location = isoToLoc(startMouse); if(*sabotageActive){ if(goodLocation(location)){ selectField(location); if(clientManager->getMap()->getCase(location)->isRoad()){ clientManager->setRequest("roadblock"); clientManager->addInfo("row", std::to_string(location.getRow())); clientManager->addInfo("col", std::to_string(location.getCol())); clientManager->sendRequestAndRecv(); openMessageBox("RoadBlock"); } } } else{ if(goodLocation(location)){ selectField(location); if(clientManager->getMap()->getCase(location)->isField()){ dynamic_cast<ClientField*>(clientManager->getMap()->getCase(location))->setShowOwnerColor(true); } } if(goodLocation(previousSelectedLocation) && !previousSelectedLocation.isEqual(location)){ if(clientManager->getMap()->getCase(previousSelectedLocation)->isField()){ dynamic_cast<ClientField*>(clientManager->getMap()->getCase(previousSelectedLocation))->setShowOwnerColor(false); } } previousSelectedLocation = location; } repaintView(); }
void JSampleObj::updateN(int _N) { int oldv = N; JFRect rect = calculateInputUpdate(); rect |= calculateOutputUpdate(); N = max(1, min(512, _N)); if (N != oldv) { igm = N+IN_LAST; ogm = N; rect |= calculateInputUpdate(); rect |= calculateOutputUpdate(); repaintView(rect); } }
boolean JTNGObj::updateProperty(JProperty& prop) { if (JANDObj::updateProperty(prop)) return true; if (prop.getName() == JString("factor")) { factor = ((JIntegerProperty*)&prop)->value; repaint(); return true; } else if (prop.getName() == JString("channelCount")) { JFRect rect = calculateOutputUpdate(); channelCount = ((JIntegerProperty*)&prop)->value; ogm = channelCount+offset; rect |= calculateOutputUpdate(); repaintView(rect); return true; } else for (int i=0; i<channelCount; i++) { if (prop.getName() == JString("inv-")+JInteger::toJString(i+1)) { inv[i] = ((JIntegerListProperty*)&prop)->value; return true; } } return false; }
boolean JTNG4Obj::updateProperty(JProperty& prop) { if (prop.getName() == JString("oseparator0")) { oseparators[0] = ((JIntegerProperty*)&prop)->value; return true; } else if (prop.getName() == JString("oseparator1")) { oseparators[1] = ((JIntegerProperty*)&prop)->value; return true; } else if (prop.getName() == JString("exclusive")) { exclusive = ((JIntegerListProperty*)&prop)->value; return true; } else if (prop.getName() == JString("extraInputCount")) { JFRect rect = calculateInputUpdate(); extraInputCount = ((JIntegerProperty*)&prop)->value; igm = IN_LAST+extraInputCount; rect |= calculateInputUpdate(); repaintView(rect); return true; } else if (JTNG3Obj::updateProperty(prop)) return true; return false; }
void CityLordView::buildViewMap(){ /**********************/ //scale(0.35, 0.35); if(clientManager == nullptr){ throw std::invalid_argument("clientManager is nullptr in the view."); }else{ cleanItemArray(); numberOfRows = clientManager->getMap()->getNumberOfRows(); numberOfCols = clientManager->getMap()->getNumberOfCols(); itemArray = new QGraphicsPixmapItem**[numberOfRows]; for(int i=0;i<numberOfRows;i++){ itemArray[i] = new QGraphicsPixmapItem*[numberOfCols]; for(int j=0;j<numberOfCols;j++){ itemArray[i][j] = new QGraphicsPixmapItem; scene->addItem(itemArray[i][j]); } } } repaintView(); }
void CityLordView::showCurrentPlayerFieldColor(){ showFieldColor(false, true); showFieldColor(true, false); repaintView(); }
void CityLordView::unshowAllFieldColor(){ showFieldColor(false, true); repaintView(); }