void WPopupMenu::popup(const WPoint& p) { popupImpl(); // make sure we are not confused by client-side being positioned properly setOffsets(42, Left | Top); setOffsets(-10000, Left | Top); doJavaScript(WT_CLASS ".positionXY('" + id() + "'," + boost::lexical_cast<std::string>(p.x()) + "," + boost::lexical_cast<std::string>(p.y()) + ");"); }
//-------------------------------------------------------------- // Loads the settings from the Client INI file. //-------------------------------------------------------------- void mpeClientTCP::loadIniFile(string _fileString) { out("Loading settings from file " + _fileString); ofxXmlSettings xmlReader; if (!xmlReader.loadFile(_fileString)) err("ERROR loading XML file!"); // parse INI file hostName = xmlReader.getValue("settings:server:ip", "127.0.0.1", 0); serverPort = xmlReader.getValue("settings:server:port", 7887, 0); id = xmlReader.getValue("settings:client_id", -1, 0); setLocalDimensions(xmlReader.getValue("settings:local_dimensions:width", 640, 0), xmlReader.getValue("settings:local_dimensions:height", 480, 0)); setOffsets(xmlReader.getValue("settings:local_location:x", 0, 0), xmlReader.getValue("settings:local_location:y", 0, 0)); setMasterDimensions(xmlReader.getValue("settings:master_dimensions:width", 640, 0), xmlReader.getValue("settings:master_dimensions:height", 480, 0)); if (xmlReader.getValue("settings:go_fullscreen", "false", 0).compare("true") == 0) ofSetFullscreen(true); if(xmlReader.getValue("settings:offset_window", "false", 0).compare("true") == 0) ofSetWindowPosition(xOffset, yOffset); if (xmlReader.getValue("settings:debug", 0, 0) == 1) DEBUG = true; out("Settings: server = " + hostName + ":" + ofToString(serverPort) + ", id = " + ofToString(id) + ", local dimensions = " + ofToString(lWidth) + ", " + ofToString(lHeight) + ", location = " + ofToString(xOffset) + ", " + ofToString(yOffset)); }
ITG3200::ITG3200() { setOffsets(0,0,0); setScaleFactor(1.0, 1.0, 1.0, false); // true to change readGyro output to radians //Wire.begin(); //Normally this code is called from setup() at user code //but some people reported that joining I2C bus earlier //apparently solved problems with master/slave conditions. //Uncomment if needed. }
ViCodingChain::ViCodingChain() : QThread() { mInput = NULL; mOutput = NULL; setOffsets(-1, -1); setMode(ViCodingChain::Unknown); }
ITG3200::ITG3200() { setGains(1.0,1.0,1.0); setOffsets(0,0,0); setRevPolarity(0,0,0); //Wire.begin(); //Normally this code is called from setup() at user code //but some people reported that joining I2C bus earlier //apparently solved problems with master/slave conditions. //Uncomment if needed. }
void SAT_Gyro::zeroCalibrate(unsigned int totSamples, unsigned int sampleDelayMS) { float tmpOffsets[] = {0,0,0}; int xyz[3]; for (int i = 0;i < totSamples;i++){ delay(sampleDelayMS); readGyroRaw(xyz); tmpOffsets[0] += xyz[0]; tmpOffsets[1] += xyz[1]; tmpOffsets[2] += xyz[2]; } setOffsets(-tmpOffsets[0] / totSamples + 0.5, -tmpOffsets[1] / totSamples + 0.5, -tmpOffsets[2] / totSamples + 0.5); }
void ITG3200::zeroCalibrate(unsigned int totSamples, unsigned int sampleDelayMS) { short xyz[3]; float tmpOffsets[] = {0,0,0}; for (int i = 0;i < totSamples;i++){ delay(sampleDelayMS); readGyroRaw(xyz); tmpOffsets[0] += xyz[0]; tmpOffsets[1] += xyz[1]; tmpOffsets[2] += xyz[2]; } setOffsets(-tmpOffsets[0] / totSamples, -tmpOffsets[1] / totSamples, -tmpOffsets[2] / totSamples); }
//-------------------------------------------------------------- // Loads the settings from the Client XML file. //-------------------------------------------------------------- void mpeClientTCP::loadIniFile(string _fileString) { out("Loading settings from file " + _fileString); ofxXmlSettings xmlReader; if (!xmlReader.loadFile(_fileString)){ err("ERROR loading XML file!"); return; } // parse INI file hostName = xmlReader.getValue("settings:server:ip", "127.0.0.1", 0); serverPort = xmlReader.getValue("settings:server:port", 7887, 0); //turn this off if you don't want this client to sync frames but can still //receive messages. default is ON as that's the normal behavior frameLock = xmlReader.getValue("settings:framelock", true); if(frameLock){ id = xmlReader.getValue("settings:client_id", -1, 0); clientName = xmlReader.getValue("settings:client_name", "noname", 0); } else{ cout << "opting out of frame lock" << endl; } cout << "***MPE:: HOST IS " << hostName << " Server Port is " << serverPort << endl; setLocalDimensions(xmlReader.getValue("settings:local_dimensions:width", 640, 0), xmlReader.getValue("settings:local_dimensions:height", 480, 0)); setOffsets(xmlReader.getValue("settings:local_location:x", 0, 0), xmlReader.getValue("settings:local_location:y", 0, 0)); setMasterDimensions(xmlReader.getValue("settings:master_dimensions:width", 640, 0), xmlReader.getValue("settings:master_dimensions:height", 480, 0)); goFullScreen = xmlReader.getValue("settings:go_fullscreen", "false", 0).compare("true") == 0; offsetWindow = xmlReader.getValue("settings:offset_window", "false", 0).compare("true") == 0; setupViewport(); if (xmlReader.getValue("settings:debug", 0, 0) == 1){ DEBUG = true; } if(xmlReader.getValue("settings:simulation:on", 0, 0) == 1){ useSimulationMode(xmlReader.getValue("settings:simulation:fps", 30)); cout << "using simulation mode" << endl; } out("Settings: server = " + hostName + ":" + ofToString(serverPort) + ", id = " + ofToString(id) + ", local dimensions = " + ofToString(lWidth) + ", " + ofToString(lHeight) + ", location = " + ofToString(xOffset) + ", " + ofToString(yOffset)); }
void CMD_SetOffsets(){ byte dev, axis; int val; while(!Serial.available()){ if( checkTimeOut() ) return; } digitalWrite(SERIALPIN, LOW); dev = Serial.read(); digitalWrite(SERIALPIN, HIGH); while(!Serial.available()){ if( checkTimeOut() ) return; } digitalWrite(SERIALPIN, LOW); axis = Serial.read(); digitalWrite(SERIALPIN, HIGH); if( axis != 0xFF ){ while(!Serial.available()){ if( checkTimeOut() ) return; } digitalWrite(SERIALPIN, LOW); val = Serial.read(); digitalWrite(SERIALPIN, HIGH); while(!Serial.available()){ if( checkTimeOut() ) return; } digitalWrite(SERIALPIN, LOW); val = (val << 8) + Serial.read(); digitalWrite(SERIALPIN, HIGH); } setOffsets(dev, axis, val); pendAccelOffTM(); pendGyroOffTM(); }
int ITG3200::zeroCalibrate(unsigned int totSamples, unsigned int sampleDelayMS) { int a=0; int xyz[3]; float tmpOffsets[] = {0,0,0}; for (int i = 0;i < totSamples;i++){ ms_delay(sampleDelayMS); a=readGyroRaw(xyz); if(a<0){ return -1; } //MYASSERT(a,"Failed to read sensor data for offset\n\r") tmpOffsets[0] += xyz[0]; tmpOffsets[1] += xyz[1]; tmpOffsets[2] += xyz[2]; } setOffsets(-tmpOffsets[0] / totSamples+0.5, -tmpOffsets[1] / totSamples+0.5, -tmpOffsets[2] / totSamples+0.5); return 0; }
/** * Initialize mapper for the given network and the current mode. Create global * arrays that contain offsets that will be used to create vector from the * network component objects * @param network network that will generate vector */ GenVectorMap(boost::shared_ptr<_network> network) : p_network(network) { p_Offsets = NULL; p_timer = NULL; //p_timer = gridpack::utility::CoarseTimer::instance(); p_GAgrp = network->communicator().getGroup(); p_me = GA_Pgroup_nodeid(p_GAgrp); p_nNodes = GA_Pgroup_nnodes(p_GAgrp); p_Offsets = new int[p_nNodes]; p_nBuses = p_network->numBuses(); p_nBranches = p_network->numBranches(); getDimensions(); setOffsets(); setIndices(); GA_Pgroup_sync(p_GAgrp); }
void ViCodingChain::reset() { mError = ViCoder::NoError; if(mInput != NULL) { mInput->disconnect(); } mDecoder.disconnect(); mEncoder.disconnect(); if(mOutput != NULL) { mOutput->disconnect(); } mInputFilePath = ""; mInputData = NULL; mInput = NULL; mOutput = NULL; mInputCoder = NULL; mOutputCoder = NULL; setOffsets(-1, -1); }
void WDialog::positionAt(const WWidget *widget, Orientation orientation) { setPositionScheme(Absolute); setOffsets(0, Left | Top); WCompositeWidget::positionAt(widget, orientation); }
//-------------------------------------------------------------- // Sets the dimensions for the local display. // The offsets are used to determine what part of the Master Dimensions to render. // For example, if you have two screens, each 100x100, and the master dimensions are 200x100 // then you would set // client 0: setLocalDimensions(0, 0, 100, 100); // client 1: setLocalDimensions(100, 0, 100, 100); // for a 10 pixel overlap you would do: // client 0: setLocalDimensions(0, 0, 110, 100); // client 1: setLocalDimensions(90, 0, 110, 100); //-------------------------------------------------------------- void mpeClientTCP::setLocalDimensions(int _xOffset, int _yOffset, int _lWidth, int _lHeight) { setOffsets(_xOffset, _yOffset); setLocalDimensions(_lWidth, _lHeight); }
void WWidget::setOffsets(int pixels, WFlags<Side> sides) { setOffsets(WLength(pixels), sides); }
PhysicalAttack::PhysicalAttack(sf::Vector2f position, Direction dir, double damage) : Attack(position, dir, damage){ loadTexture("images/attackspritesheet.png"); setOffsets(dir); sprite.setPosition(position.x+offsetX, position.y+offsetY); loadColor(); }
//-------------------------------------------------------------- // Sets the dimensions for the local display. // The offsets are used to determine what part of the Master Dimensions to render. // For example, if you have two screens, each 100x100, and the master dimensions are 200x100 // then you would set // client 0: setLocalDimensions(0, 0, 100, 100); // client 1: setLocalDimensions(100, 0, 100, 100); // for a 10 pixel overlap you would do: // client 0: setLocalDimensions(0, 0, 110, 100); // client 1: setLocalDimensions(90, 0, 110, 100); //-------------------------------------------------------------- void ofxMPEClient::setLocalDimensions(int _xOffset, int _yOffset, int _lWidth, int _lHeight) { setOffsets(_xOffset, _yOffset); setLocalDimensions(_lWidth, _lHeight); }