bool StGLStereoFrameBuffer::initLazy(StGLContext& theCtx, const GLsizei theSizeX, const GLsizei theSizeY, const bool theNeedDepthBuffer, const bool theToCompress) { if(isValid() && (theSizeX <= getSizeX() && getSizeX() < theCtx.getMaxTextureSize()) && (theSizeY <= getSizeY() && getSizeY() < theCtx.getMaxTextureSize())) { if(!theToCompress || (((getSizeX() - theSizeX) < 256) && ((getSizeY() - theSizeY) < 256))) { setVPDimensions(theCtx, theSizeX, theSizeY); return true; } } release(theCtx); GLsizei aSizeX = stMax(32, (GLsizei )getAligned(theSizeX, 256)); GLsizei aSizeY = stMax(32, (GLsizei )getAligned(theSizeY, 256)); if(!theCtx.arbNPTW) { StGLFrameBuffer::convertToPowerOfTwo(theCtx, aSizeX, aSizeY); } if(!init(theCtx, aSizeX, aSizeY, theNeedDepthBuffer)) { return false; } theCtx.stglFillBitsFBO(myGLFBufferIds[StGLStereoTexture::LEFT_TEXTURE], aSizeX, aSizeY); ST_DEBUG_LOG("FBO resized to " + aSizeX + " x " + aSizeY + " (for " + theSizeX + " x " + theSizeY + ")"); setVPDimensions(theCtx, theSizeX, theSizeY); return true; }
void HexagonGame::recreateTextures() { gameTexture.create(getSizeX(), getSizeY(), 32); gameTexture.setView(View{Vector2f{0,0}, Vector2f{getSizeX() * getZoomFactor(), getSizeY() * getZoomFactor()}}); gameTexture.setSmooth(true); gameSprite.setTexture(gameTexture.getTexture(), false); gameSprite.setOrigin(getSizeX()/ 2, getSizeY()/ 2); gameSprite.setPosition(window.getWidth() / 2, window.getHeight() / 2); }
void TPZNetworkSquareMidimew :: initialize() { if( isInitializated() ) return; /* Check consistency of parameters */ if(getSizeY()!=1 ||getSizeZ()!=1) { TPZString err; err.sprintf( ERR_TPZTONET_002, (char*)getRouterId() ); err.sprintf("\nSquare Midimew Network Ysize and Zsize must be 1. Al nodes in Xsize!"); EXIT_PROGRAM(err); } if((int)ceil(sqrt((float)getSizeX()))%2 || getSizeX() < 4 ) { TPZString err; err.sprintf( ERR_TPZTONET_002, (char*)getRouterId() ); err.sprintf("\n Square Midimew Network Xsize must be an even 2's power(4,16,64,256,1024,4096...)"); EXIT_PROGRAM(err); } if( !getSizeX() || !getSizeY() || !getSizeZ() ) { TPZString err; err.sprintf(ERR_TPZTONET_001, getSizeX(), getSizeY(), getSizeZ() ); EXIT_PROGRAM(err); } /* Create the routers for each node */ int i; for( i=0; i<getSizeX(); i++ ) { TPZPosition pos(i,0,0); TPZRouter* newRouter = (TPZRouter*) (TPZRouter::routerBuilder->createComponentWithId(getRouterId(),this)); if( ! newRouter ) { TPZString err; err.sprintf( ERR_TPZTONET_002, (char*)getRouterId() ); EXIT_PROGRAM(err); } newRouter->setPosition(pos); addRouter(newRouter); } /* Connect the routers together */ for( i=0; i<getSizeX(); i++ ) { initializeConnectionsFor(TPZPosition(i,0,0)); } /* Other initialization tasks */ generateRoutingTable(); setInitializated(true); setSimulation(getSimulation()); }
// getClientRect //--------------------------------------------------------------------------- // Purpose: //--------------------------------------------------------------------------- iRect View::getClientRect() const { if (getBordered()) { return iRect( borderSize, borderSize + moveAreaHeight, getSizeX() - borderSize, getSizeY() - borderSize); } return iRect(0, 0, getSizeX(), getSizeY()); } // end View::getClientRect
void VoxelField::setSpheres( float phase ) { setAllValues( -0.5f ); float x = 0.3 * getSizeX() * sin(phase*0.1) + 0.5 * getSizeX(); float y = 0.3 * getSizeY() * cos(phase*0.2) + 0.5 * getSizeY(); float z = 0.3 * getSizeZ() * sin(1+phase*0.15) + 0.5 * getSizeZ(); float rad = getSizeX() / 3; addSphere( x, y, z, rad ); addSphere( y, z, x, rad ); addSphere( z, x, y, rad ); addSphere( z, y, x, rad ); addSphere( y, x, z, rad ); addSphere( x, z, y, rad ); }
void equalizeHistogram () { real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); Abstract2dData::getRealSpaceData(&rdata); SingleParticle2dx::Utilities::DataContainerFunctions::equalizeHistogram(&rdata); Abstract2dData::setFourierSpaceData(&rdata); }
void MinimalTIFFWriter::setupIFD() const { // Default to single strips for now. ifd->setImageWidth(getSizeX()); ifd->setImageHeight(getSizeY()); ifd->setTileType(tiff::STRIP); ifd->setTileWidth(getSizeX()); ifd->setTileHeight(1U); ome::compat::array<dimension_size_type, 3> coords = getZCTCoords(getPlane()); dimension_size_type channel = coords[1]; ifd->setPixelType(getPixelType()); ifd->setBitsPerSample(bitsPerPixel(getPixelType())); ifd->setSamplesPerPixel(getRGBChannelCount(channel)); const boost::optional<bool> interleaved(getInterleaved()); if (isRGB(channel) && interleaved && *interleaved) ifd->setPlanarConfiguration(tiff::CONTIG); else ifd->setPlanarConfiguration(tiff::SEPARATE); // This isn't necessarily always true; we might want to use a // photometric interpretation other than RGB with three // subchannels. if (isRGB(channel) && getRGBChannelCount(channel) == 3) ifd->setPhotometricInterpretation(tiff::RGB); else ifd->setPhotometricInterpretation(tiff::MIN_IS_BLACK); }
// doDraw //--------------------------------------------------------------------------- void RankView::doDraw(Surface &viewArea, Surface &clientArea) { unsigned int flagHeight = ResourceManager::getFlag(0)->getHeight(); unsigned int newheight = HEADER_HEIGHT + (TABLE_BORDER * 2) + (ENTRY_HEIGHT * PlayerInterface::countPlayers()) + DEFAULT_MOVE_AREA_HEIGHT + (DEFAULT_BORDER_SIZE * 2); if ( newheight != (unsigned int)getSizeY() ) { resize(WINDOW_WIDTH, newheight); return; // this frame draws nothing } bltViewBackground(viewArea); clientArea.drawButtonBorder( iRect(0, TABLE_BORDER_START, clientArea.getWidth()-1, clientArea.getHeight()-1), Color::gray64, Color::white); clientArea.bltStringShadowed(0, 16, table_header, Color::red, Color::gray64); drawPlayerStats(clientArea, flagHeight); View::doDraw(viewArea, clientArea); } // end doDraw
void GameMap::createStructures() { //read structure data from tmx file auto ob_group = _tile_map->getObjectGroup("structures"); CCASSERT(ob_group, "no object group structures"); for (auto iter = std::begin(ob_group->getObjects()); iter != std::end(ob_group->getObjects()); iter++) { float width = iter->asValueMap()["width"].asFloat(); float height = iter->asValueMap()["height"].asFloat(); float x = iter->asValueMap()["x"].asFloat() + width * 0.5f; float y = iter->asValueMap()["y"].asFloat() - getSizeY() + _tile_map->getTileSize().height + height * 1.5f; float mx = iter->asValueMap()["marginX"].asFloat(); float my = iter->asValueMap()["marginY"].asFloat(); std::string name = iter->asValueMap()["name"].asString(); float radius = iter->asValueMap()["radius"].asFloat(); bool shadow = iter->asValueMap()["shadow"].asBool(); _structures.emplace_back( Structure::create( _game_world, new geometry::Circle(Vec2(x, y) - Vec2(mx, my), radius), name, Vec2(x, y), radius)); } }
bool FieldExporter::FieldExporterCSV::save(const FieldHorizontalPlane* plane, std::string filename, double min_value, bool save3d, int numdec) { if (Config::getInstance().isWarnOverwriteSimulations() && Utils::abortOnExistingAndDontOverwrite(filename)) return false; try { const auto values = plane->get(); FileWriter bw(filename); bw.write("X\tY\t" + (save3d ? "Z\t" : std::string("")) + "CE(V/m)\n"); const double Z = plane->getZ(); for (unsigned yi = 0; yi<values.getSizeY(); yi++) { const double realy = plane->getCoordY(yi); for (unsigned xi = 0; xi<values.getSizeX(); xi++) { const double realx = plane->getCoordX(xi);; const double value = values.get(xi, yi); if (min_value <= 0 || value>min_value) bw.write("" + std::to_string(realx) + "\t" + std::to_string(realy) + "\t" + (save3d ? std::to_string(Z) + "\t" : "") + Utils::formatDouble(value, numdec) + "\n"); } } bw.close(); return true; } catch (const std::exception& e) { Utils::MessageBox("Error saving Field:\n" + std::string(e.what()), "ERROR"); return false; } }
void SingleParticle2dx::DataStructures::Particle::flipXYAxis() { real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); getRealSpaceData(&rdata); SingleParticle2dx::Utilities::DataContainerFunctions::applyMirrorXY(&rdata); setFourierSpaceData(&rdata); }
void addGaussianNoise(value_type sd) { real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); Abstract2dData::getRealSpaceData(&rdata); SingleParticle2dx::Utilities::DataContainerFunctions::addGaussianNoise(&rdata, sd); SingleParticle2dx::Utilities::DataContainerFunctions::normalizeRealSpaceData(&rdata); Abstract2dData::setFourierSpaceData(&rdata); }
// Tests to see if we can move dx, dy; returns true if we can bool Block::testMove(const int dx, const int dy) const { return ( (x + dx) >= 1 && (x + getSizeX() + dx - 1) <= BOARD_X_SIZE && (y + dy) >= 1 && (y + getSizeY() + dy - 1) <= BOARD_Y_SIZE ); }
void StGLStereoFrameBuffer::setVPDimensions(StGLContext& theCtx, const GLsizei theSizeX, const GLsizei theSizeY) { GLsizei aVPSizeX = stMin(theSizeX, getSizeX()); GLsizei aVPSizeY = stMin(theSizeY, getSizeY()); if(aVPSizeX != myViewPortX || aVPSizeY != myViewPortY) { GLfloat aDX = GLfloat(aVPSizeX) / GLfloat(getSizeX()); GLfloat aDY = GLfloat(aVPSizeY) / GLfloat(getSizeY()); StArray<StGLVec2> aTCoords(4); aTCoords[0] = StGLVec2(aDX, 0.0f); aTCoords[1] = StGLVec2(aDX, aDY); aTCoords[2] = StGLVec2(0.0f, 0.0f); aTCoords[3] = StGLVec2(0.0f, aDY); myTexCoordBuf.init(theCtx, aTCoords); myViewPortX = aVPSizeX; myViewPortY = aVPSizeY; } }
void Window::processCommands(CommunicationBuffer* fromGame, CommunicationBuffer* toGame) { core::WinMsg cmd; while( fromGame->peek(cmd) ) { switch( cmd.type ) { case core::WinMsgType::LockCursor: { setLockCursor(cmd.lockCursor); } break; case core::WinMsgType::ShowCursor: { setShowCursor(cmd.showCursor); } break; case core::WinMsgType::RelativeCursor: { setRelativeCursor(cmd.relativeCursor); } break; case core::WinMsgType::Fullscreen: { setFullscreen(cmd.fullscreen); } break; case core::WinMsgType::Size: { resize(cmd.screen.x, cmd.screen.y); WinMsg msg{}; msg.type = core::WinMsgType::Size; msg.screen.x = getSizeX(); msg.screen.y = getSizeY(); toGame->writeEvent(msg); } break; case core::WinMsgType::Position: { move(cmd.screen.x, cmd.screen.y); } break; case core::WinMsgType::FileChange: { monitorDirectoryForChanges(cmd.fileChange.name); } break; case core::WinMsgType::Close: { close(); } break; } } }
void SingleParticle2dx::DataStructures::Particle::scale(value_type s) { if ( fabs(s-value_type(1)) < 1e-5 ) { //std::cout << "don't scale, factor to close to zero" << std::endl; return; } real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); real_array_type rdata2set( boost::extents[getSizeX()][getSizeY()] ); getRealSpaceData(&rdata); size_type n = getSizeX(); value_type pos_x, pos_y; size_type x_l, x_u, y_l, y_u; value_type s_x, s_y; for(size_type i=0; i<n; i++) { for(size_type j=0; j<n; j++) { pos_x = ((i-n/2)*s) + n/2; pos_y = ((j-n/2)*s) + n/2; x_l = floor(pos_x); x_u = x_l+1; y_l = floor(pos_y); y_u = y_l+1; s_x = pos_x - x_l; s_y = pos_y - y_l; rdata2set[i][j] = (1-s_x) * (1-s_y) * rdata[x_l][y_l] + (1-s_x) * ( s_y) * rdata[x_l][y_u] + ( s_x) * (1-s_y) * rdata[x_u][y_l] + ( s_x) * ( s_y) * rdata[x_u][y_u]; } } setFourierSpaceData(&rdata2set); }
TPZString TPZNetworkSquareMidimew :: asString() const { TPZGlobalData& data = ((TPZSimulation*)getSimulation())->globalData((TPZNetwork*)this); TPZString rs= "SquareMidimew("; rs += TPZString(getSizeX()) + "," + TPZString(getSizeY()) + "," + TPZString(getSizeZ()) + ")" + "\n Buffer control : " + data.routerBufferControl() + "\n Routing control: " + data.routerRoutingControl(); return rs; }
bool FieldExporter::FieldExporterCSV::save(const FieldHeights* field, std::string filename, std::string separator, int xdigits, int ydigits) { if (Config::getInstance().isWarnOverwriteSimulations() && Utils::abortOnExistingAndDontOverwrite(filename)) return false; try { const auto minvalues = field->getMinvalues(); const auto maxvalues = field->getMaxvalues(); const glm::vec2 spacing = field->getSpacing(); const glm::vec2 center = field->getCenter(); FileWriter bw(filename); bw.write("X" + separator + "Y" + separator + "Hmin" + separator + "Hmax\n"); const double spacingx = spacing.x; const double spacingy = spacing.y; for (unsigned yi = 0; yi<minvalues.getSizeY(); yi++) { const double realy = center.y + spacingy*(yi - (static_cast<double>(minvalues.getSizeY()) - 1) / 2); for (unsigned xi = 0; xi<minvalues.getSizeX(); xi++) { const double realx = center.x + spacingx*(xi - (static_cast<double>(minvalues.getSizeX()) - 1) / 2); // salva solo se in questo punto esiste (almeno) un'altezza (con valore di campo > examination_value) const double minvalue = minvalues.get(xi, yi); const double maxvalue = maxvalues.get(xi, yi); if (minvalue != FieldHeights::UNUSED || maxvalue != FieldHeights::UNUSED) bw.write("" + Utils::formatDouble(realx, xdigits) + separator + Utils::formatDouble(realy, xdigits) + separator + (minvalue != FieldHeights::UNUSED ? Utils::formatDouble(minvalue, ydigits) : "") + separator + (maxvalue != FieldHeights::UNUSED ? Utils::formatDouble(maxvalue, ydigits) : "") + "\n"); } } bw.close(); return true; } catch (const std::exception& e) { Utils::MessageBox("Error saving FieldHeights:\n" + std::string(e.what()), "ERROR"); return false; } }
//------------------------------------------------------------------------------ // collisionCheck() -- True if we collide with the test block //------------------------------------------------------------------------------ bool Block::collisionCheck(const Block* const b2) const { bool c = false; for (unsigned int i = 0; i < getSizeX() && !c; i++) for (unsigned int j = 0; j < getSizeY() && !c; j++) { unsigned int xx = x + i; unsigned int yy = y + j; if ( xx >= b2->x && xx <= (b2->x + b2->getSizeX() - 1) && yy >= b2->y && yy <= (b2->y + b2->getSizeY() - 1) ) c = true; } return c; }
void GameMap::createGraph() { //SparseGraph uses special mechanism in addChild, //then the index will be changed after insert. //So we have to remember them. std::map<int, int> index_change_map; auto node_group = _tile_map->getObjectGroup("nodes"); for (auto iter = std::begin(node_group->getObjects()); iter != std::end(node_group->getObjects()); iter++) { int index = iter->asValueMap()["index"].asInt(); int extra = iter->asValueMap()["extra"].asInt(); float x = iter->asValueMap()["x"].asFloat(); float y = iter->asValueMap()["y"].asFloat() - getSizeY() + _tile_map->getTileSize().height; int real_index = (*_nav_graph).getNextFreeNodeIndex(); (*_nav_graph).addNode(NavGraph::Node(real_index, cocos2d::Vec2(x, y))); index_change_map.insert(std::make_pair(index, real_index)); } auto edge_group = _tile_map->getObjectGroup("edges"); for (auto iter = std::begin(edge_group->getObjects()); iter != std::end(edge_group->getObjects()); iter++) { int from = iter->asValueMap()["from"].asInt(); int to = iter->asValueMap()["to"].asInt(); int flag = iter->asValueMap()["flag"].asInt(); int real_from = index_change_map[from]; int real_to = index_change_map[to]; //calculate the distance to this node cocos2d::Vec2 pos_from_node = (*_nav_graph).getNode(real_from).getPos(); cocos2d::Vec2 pos_to_node = (*_nav_graph).getNode(real_to).getPos(); double dist = (pos_from_node - pos_to_node).getLength(); //this neighbour is okay so it can be added NavGraph::Edge new_edge(real_from, real_to, dist); (*_nav_graph).addEdge(new_edge); //if graph is not a diagraph then an edge needs to be added going //in the other direction if (!(*_nav_graph).isDigraph()) { NavGraph::Edge new_edge(real_to, real_from, dist); (*_nav_graph).addEdge(new_edge); } } }
void GameMap::createCollisionAreas() { auto ob_group = _tile_map->getObjectGroup("structures_no_image"); CCASSERT(ob_group, "no object group (structures_no_image)"); for (auto iter = std::begin(ob_group->getObjects()); iter != std::end(ob_group->getObjects()); iter++) { float width = iter->asValueMap()["width"].asFloat(); float height = iter->asValueMap()["height"].asFloat(); float x = iter->asValueMap()["x"].asFloat(); float y = iter->asValueMap()["y"].asFloat() - getSizeY() + _tile_map->getTileSize().height; std::string type = iter->asValueMap()["type"].asString(); if (type == "Polygon") { ValueVector points = iter->asValueMap()["polylinePoints"].asValueVector(); std::vector<cocos2d::Vec2> poly; for (int i = 0; i < points.size(); i++) { ValueMap a = points[i].asValueMap(); float xy = a["x"].asFloat(); float yy = a["y"].asFloat(); poly.push_back(cocos2d::Vec2(xy + x, y - yy)); } poly.pop_back(); geometry::Circle min_circle = geometry::enclosingCircleNaive(poly); _collision_areas.emplace_back( CollisionArea::create( _game_world, new geometry::Polygon(poly), min_circle.origin, min_circle.radius)); } else if (type == "Circle") { float radius = width / 2; _collision_areas.emplace_back( CollisionArea::create( _game_world, new geometry::Circle(Vec2(x + width * 0.5f, y + height * 0.5f), radius), Vec2(x + width * 0.5f, y + height * 0.5f), radius)); } } }
// Tests to see if we can move dx, dy; returns true if we can bool Block::testMove(const int dx, const int dy, const Puzzle* const puz) const { bool ok = false; if (puz != 0) { ok = ( (x + dx) >= 1 && (x + getSizeX() + dx - 1) <= puz->getBoardSizeX() && (y + dy) >= 1 && (y + getSizeY() + dy - 1) <= puz->getBoardSizeX() ); } return ok; }
bool StImagePlane::fill(const StImagePlane& theCopy) { if(getSizeY() != theCopy.getSizeY() || getSizeRowBytes() != theCopy.getSizeRowBytes() || getFormat() != theCopy.getFormat()) { return initCopy(theCopy); } for(size_t row = 0; row < theCopy.getSizeY(); ++row) { stMemCpy(changeData(row, 0), theCopy.getData(row, 0), theCopy.getSizeRowBytes()); } return true; }
// getClientArea //--------------------------------------------------------------------------- // Purpose: //--------------------------------------------------------------------------- Surface* View::getClientArea(Surface& dest) { Surface* viewarea = getViewArea(dest); if (getBordered()) { iRect rect( borderSize, borderSize+moveAreaHeight, getSizeX() - borderSize, getSizeY() - borderSize ); Surface *ns = new Surface(); ns->setTo(*viewarea, rect); delete viewarea; return ns; } return viewarea; } // end View::getClientArea
/** * @brief Write interally stored data to file * @details Performs a BW-FFT and stores the result to a .mrc-file * Result is normalized. Don't forget to pass the .mrc-ending * @param[in] filename Where to store the real space data */ void writeToFile (std::string filename) { std::cout << "Storing 2d data to file" << std::endl; real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); getRealSpaceData(&rdata); if(SingleParticle2dx::Utilities::DataContainerFunctions::checkData(&rdata)) { std::cerr << "bad 2d structure to store" << std::endl; throw std::runtime_error("Bad operation"); } SingleParticle2dx::Utilities::MRCFileIO::writeToMrc(&rdata, filename); }
bool SingleParticle2dx::DataStructures::Particle::checkParticle() { real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); getRealSpaceData(&rdata); if (SingleParticle2dx::Utilities::DataContainerFunctions::checkData(&rdata)) { return false; } if (SingleParticle2dx::Utilities::DataContainerFunctions::calculateSD(&rdata) < 1e-5) { return false; } return true; }
void setMidddleTarget() { size_type n = getSizeX(); real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); normalizeRealSpace(); getRealSpaceData(&rdata); for(size_type i=0; i<n; i++) { for(size_type j=0; j<n; j++) { if( (i==n/2) || (j==n/2) || ((i-1)==n/2) || ((j-1)==n/2) ) { rdata[i][j] += 2.5; } } } normalizeRealSpace(); setFourierSpaceData(&rdata); }
// doDraw //--------------------------------------------------------------------------- void RankView::doDraw(Surface &viewArea, Surface &clientArea) { // make sure the window is big enough for all players unsigned int CHAR_YPIX = Surface::getFontHeight(); unsigned int entryheight = std::max(CHAR_YPIX, UNIT_FLAGS_SURFACE.getHeight()) + 2; unsigned int newheight = 60 + entryheight * PlayerInterface::countPlayers(); if ( newheight != (unsigned int)getSizeY() ) { resize(iXY(450, newheight)); return; // this frame draws nothing } bltViewBackground(viewArea); clientArea.drawButtonBorder( iRect(0, 26, getClientRect().getSize().x - 1, getClientRect().getSize().y - 1), Color::gray64, Color::white); drawPlayerStats(clientArea); View::doDraw(viewArea, clientArea); } // end doDraw
void SingleParticle2dx::DataStructures::Particle::updateParticleShift() { SingleParticle2dx::DataStructures::ParticleShift s = getParticleShift(); real_array_type rdata( boost::extents[getSizeX()][getSizeY()] ); real_array_type rdata2set( boost::extents[getSizeX()][getSizeY()] ); getRealSpaceData(&rdata); size_type ii; size_type jj; for(size_type i=0; i<getSizeX(); i++) { for(size_type j=0; j<getSizeY(); j++) { ii = i + s.getShiftX(); jj = j + s.getShiftY(); if (ii<0) { ii += getSizeX(); } if (jj<0) { jj += getSizeY(); } if (ii >= getSizeX()) { ii -= getSizeX(); } if (jj >= getSizeY()) { jj -= getSizeY(); } rdata2set[i][j] = rdata[ii][jj]; } } setFourierSpaceData(&rdata2set); m_optimal_shift.reset(); }
// drawTitle //--------------------------------------------------------------------------- // Purpose: Draws the title of the view and colors the move area background // depending on whether the view is active. //--------------------------------------------------------------------------- void View::drawTitle(Surface &viewArea) { assert(this != 0); iRect r(borderSize, borderSize, getSizeX() - borderSize, borderSize + moveAreaHeight - 1); Surface s; s.setTo(viewArea, r); s.fill(getActive() ? activeWindowTitleBodyColor : inactiveWindowTitleBodyColor); char strBuf[256]; sprintf(strBuf, "%s%s", title, subTitle); s.bltStringCenter(strBuf, getActive() ? activeWindowTitleTextColor : inactiveWindowTitleTextColor); if (getResize()) { { // Bottom-Left resize. iXY verticalPos(borderSize, getSizeY() - borderSize - moveAreaHeight + 1); iXY horizontalPos(borderSize + moveAreaHeight - 1, getSizeY() - borderSize); viewArea.drawLine(verticalPos, horizontalPos, Color::white); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray224); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray192); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x--; } // Top-Left resize. { iXY verticalPos(borderSize, borderSize + moveAreaHeight - 1); iXY horizontalPos(borderSize + moveAreaHeight - 1, borderSize); viewArea.drawLine(verticalPos, horizontalPos, Color::white); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray224); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray192); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x--; } // Top-Right resize. { iXY verticalPos(getSizeX() - borderSize, borderSize + moveAreaHeight - 1); iXY horizontalPos(getSizeX() - borderSize - moveAreaHeight, borderSize - 1); viewArea.drawLine(verticalPos, horizontalPos, Color::white); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray224); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray192); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y--; horizontalPos.x++; } // Bottom-Right resize. { iXY verticalPos(getSizeX() - borderSize, getSizeY() - borderSize - moveAreaHeight + 1); iXY horizontalPos(getSizeX() - borderSize - moveAreaHeight + 1, getSizeY() - borderSize); viewArea.drawLine(verticalPos, horizontalPos, Color::white); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray224); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray192); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; viewArea.drawLine(verticalPos, horizontalPos, Color::gray160); verticalPos.y++; horizontalPos.x++; } } } // end View::drawTitle