void vmain::draw (gcn::Graphics *graphics){ if(!img){ std::stringstream imgPath(std::string("")); imgPath << ConfigData::GetPath("gui") << "main_menu/main.png"; img = gcn::Image::load(imgPath.str()); } graphics->drawImage(img,0,0); drawChildren(graphics); }
void Inventory::draw (gcn::Graphics *graphics){ if(!visible) return; if(!img){ std::stringstream imgPath(std::string("")); imgPath << ConfigData::GetPath("gui") << "inventario.png"; img = gcn::Image::load(imgPath.str()); } graphics->drawImage(img,0,0); drawChildren(graphics); }
void MainGui::draw (gcn::Graphics *graphics){ if(!visible) return; if(!img){ std::stringstream imgPath(std::string("")); imgPath << ConfigData::GetPath("gui") << "GUIV3.png"; img = gcn::Image::load(imgPath.str()); } graphics->drawImage(img,0,0); drawMiniMap(graphics); drawChildren(graphics); }
// Init list image to count for item void PictureHelper::initListImage() { listImg.clear(); QString appFolder(QDir::homePath()); appFolder.chop(4); QDir imgPath(appFolder + "shared/camera"); QDirIterator it(imgPath.absolutePath()); while (it.hasNext()) { it.next(); if ((it.filePath().contains(".png")) || (it.filePath().contains(".jpg"))) { listImg << it.filePath(); } } setImageCount(listImg.count()); }
void graphicBar::draw (gcn::Graphics *graphics) { //graphics->setColor(mForegroundColor); //graphics->drawRectangle(gcn::Rectangle(0,0,mDimension.width,mDimension.height)); //graphics->fillRectangle(gcn::Rectangle(0,0,bar_lenght,mDimension.height)); if(!img){ std::stringstream imgPath(std::string("")); imgPath << ConfigData::GetPath("gui") << img_path; img = gcn::Image::load(imgPath.str()); } //graphics->drawImage(img,0,bar_lenght,); graphics->drawImage(img,0,mDimension.height-bar_lenght,0,mDimension.height-bar_lenght,mDimension.width,bar_lenght); if(draw_text){ graphics->drawText(text,mDimension.width/2,mDimension.height/2-12,gcn::Graphics::CENTER); } }
void MainGui::drawMiniMap(gcn::Graphics *graphics) { if(!render_minimap) return; int base_x=686; int base_y=21; ao::MapFile_ptr _map = ClienteArgentum::instancia()->ActualMap(); if(minimap_buffer==NULL) { std::stringstream imgPath(std::string("")); imgPath << ConfigData::GetPath("gui") << "minimap_base.png"; minimap_buffer = gcn::Image::load(imgPath.str(),false); for(int y=1;y<100;y++) { for(int x=1;x<100;x++) { ao::MapTile & tile = _map->getTile(ao::Pos(x,y)); if(tile.ent) { //graphics->setColor(gcn::Color(0xFF,0,0,0xFF)); RADAR MWHAHAH minimap_buffer->putPixel(x,y,gcn::Color(0,0xBB,0,0xFF)); }else if(tile.blocked) { minimap_buffer->putPixel(x,y,gcn::Color(0,0,0,0xFF)); }else { minimap_buffer->putPixel(x,y,gcn::Color(0,0xBB,0,0xFF)); } } } minimap_buffer->convertToDisplayFormat(); } graphics->drawImage(minimap_buffer,base_x,base_y); if(ClienteArgentum::instancia()->getCurrentChar()) { int x=ClienteArgentum::instancia()->_entities[ClienteArgentum::instancia()->getCurrentChar()]->getPos().x; int y=ClienteArgentum::instancia()->_entities[ClienteArgentum::instancia()->getCurrentChar()]->getPos().y; graphics->setColor(gcn::Color(0xDD,0,0,0xFF)); graphics->drawPoint(x+base_x,y+base_y); graphics->drawPoint(x+base_x+1,y+base_y); graphics->drawPoint(x+base_x,y+base_y+1); graphics->drawPoint(x+base_x-1,y+base_y); graphics->drawPoint(x+base_x,y+base_y-1); } }
void Spritesheet::load(const std::string& path) { // Load the image itself into a texture using GraphicsUtil std::string imgPath(path); imgPath += IMG_EXTENSION; DEBUG("Loading spritesheet image \"%s\"...", imgPath.c_str()); texture = new Texture(imgPath); size = texture->getSize(); // Load in the spritesheet data file, which tells the engine where // each frame is in the image std::string dataPath(path); dataPath += DATA_EXTENSION; DEBUG("Loading spritesheet data \"%s\"...", dataPath.c_str()); std::ifstream input(dataPath.c_str()); if(!input.is_open()) { T_T(std::string("Error opening file: ") + dataPath); } // Read in the JSON data in the file Json::Value jsonRoot; input >> jsonRoot; if(jsonRoot.isNull()) { DEBUG("Unexpected root element name."); T_T("Failed to parse spritesheet data."); } parseFrames(jsonRoot); parseAnimations(jsonRoot); DEBUG("Spritesheet constructed!"); }