bool DroppedFile::open(Mode newmode) { if (newmode == MODE_CLOSED) return true; // File already open? if (file != nullptr) return false; #ifdef LOVE_WINDOWS // make sure non-ASCII filenames work. std::wstring modestr = to_widestr(getModeString(newmode)); std::wstring wfilename = to_widestr(filename); file = _wfopen(wfilename.c_str(), modestr.c_str()); #else file = fopen(filename.c_str(), getModeString(newmode)); #endif if (newmode == MODE_READ && file == nullptr) throw love::Exception("Could not open file %s. Does not exist.", filename.c_str()); mode = newmode; if (file != nullptr && !setBuffer(bufferMode, bufferSize)) { // Revert to buffer defaults if we don't successfully set the buffer. bufferMode = BUFFER_NONE; bufferSize = 0; } return file != nullptr; }
String LEDGroup::getGroupInfo() { String rv("{\"count\":"); rv += String(size()); rv += ",\"m\":\""; rv += getModeString(_mode); rv += "\"}"; return rv; }
std::ostream& ossimWatermarkFilter::print(std::ostream& out) const { out << "ossimWatermarkFilter::print" << "\ntheFilename: " << theFilename << "\ntheWatermarkWeight: " << theWatermarkWeight << "\ntheMode: " << getModeString() << std::endl; return ossimImageSourceFilter::print(out); }
void DrawGame::CircleSprite::drawFace() { ofPushStyle(); ofColor FaceColor = White?ofColor::black:ofColor::white; ofSetColor(FaceColor); DrawGame::drawScaledStringByFont( getModeString(),pFont,ofVec2f(0,0),1.2f,1.2f); ofPopStyle(); }
void Viewer::changePerspective(int dx, bool L, bool M, bool R) { if (L) fov += dx * FOV_FACTOR; // Enforce limits fov = std::max(MIN_FOV, std::min(MAX_FOV, fov)); if (M) near += dx * TRANSLATE_FACTOR; if (R) far += dx * TRANSLATE_FACTOR; // Enforce limits near = std::max(MIN_NEAR, std::min(near, far)); far = std::max(MIN_NEAR, std::max(near, far)); appWindow->updateMessage(getModeString(), near, far); }
bool ossimWatermarkFilter::saveState(ossimKeywordlist& kwl, const char* prefix) const { kwl.add(prefix, ossimKeywordNames::FILENAME_KW, theFilename.c_str()); kwl.add(prefix, WATERMARK_MODE_KW, getModeString().c_str()); kwl.add(prefix, WEIGHT_KW, theWatermarkWeight); return ossimImageSourceFilter::saveState(kwl, prefix); }
bool File::openStream(const FileName &fileName, FILE_MODE mode) { this->fileName = fileName; const char *pszMode = getModeString(mode); stream = fopen(fileName.c_str(), pszMode); if(stream==0 || ferror(stream)) { // Failed to open file stream return false; } return true; }
ossimRefPtr<ossimProperty> ossimWatermarkFilter::getProperty( const ossimString& name) const { // Lock for the length of this method. if (name == ossimKeywordNames::FILENAME_KW) { ossimFilenameProperty* ofp = new ossimFilenameProperty(name, theFilename); ofp->setIoType(ossimFilenameProperty::ossimFilenamePropertyIoType_INPUT); ofp->setCacheRefreshBit(); return ossimRefPtr<ossimProperty>((ossimProperty*)ofp); } else if (name == WATERMARK_MODE_KW) { vector<ossimString> constraintList; getModeList(constraintList); ossimStringProperty* p = new ossimStringProperty(name, getModeString(), false, constraintList); p->setCacheRefreshBit(); return ossimRefPtr<ossimProperty>(p); } else if (name == WEIGHT_KW) { ossimProperty* p = new ossimNumericProperty(name, ossimString::toString(theWatermarkWeight)); p->setCacheRefreshBit(); return ossimRefPtr<ossimProperty>(p); } return ossimImageSourceFilter::getProperty(name); }
void Viewer::setMode(Mode newMode) { vpDrag = false; mode = newMode; appWindow->updateMessage(getModeString(), near, far); }