Deck* Deck::setPosition(double pos, ScreenEdge e, bool checkCollisions, int distanceFromEdge) { if (pos < 0) pos = 0; else if (pos > 1.0) pos = 1.0; _position = pos; if (e != None) { setEdge(e); } Deck *deckTo = Manager::instance()->positionDeck(this, _position, _edge, _screen, checkCollisions, distanceFromEdge); //now, propagate movement to all cards in this deck (except root, since it already knows) int nCards = count(); for (int i = 1; i < nCards; i++) { Card *card = cardAt(i); if (card) card->followDeck(_position, _edge); } return deckTo; }
void AnimatedFrame::setWidget(QWidget* widget, bool folded) { if(widget_) delete widget_; widget_ = widget; setEdge(edge_); if(widget_) { widget_->setParent(this); widget_->resize(sizeHint_); widget_->show(); } if(animation_.state() == QTimeLine::Running) animation_.stop(); if(folded) { animation_.setDirection(QTimeLine::Forward); } else { animation_.setDirection(QTimeLine::Backward); } handleAnimationFinish(); }
Style::Style ( const QDomElement& xml_rep ) { setStyle( lC::Render::style( xml_rep.attribute( lC::STR::STYLE ) ) ); setEdge( lC::Edge::style( xml_rep.attribute( lC::STR::EDGE ) ) ); setWireframeColor( xml_rep.attribute( lC::STR::WIREFRAME ) ); setSolidColor( xml_rep.attribute( lC::STR::SOLID ) ); setTextureFile( xml_rep.attribute( lC::STR::TEXTURE ) ); }
/** * Class constructor with intiailize parameters. * @param line is segment line. * @param face is segment face. * @param sign1 is vertex sign. * @param sign2 is vertex sign. * @param sign3 is vertex sign. */ Segment::Segment(Line& line, Face& face, int sign1, int sign2, int sign3) { (*this).line = line; index = 0; //VERTEX is an end if(sign1 == 0) { setVertex(face.v1); //other vertices on the same side - VERTEX-VERTEX VERTEX if(sign2 == sign3) setVertex(face.v1); } //VERTEX is an end if(sign2 == 0) { setVertex(face.v2); //other vertices on the same side - VERTEX-VERTEX VERTEX if(sign1 == sign3) setVertex(face.v2); } //VERTEX is an end if(sign3 == 0) { setVertex(face.v3); //other vertices on the same side - VERTEX-VERTEX VERTEX if(sign1 == sign2) setVertex(face.v3); } //There are undefined ends - one or more edges cut the planes intersection line if(getNumEndsSet() != 2) { //EDGE is an end if((sign1==1 && sign2==-1)||(sign1==-1 && sign2==1)) setEdge(face.v1, face.v2); //EDGE is an end if((sign2==1 && sign3==-1)||(sign2==-1 && sign3==1)) setEdge(face.v2, face.v3); //EDGE is an end if((sign3==1 && sign1==-1)||(sign3==-1 && sign1==1)) setEdge(face.v3, face.v1); } }
bool fireball::initialize(Game *gamePtr, TextureManager *textureM) { Entity::initialize(gamePtr, fireballNS::WIDTH, fireballNS::HEIGHT, fireballNS::COLUMNS, textureM); setFrames(fireballNS::START_FRAME, fireballNS::END_FRAME); setCurrentFrame(fireballNS::START_FRAME); setFrameDelay(fireballNS::ANIMATION_DELAY); setVelocity({ fireballNS::SPEED, 0 }); setEdge(fireballNS::FIREBALL_EDGE); return true; }
void Voronoi::ParabolaNode::_move(std::unique_ptr<ParabolaNode> parabola) { _leftSibling = parabola->_leftSibling; _rightSibling = parabola->_rightSibling; _leftChild = std::move(parabola->_leftChild); _rightChild = std::move(parabola->_rightChild); setSite(parabola->site()); setEdge(parabola->edge()); setEvent(parabola->event()); }
void IRQ(int pin) { char pVal[16]; int timeoutTime = -1; // Never timeout int fd_pinValue; exportPin(pin); // Export Pin pinMode(pin, PIN_INPUT); setEdge(pin); memset(pinPath, 0 , sizeof(pinPath)); sprintf(pinPath, "%s/gpio%d/value", GPIO_PATH, pin); if ((fd_pinValue = open(pinPath, O_RDONLY | O_NONBLOCK)) == -1 ) { perror("IRQ getting value fd: "); } struct pollfd fdset[1]; struct sched_param sched; memset (&sched, 0, sizeof(sched)); sched.sched_priority = 55; // High Priority sched_setscheduler (0, SCHED_RR, &sched); while (1) { memset((void*)fdset, 0, sizeof(fdset)); fdset[0].fd = fd_pinValue; fdset[0].events = POLLPRI; int rc = poll(fdset, 1, timeoutTime); // BLOCK 4EVA~! if (rc < 0) { printf("poll(): got a -1... something broke!\n"); } if (rc == 0) { printf("poll(): got a timeout... should be -1?\n"); } if (fdset[0].revents & POLLPRI) { memset(pVal, 0, 16); int size = read(fdset[0].fd, pVal, 16); // go to function pointer printf("\npoll() GPIO %d interrupt occurred\n", pin); } } close(fd_pinValue); }
/* ============================================================================= * initEdges * ============================================================================= */ static void initEdges (element_t* elementPtr, coordinate_t* coordinates, long numCoordinate) { long numEdge = ((numCoordinate * (numCoordinate - 1)) / 2); elementPtr->numEdge = numEdge; long e; for (e = 0; e < numEdge; e++) { setEdge(elementPtr, e); } }
SGMScanInfo& SGMScanInfo::operator =(const SGMScanInfo &other){ if(this != &other){ AMDbObject::operator=(other); setScanName(other.scanName()); setHasEdge(other.hasEdge()); setEdge(other.edge()); setEnergy(other.energy()); setStart(other.start()); setMiddle(other.middle()); setEnd(other.end()); } return *this; }
bool TerrainManager::calcLandscapeSplines(label blockI){ // prepare: const Foam::vector & n_up = coordinateSystem().e(UP); labelList groundSplines = Block::getFaceEdgesI(Block::GROUND); // loop over ground spline labels: forAll(groundSplines,gsI){ // get spline label: label i = groundSplines[gsI]; if(i > 11) continue; // check if already set: if( edges().foundInBlock(blockI,i) ) continue; if( edges().foundInBlock(blockI,Block::switchedOrientationLabel(i)) ) continue; // prepare: const label splinePoints = splinePointNrs_[Block::getDirectionEdge(i)]; pointField spline(splinePoints); // grab spline end points: const labelList verticesI = Block::getEdgeVerticesI(i); point & pointA = getPoint(blockVertex(blockI,verticesI[0])); point & pointB = getPoint(blockVertex(blockI,verticesI[1])); // calc delta in x,y: point delta = (pointB - pointA) / scalar(splinePoints + 1); // loop over spline points: for(label u = 0; u < splinePoints; u++){ point splinePoint = pointA + (1 + u) * delta; // make sure point is above surface: splinePoint += dot(p_above_ - splinePoint,n_up) * n_up; // project to stl_: if(!landscape_().attachPoint(splinePoint,splinePoint - maxDistProj_ * n_up)){ Info << "TerrainManager: Error: Cannot project point p = " << splinePoint << " onto stl_.\n" << endl; return false; } // add: spline[u] = splinePoint; } // set it: setEdge(blockI,i,spline); }
/* * Graphs should be stored in files consisting of comments beginning with # * and edges written as two integers (source and destination node id). */ bool Problem::readGraph(char* fileName) { std::ifstream f(fileName); if(!f) { return false; } std::string line; while(std::getline(f, line)) { if(line[0] != '#') { std::istringstream iss(line); int a, b; if(iss >> a >> b) setEdge(a, b, numGraphs); } }
Player::Player() : Entity() { spriteData.x = playerNS::X; // location on screen spriteData.y = playerNS::Y; spriteData.rect.bottom = playerNS::HEIGHT; // rectangle to select parts of an image spriteData.rect.right = playerNS::WIDTH; velocity.x = 0; // velocity X velocity.y = 0; // velocity Y frameDelay = playerNS::PLAYER_ANIMATION_DELAY; startFrame = playerNS::PLAYER_START_FRAME; endFrame = playerNS::PLAYER_END_FRAME; currentFrame = startFrame; collisionType = entityNS::BOX; spriteData.scale = 0.5; RECT e; e.right = playerNS::WIDTH / 2; e.left = -playerNS::WIDTH / 2; e.bottom = playerNS::HEIGHT / 2; e.top = -playerNS::HEIGHT / 2; setEdge(e); inventory = new Inventory(); hpMax = 100; health = 100; setVelocity(VECTOR2(0, 0)); }
void Foam::blockDescriptor::makeBlockEdges() { const label ni = meshDensity_.x(); const label nj = meshDensity_.y(); const label nk = meshDensity_.z(); // these edges correspond to the "hex" cellModel // x-direction setEdge(0, 0, 1, ni); setEdge(1, 3, 2, ni); setEdge(2, 7, 6, ni); setEdge(3, 4, 5, ni); // y-direction setEdge(4, 0, 3, nj); setEdge(5, 1, 2, nj); setEdge(6, 5, 6, nj); setEdge(7, 4, 7, nj); // z-direction setEdge(8, 0, 4, nk); setEdge(9, 1, 5, nk); setEdge(10, 2, 6, nk); setEdge(11, 3, 7, nk); }
void Graph::removeEdge(unsigned int v, unsigned int u) throw(std::out_of_range) { setEdge(v, u, false); }
void LayoutSwitcher::relayout( void ) { setEdge(_edge); }
/** Reverse stone. */ void reverse(void) { _bit_stone = reverseHorizontal(_bit_stone); _reversed = true; setEdge(); }
/** Rotate 90 degrees. */ void rotate90(void) { _bit_stone = procon26::rotate90(_bit_stone); _rotate = ONE; setEdge(); }
/** Rotate 180 degrees. */ void rotate180(void) { _bit_stone = procon26::rotate180(_bit_stone); _rotate = TWO; setEdge(); }
/** Rotate 270 degrees. */ void rotate270(void) { _bit_stone = procon26::rotate270(_bit_stone); _rotate = THREE; setEdge(); }
void Graph::addEdge(unsigned int v, unsigned int u) throw(std::out_of_range) { setEdge(v, u, true); }