void VerticalListMenuWindowArea::drawItems(ScreenBuffer& buffer) { // Get coordinates of the top-left corner of the menu content // relative to the top-left corner of the containing window int xBase = parentWindow_->contentX() - parentWindow_->x() + paddingLeft_; int yBase = parentWindow_->contentY() - parentWindow_->y() + paddingTop_; /* DrawableSurface* drawable = gameMemory_.graphicsCore().createDrawableSurface( parentWindow_->contentW() - paddingLeft_ - paddingRight_, parentWindow_->contentH() - paddingTop_ - paddingBottom_); */ /* // Draw items int firstItem = 0; int lastItem = numItems(); int numHiddenItemsAbove = 0; // If scrolling is enabled, print only the fully visible // items and the entries directly above and below them if (scrolling_) { firstItem = selectedItemNum_; lastItem = firstItem + maxVisibleItems(); if (lastItem > numItems()) { lastItem = numItems() - 1; } else if (lastItem < numItems() - 1) { // lastItem = } if (selectedItemNum_ != 0) { --firstItem; } } */ if (needsRedraw_) { delete itemSurface_; itemSurface_ = gameMemory_.graphicsCore().createDrawableSurface( parentWindow_->contentW() - paddingLeft_ - paddingRight_, parentWindow_->contentH() - paddingTop_ - paddingBottom_); DrawableSurface* drawable = itemSurface_; for (int i = 0; i < numItems(); i++) { // int xPos = xBase - scrollX_; // int yPos = yBase + (spacing_ * i) - scrollY_; int xPos = -scrollX_; // The (i + 1) here is necessary because text is drawn upward // from the base position rather than downward int yPos = (spacing_ * (i + 1)) - scrollY_; drawItem(getItem(i), *drawable, xPos, yPos); } drawable->update(); needsRedraw_ = false; } // Blit drawn items to buffer buffer.draw(*itemSurface_, parentWindow_->contentX() + paddingLeft_, parentWindow_->contentY() + paddingTop_); // delete drawable; // Draw cursor buffer.draw(cursorEnabledAnimation_->currentFrame().graphic(), parentWindow_->contentX(), parentWindow_->contentY() + paddingTop_ // skip padding + (selectedItemNum_ * spacing_) // skip height of items above + (spacing_/2) // center vertically on item - scrollY_ // account for scolling - (((spacing_/11) <= 0) ? (spacing_/3) : (spacing_/8))); // this aligns better with the // fonts we're using }