void GUIInventoryMenu::drawMenu() { gui::IGUISkin* skin = Environment->getSkin(); if (!skin) return; video::IVideoDriver* driver = Environment->getVideoDriver(); video::SColor bgcolor(140,0,0,0); driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect); /* Draw items */ for(u32 i=0; i<m_draw_spec.size(); i++) { ListDrawSpec &s = m_draw_spec[i]; drawList(s); } /* Call base class */ gui::IGUIElement::draw(); }
void DeckListScreen::mtxTagEnd(const char* name, int len) { if (!strcmp(name, "deck")) { album = new Album(deckId, description); albums.add(album); deckId = ""; description = ""; } else if (!strcmp(name, "decks")) { if (albums.size() <= 1 && screenType == ST_SELECT) { if (albums.size() == 0) { next = new OptionsScreen(feed, OptionsScreen::ST_NEW_GAME_OPTIONS, previous, NULL, categoryId, "-1"); next->show(); } else { next = new OptionsScreen(feed, OptionsScreen::ST_NEW_GAME_OPTIONS, previous, NULL, categoryId, albums[0]->getId()); next->show(); } } else { drawList(); } notice->setCaption(""); } }
void menus::doMain() { if(showMenu) { doItem(); } else { disp.drawBtnBar('^', "Select", 'v'); disp.showTitle("Main Menu"); drawList(); } display.display(); }
void fileSelect::refresh() { if (window_ == 0) { return; } clear(); drawList(); wrefresh(window_); }
void ShopCategoriesScreen::httpFinished(MAUtil::HttpConnection* http, int result) { if (result == 200) { xmlConn = XmlConnection::XmlConnection(); xmlConn.parse(http, this, this); } else { mHttp.close(); feed->remHttp(); drawList(); notice->setCaption("Unable to connect, try again later..."); } }
void COverlayPanel::resetList(const IOverlay *item) { SendDlgItemMessage(IDC_OVERLAY_LIST,TVM_DELETEITEM,0,(LPARAM)NULL); TVINSERTSTRUCT itvIns; memset(&itvIns, 0, sizeof(TVINSERTSTRUCT)); itvIns.hInsertAfter = TVI_LAST; itvIns.itemex.mask = TVIF_TEXT | TVIF_PARAM; HTREEITEM selectItem = drawList(overlayRoot, TVI_ROOT, item, itvIns); SendDlgItemMessage(IDC_OVERLAY_LIST, TVM_SELECTITEM, (WPARAM)TVGN_CARET, (LPARAM)selectItem); }
void ShopCategoriesScreen::mtxTagEnd(const char* name, int len) { if(!strcmp(name, "albumname")) { categories.insert(temp1, temp); category.add(temp1); temp1 = ""; temp = ""; } else if (!strcmp(name, "cardcategories")) { notice->setCaption("Choose a category."); drawList(); } else if(!strcmp(name, "error")) { notice->setCaption(error_msg.c_str()); } else { notice->setCaption(""); } }
void AuctionListScreen::refresh() { clearAuctions(); //work out how long the url will be, the number is for the & and = symbols as well as hard coded params int urlLength = 0; switch (screenType) { case ST_CATEGORY: urlLength = 74 + URLSIZE + categoryId.length() + Util::intlen(scrHeight) + Util::intlen(scrWidth); break; case ST_USER: urlLength = 73 + URLSIZE + feed->getUsername().length() + + Util::intlen(scrHeight) + Util::intlen(scrWidth); break; } char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); switch (screenType) { case ST_CATEGORY: sprintf(url, "%s?categoryauction=1&category_id=%s&height=%d&width=%d&jpg=1", URL, categoryId.c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth()); break; case ST_USER: sprintf(url, "%s?userauction=1&username=%s&height=%d&width=%d&jpg=1", URL, feed->getUsername().c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth()); break; } if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int res = mHttp.create(url, HTTP_GET); if(res < 0) { drawList(); notice->setCaption("Unable to connect, try again later..."); } else { mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete [] url; url = NULL; show(); }
QImage *LH_MonitoringBar::render_qimage( int w, int h ) { if( LH_Bar::render_qimage(w,h) == NULL ) return NULL; if(ui_ && ui_->data_) { float max; if(ui_->data_->getUpperLimit(max)) { this->setup_max_->setHidden(true); this->setup_min_->setHidden(true); this->setMax((qreal)max); this->setMin((qreal)0); } else { this->setup_max_->setHidden(false); this->setup_min_->setHidden(false); } if(!ui_->data_->isGroup()) { float currVal=0; if(ui_->data_->getValue(currVal)) drawSingle( currVal ); } else { int barCount; ui_->data_->getCount(barCount); float deadVal; bool hasDead = (ui_->data_->getDeadValue_Transformed(deadVal)); QVector<qreal> currVals; for(int i=0; i<barCount; i++) { float currVal=0; ui_->data_->getValue(currVal, i); if (!hasDead || (deadVal != currVal) ) currVals.append(currVal); } drawList(currVals); } } return image_; }
// アニメ再生中 void AnimeGLWidget::drawLayers_Anime() { ObjectModel *pModel = m_pEditData->getObjectModel(); ObjectItem *pItem = pModel->getObject(m_pEditData->getSelIndex()); if (!pItem) { return; } if (m_pSetting->getUseZSort()) { m_drawList.clear(); } drawLayers(pItem); if (m_pSetting->getUseZSort()) { sortDrawList(); drawList(); } }
void EditDeckScreen::removeCard() { int cardIndex = listBox->getSelectedIndex() - 1; //-1 for the "delete deck" option if (cards.size() < 10) { cardIndex -= 1; //if there are less than 10 cards, there is also the "add card" option } int urlLength = 65 + URLSIZE + strlen("deck_id") + deckId.length() + strlen("card_id") + cards[cardIndex]->getId().length(); char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); sprintf(url, "%s?removefromdeck=1&deck_id=%s&card_id=%s", URL, deckId.c_str(), cards[cardIndex]->getId().c_str()); lprintfln("%s", url); if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int res = mHttp.create(url, HTTP_GET); if(res < 0) { busy = false; hasConnection = false; notice->setCaption(""); } else { hasConnection = true; mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete [] url; url = NULL; delete cards[cardIndex]; cards[cardIndex] = NULL; cards.remove(cardIndex); drawList(); }
HTREEITEM COverlayPanel::drawList(ICompositeOverlay *coll, HTREEITEM parent, const IOverlay *selected, TVINSERTSTRUCT &itvIns) { HTREEITEM selectItem = NULL; short max; coll->Count(&max); for (int i=0; i<max; i++) { IOverlay *pOverlay; coll->Item(CComVariant(i), &pOverlay); itvIns.hParent = parent; BSTR name; pOverlay->get_Name(&name); _bstr_t tb(name, false); itvIns.itemex.pszText = (char*)tb; itvIns.itemex.cchTextMax = strlen(itvIns.itemex.pszText)+1; itvIns.itemex.lParam = (LPARAM)pOverlay; HTREEITEM h = (HTREEITEM)SendDlgItemMessage(IDC_OVERLAY_LIST,TVM_INSERTITEM,0,(LPARAM)&itvIns); ICompositeOverlay *pCO = NULL; HRESULT hr = pOverlay->QueryInterface(IID_ICompositeOverlay, (void **)&pCO); if (SUCCEEDED(hr)) { pCO->Release(); HTREEITEM sel = drawList((ICompositeOverlay*)pOverlay, h, selected, itvIns); if (sel != NULL) selectItem = sel; SendDlgItemMessage(IDC_OVERLAY_LIST,TVM_EXPAND,(WPARAM)TVE_EXPAND,(LPARAM)h); } if (pOverlay == selected) selectItem = h; pOverlay->Release(); } return selectItem; }
static void displayScene (pScene sc, int mode, int clip) { int map; map = mode & S_MAP; switch (mode) { case FILL: /* solid fill */ if (ddebug) printf("solid fill\n"); glEnable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glDisable(GL_POLYGON_OFFSET_FILL); drawList(sc, clip, 0); glDisable(GL_LIGHTING); break; case WIRE: /* basic wireframe */ case WIRE + S_MATERIAL: if (ddebug) printf("wireframe\n"); #ifdef ppc bogusQuad(sc); #endif glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glColor4fv(sc->par.line); glDisable(GL_POLYGON_OFFSET_FILL); drawList(sc, clip, 0); break; case DEPTH: /* depth wireframe */ case DEPTH + S_MATERIAL: if (ddebug) printf("depth wireframe\n"); glEnable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); glDisable(GL_POLYGON_OFFSET_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); drawList(sc, clip, 0); glDisable(GL_LIGHTING); break; case HIDDEN:/* hidden lines removal */ case HIDDEN + S_MATERIAL: if (ddebug) printf("hidden lines\n"); glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glColor3fv(sc->par.back); drawList(sc, clip, 0); glDisable(GL_POLYGON_OFFSET_FILL); #ifdef ppc bogusQuad(sc); #endif glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glColor4fv(sc->par.line); drawList(sc, clip, 0); break; case SHADED:/* shaded polygons */ case SHADED + S_MATERIAL: if (ddebug) printf("shaded polygons\n"); glEnable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_POLYGON_OFFSET_FILL); drawList(sc, clip, 0); glDisable(GL_LIGHTING); glDisable(GL_POLYGON_OFFSET_FILL); #ifdef ppc bogusQuad(sc); #endif glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glColor4fv(sc->par.line); drawList(sc, clip, 0); break; case SIZEMAP: /* display metric map */ case SIZEMAP + S_MATERIAL: if (ddebug) printf("display sizemap\n"); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); drawList(sc, clip, map); glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); glDisable(GL_POLYGON_OFFSET_FILL); #ifdef ppc bogusQuad(sc); #endif glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glColor4fv(sc->par.line); glLineWidth(1.0); drawList(sc, clip, 0); if (sc->mode & S_ALTITUDE) { glColor4fv(sc->par.line); if (sc->mlist[LTets]) glCallList(sc->mlist[LTets]); if (sc->mlist[LHexa]) glCallList(sc->mlist[LHexa]); } break; default:/* other modes */ if (ddebug) printf("rendering mode %d\n", sc->mode); /* interior */ if (sc->mode & S_FILL) { if (sc->mode & S_COLOR) glEnable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_POLYGON_OFFSET_FILL); if (sc->mode & S_MAP) { glEnable(GL_COLOR_MATERIAL); drawList(sc, clip, map); glDisable(GL_COLOR_MATERIAL); } else { glColor4fv(sc->par.back); drawList(sc, clip, 0); } } /* boundary */ glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); glDisable(GL_POLYGON_OFFSET_FILL); #ifdef ppc bogusQuad(sc); #endif glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); if (!(sc->mode & S_BDRY)) break; if (sc->mode & S_COLOR && !(sc->mode & S_FILL)) { glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); } if (sc->mode & S_MAP) { if (sc->mode & S_FILL) { glColor4fv(sc->par.line); drawList(sc, clip, 0); } else { drawList(sc, clip, map); } } else if (sc->mode & S_ALTITUDE) { glColor4fv(sc->par.line); drawList(sc, clip, map); if (sc->mlist[LTets]) glCallList(sc->mlist[LTets]); if (sc->mlist[LHexa]) glCallList(sc->mlist[LHexa]); } else { glColor4fv(sc->par.line); drawList(sc, clip, 0); } } }
ShopCategoriesScreen::ShopCategoriesScreen(MainScreen *previous, Feed *feed, int screenType) : mHttp(this), screenType(screenType) { lprintfln("ShopCategoriesScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); this->previous = previous; this->feed = feed; next = NULL; label = NULL; currentSelectedKey = NULL; currentKeyPosition = -1; if (screenType == ST_FREEBIE) { mainLayout = Util::createMainLayout("", "", true); } else { mainLayout = Util::createMainLayout("", "Back", true); } listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2]; notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1]; notice->setDrawBackground(false); listBox->setHeight(listBox->getHeight() - 20); int res = -1; int urlLength = 100 + URLSIZE; char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); switch(screenType) { case ST_FREEBIE: notice->setCaption("Checking for shop categories..."); sprintf(url, "%s?productcategories=1", URL); lprintfln("%s", url); res = mHttp.create(url, HTTP_GET); break; case ST_SHOP: notice->setCaption("Checking for shop categories..."); sprintf(url, "%s?productcategories=2", URL); lprintfln("%s", url); res = mHttp.create(url, HTTP_GET); break; case ST_AUCTIONS: notice->setCaption("Checking for auction categories..."); sprintf(url, "%s?auctioncategories=1", URL); lprintfln("%s", url); res = mHttp.create(url, HTTP_GET); break; case ST_RANKING: case ST_FRIEND: notice->setCaption("Checking the latest rankings..."); sprintf(url, "%s?leaders=1", URL); lprintfln("%s", url); res = mHttp.create(url, HTTP_GET); break; } delete [] url; url = NULL; if(res < 0) { drawList(); notice->setCaption("Unable to connect, try again later..."); } else { mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } this->setMain(mainLayout); moved = 0; }
void on_mouse(int event, int x, int y, int flags, void* param) { switch(event) { case CV_EVENT_LBUTTONUP://evento del boton cuando se suelta window.followmousemove = 0; if(figure.task != '9') { figure.lp.x=x; figure.lp.y=y; } else { window.refresh(); figure.task = '?'; } if(figure.drawtype != '?' ) list.push_back(figure); drawList(window.image, list); break; case CV_EVENT_LBUTTONDOWN://evento del boton cuando se presiona xx = x; yy = y; window.followmousemove = 1; if(variable[3] != 9 && variable[3]<50) { figure = Figure(variable[0],variable[1],variable[2]); figure.fp.x=x; figure.fp.y=y; figure.drawtype=variable[3]; } else { figure = find(x,y,list); if(variable[4]==50 || variable[4]==75 || variable[4]==125 || variable[4]==150) { figure.setZoom((float)variable[4]/100); figure.task = '9'; } if(variable[0]!=-1 && variable[1]!=-1 && variable[2]!=-1) { figure.setColor(variable[0],variable[1],variable[2]); figure.task = '9'; } if(variable[3]==9) figure.task = '9'; } break; } if(CV_EVENT_MOUSEMOVE==event && window.followmousemove == 1)//evento del boton en movimiento { window.refresh(); if(figure.task == '9') { figure.move(x-xx,y-yy); xx=x; yy=y; } else { figure.lp.x = x; figure.lp.y = y; } figure.draw(window.image); drawList(window.image, list); } }
void cBuildingListDrawer::drawListWithUnitsOrAbilities(cBuildingList *list, int listIDToDraw, int startId) { drawList(list, listIDToDraw, startId, false); }
void cBuildingListDrawer::drawListWithStructures(cBuildingList *list, int listIDToDraw, int startId) { drawList(list, listIDToDraw, startId, true); }
AuctionListScreen::AuctionListScreen(Screen *previous, Feed *feed, int screenType, String catId) : mHttp(this), screenType(screenType), categoryId(catId), previous(previous), feed(feed) { lprintfln("AuctionListScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); emp = true; left = false; right = false; list = false; shouldUpdateAuction = false; clearAuctions(); deleteAuctions(); parentTag = ""; cardText = ""; cardId = ""; description = ""; thumburl = ""; openingBid = ""; price = ""; userCardId = ""; auctionCardId = ""; username = ""; buyNowPrice = ""; error_msg = ""; endDate = ""; lastBidUser = ""; moved = 0; card = NULL; auction = NULL; next = NULL; label = NULL; tempImage = NULL; mImageCache = new ImageCache(); mainLayout = Util::createMainLayout("", "Back", "", true); listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2]; notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1]; notice->setCaption("Getting auctions..."); //work out how long the url will be, the number is for the & and = symbols as well as hard coded params int urlLength = 0; switch (screenType) { case ST_CATEGORY: urlLength = 74 + URLSIZE + categoryId.length() + Util::intlen(scrHeight) + Util::intlen(scrWidth); break; case ST_USER: urlLength = 73 + URLSIZE + feed->getUsername().length() + + Util::intlen(scrHeight) + Util::intlen(scrWidth); break; } char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); switch (screenType) { case ST_CATEGORY: sprintf(url, "%s?categoryauction=1&category_id=%s&height=%d&width=%d&jpg=1", URL, categoryId.c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth()); break; case ST_USER: sprintf(url, "%s?userauction=1&username=%s&height=%d&width=%d&jpg=1", URL, feed->getUsername().c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth()); break; } if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int res = mHttp.create(url, HTTP_GET); if(res < 0) { drawList(); notice->setCaption("Unable to connect, try again later..."); } else { mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete [] url; url = NULL; this->setMain(mainLayout); }
void EditDeckScreen::keyPressEvent(int keyCode) { String all = ""; int ind = listBox->getSelectedIndex(); int max = listBox->getChildren().size(); Widget *currentSoftKeys = mainLayout->getChildren()[mainLayout->getChildren().size() - 1]; switch (screenType) { case ST_LIST: switch(keyCode) { case MAK_UP: if(currentSelectedKey!=NULL){ currentSelectedKey->setSelected(false); currentSelectedKey = NULL; currentKeyPosition = -1; listBox->getChildren()[listBox->getChildren().size()-1]->setSelected(true); } else if (ind == 0) { listBox->setSelectedIndex(max-1); } else { listBox->selectPreviousItem(); } break; case MAK_DOWN: if (ind+1 < max ) { listBox->setSelectedIndex(ind+1); } else if(currentSelectedKey==NULL) { listBox->getChildren()[ind]->setSelected(false); for(int i = 0; i < currentSoftKeys->getChildren().size();i++){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } break; case MAK_BACK: case MAK_SOFTRIGHT: previous->show(); break; case MAK_FIRE: if(currentSoftKeys->getChildren()[0]->isSelected()){ keyPressEvent(MAK_SOFTLEFT); break; }else if(currentSoftKeys->getChildren()[2]->isSelected()){ keyPressEvent(MAK_SOFTRIGHT); break; } if (listBox->getSelectedIndex() == 0 && cards.size() < 10) { if (next != NULL) { delete next; feed->remHttp(); next = NULL; } next = new AlbumLoadScreen(this, feed, AlbumLoadScreen::ST_DECK, NULL, false, NULL, deckCategory); ((AlbumLoadScreen*)next)->setDeckId(deckId); next->show(); } else if ((listBox->getSelectedIndex() == 0 && cards.size() == 10) || (listBox->getSelectedIndex() == 1 && cards.size() < 10)) { drawConfirm(); } break; case MAK_SOFTLEFT: if (listBox->getSelectedIndex() == 0 && cards.size() < 10) { if (next != NULL) { delete next; feed->remHttp(); next = NULL; } next = new AlbumLoadScreen(this, feed, AlbumLoadScreen::ST_DECK, NULL, false, NULL, deckCategory); ((AlbumLoadScreen*)next)->setDeckId(deckId); next->show(); } else if ((listBox->getSelectedIndex() == 0 && cards.size() == 10) || (listBox->getSelectedIndex() == 1 && cards.size() < 10)) { drawConfirm(); } else { removeCard(); } break; case MAK_LEFT: if(currentSelectedKey!=NULL){ if(currentKeyPosition > 0){ currentKeyPosition = currentKeyPosition - 1; for(int i = currentKeyPosition; i >= 0;i--){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentSelectedKey->setSelected(false); currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } } break; case MAK_RIGHT: if(currentSelectedKey!=NULL){ if(currentKeyPosition+1 < currentSelectedKey->getParent()->getChildren().size()){ currentKeyPosition = currentKeyPosition + 1; for(int i = currentKeyPosition; i < currentSoftKeys->getChildren().size();i++){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentSelectedKey->setSelected(false); currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } } break; } break; case ST_CONFIRM_DELETE: switch(keyCode) { case MAK_FIRE: if(currentSoftKeys->getChildren()[0]->isSelected()){ keyPressEvent(MAK_SOFTLEFT); }else if(currentSoftKeys->getChildren()[2]->isSelected()){ keyPressEvent(MAK_SOFTRIGHT); } break; case MAK_UP: if(currentSelectedKey!=NULL){ currentSelectedKey->setSelected(false); currentSelectedKey = NULL; currentKeyPosition = -1; listBox->getChildren()[listBox->getChildren().size()-1]->setSelected(true); } else if (ind == 0) { listBox->setSelectedIndex(max-1); } else { listBox->selectPreviousItem(); } break; case MAK_DOWN: if (ind+1 < max ) { listBox->setSelectedIndex(ind+1); } else if(currentSelectedKey==NULL) { listBox->getChildren()[ind]->setSelected(false); for(int i = 0; i < currentSoftKeys->getChildren().size();i++){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } break; case MAK_BACK: case MAK_SOFTRIGHT: if (!busy) { busy = true; drawList(); } break; case MAK_SOFTLEFT: if (!busy) { busy = true; deleteDeck(); } break; case MAK_LEFT: if(currentSelectedKey!=NULL){ if(currentKeyPosition > 0){ currentKeyPosition = currentKeyPosition - 1; for(int i = currentKeyPosition; i >= 0;i--){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentSelectedKey->setSelected(false); currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } } break; case MAK_RIGHT: if(currentSelectedKey!=NULL){ if(currentKeyPosition+1 < currentSelectedKey->getParent()->getChildren().size()){ currentKeyPosition = currentKeyPosition + 1; for(int i = currentKeyPosition; i < currentSoftKeys->getChildren().size();i++){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentSelectedKey->setSelected(false); currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } } break; } break; } }
//FIXME: Refactor this to use polymorphism. void OpenGLRenderInterface::draw(dynamics::Shape* _shape) { if(_shape == 0) return; Eigen::Isometry3d pose = _shape->getLocalTransform(); Eigen::Vector3d color = _shape->getColor(); glPushMatrix(); glColorMaterial ( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glEnable ( GL_COLOR_MATERIAL ); glColor3d(color[0], color[1], color[2]); glMultMatrixd(pose.data()); switch(_shape->getShapeType()) { case dynamics::Shape::BOX: { //FIXME: We are not in a glut instance dynamics::BoxShape* box = static_cast<dynamics::BoxShape*>(_shape); drawCube(box->getSize()); break; } case dynamics::Shape::CYLINDER: { //FIXME: We are not in a glut instance dynamics::CylinderShape* cylinder = static_cast<dynamics::CylinderShape*>(_shape); drawCylinder(cylinder->getRadius(), cylinder->getHeight()); break; } case dynamics::Shape::ELLIPSOID: { //FIXME: We are not in a glut instance dynamics::EllipsoidShape* ellipsoid = static_cast<dynamics::EllipsoidShape*>(_shape); drawEllipsoid(ellipsoid->getSize()); break; } case dynamics::Shape::PLANE: { dterr << "PLANE shape is not supported yet." << std::endl; break; } case dynamics::Shape::MESH: { glDisable(GL_COLOR_MATERIAL); // Use mesh colors to draw dynamics::MeshShape* mesh = static_cast<dynamics::MeshShape*>(_shape); if(!mesh) break; else if(mesh->getDisplayList()) drawList(mesh->getDisplayList()); else drawMesh(mesh->getScale(), mesh->getMesh()); break; } case dynamics::Shape::SOFT_MESH: { // Do nothing break; } case dynamics::Shape::LINE_SEGMENT: { dynamics::LineSegmentShape* lineSegments = static_cast<dynamics::LineSegmentShape*>(_shape); drawLineSegments(lineSegments->getVertices(), lineSegments->getConnections()); } } glDisable(GL_COLOR_MATERIAL); glPopMatrix(); }
void EditDeckScreen::mtxTagEnd(const char* name, int len) { if(!strcmp(name, "card")) { //notice->setCaption(""); Card *newCard = new Card(); newCard->setAll((quantity+","+description+","+thumburl+","+fronturl+","+backurl+","+id+","+rate+","+value+","+note+","+ranking+","+rarity+","+frontflipurl+","+backflipurl+",").c_str()); newCard->setStats(stats); newCard->setUpdated(updated == "1"); cards.add(newCard); id = ""; description = ""; quantity = ""; thumburl = ""; fronturl = ""; backurl = ""; rate = ""; value = ""; rarity = ""; ranking = ""; frontflipurl = ""; backflipurl = ""; updated = ""; note = ""; stats.clear(); //delete newCard; //newCard = NULL; } else if(!strcmp(name, "stat")) { stat = new Stat(); stat->setDesc(statDesc.c_str()); stat->setDisplay(statDisplay.c_str()); stat->setIVal(statIVal.c_str()); stat->setTop(statTop); stat->setLeft(statLeft); stat->setWidth(statWidth); stat->setHeight(statHeight); stat->setFrontOrBack(statFrontOrBack); stat->setColorRed(statRed); stat->setColorGreen(statGreen); stat->setColorBlue(statBlue); stats.add(stat); statDesc = ""; statDisplay = ""; statIVal = ""; stat = NULL; //delete stat; } else if(!strcmp(name, "result")) { //notice->setCaption(error_msg.c_str()); statDesc=""; statIVal=""; statDisplay=""; note=""; id=""; description=""; quantity=""; thumburl=""; fronturl=""; frontflipurl=""; backurl=""; backflipurl=""; error_msg=""; rate=""; rarity=""; ranking=""; value=""; updated=""; if (deleting) { ((DeckListScreen*)previous)->refresh(); previous->show(); } } else if (!strcmp(name, "deck")) { notice->setCaption(""); drawList(); busy = false; notice->setCaption(""); statDesc=""; statIVal=""; statDisplay=""; note=""; id=""; description=""; quantity=""; thumburl=""; fronturl=""; frontflipurl=""; backurl=""; backflipurl=""; error_msg=""; rate=""; rarity=""; ranking=""; value=""; updated=""; } }
void AuctionListScreen::mtxTagEnd(const char* name, int len) { if(!strcmp(name, "auction")) { card = new Card(); card->setId(cardId.c_str()); card->setText(description.c_str()); card->setThumb(thumburl.c_str()); //card->setFullDesc(fullDesc.c_str()); card->setFront(fronturl.c_str()); card->setFrontFlip(frontflipurl.c_str()); card->setBack(backurl.c_str()); card->setBackFlip(backflipurl.c_str()); auction = new Auction(); auction->setAuctionCardId(auctionCardId.c_str()); auction->setBuyNowPrice(buyNowPrice.c_str()); auction->setCard(card); auction->setOpeningBid(openingBid.c_str()); auction->setPrice(price.c_str()); auction->setUserCardId(userCardId.c_str()); auction->setUsername(username.c_str()); auction->setEndDate(endDate.c_str()); auction->setLastBidUser(lastBidUser.c_str()); auctions.add(auction); cardId = ""; description = ""; thumburl = ""; fronturl = ""; frontflipurl = ""; backurl = ""; backflipurl = ""; openingBid = ""; price = ""; userCardId = ""; auctionCardId = ""; username = ""; buyNowPrice = ""; error_msg = ""; endDate = ""; lastBidUser = ""; } else if(!strcmp(name, "error")) { notice->setCaption(error_msg.c_str()); cardId = ""; description = ""; thumburl = ""; fronturl = ""; frontflipurl = ""; backurl = ""; backflipurl = ""; openingBid = ""; price = ""; userCardId = ""; auctionCardId = ""; username = ""; buyNowPrice = ""; error_msg = ""; endDate = ""; lastBidUser = ""; } else if (!strcmp(name, "auctionsincategory")) { notice->setCaption("Building list..."); cardId = ""; description = ""; thumburl = ""; fronturl = ""; frontflipurl = ""; backurl = ""; backflipurl = ""; openingBid = ""; price = ""; userCardId = ""; auctionCardId = ""; username = ""; buyNowPrice = ""; error_msg = ""; endDate = ""; lastBidUser = ""; drawList(); } }
void GUIFormSpecMenu::drawMenu() { if(m_form_src){ std::string newform = m_form_src->getForm(); if(newform != m_formspec_string){ m_formspec_string = newform; regenerateGui(m_screensize_old); } } updateSelectedItem(); gui::IGUISkin* skin = Environment->getSkin(); if (!skin) return; video::IVideoDriver* driver = Environment->getVideoDriver(); video::SColor bgcolor(140,0,0,0); driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect); m_tooltip_element->setVisible(false); /* Draw items Phase 0: Item slot rectangles Phase 1: Item images; prepare tooltip */ for(int phase=0; phase<=1; phase++) for(u32 i=0; i<m_inventorylists.size(); i++) { drawList(m_inventorylists[i], phase); } for(u32 i=0; i<m_images.size(); i++) { const ImageDrawSpec &spec = m_images[i]; video::ITexture *texture = m_gamedef->tsrc()->getTextureRaw(spec.name); // Image size on screen core::rect<s32> imgrect(0, 0, spec.geom.X, spec.geom.Y); // Image rectangle on screen core::rect<s32> rect = imgrect + spec.pos; const video::SColor color(255,255,255,255); const video::SColor colors[] = {color,color,color,color}; driver->draw2DImage(texture, rect, core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(texture->getOriginalSize())), NULL/*&AbsoluteClippingRect*/, colors, true); } /* Draw dragged item stack */ drawSelectedItem(); /* Call base class */ gui::IGUIElement::draw(); }