InfoBox::InfoBox(const std::string& text) :
firstline(0),
- lines(),
+ // Split text string lines into a vector
+ lines(InfoBoxLine::split(text, 400)),
images(),
arrow_scrollup(),
arrow_scrolldown()
{
- // Split text string lines into a vector
- lines = InfoBoxLine::split(text, 400);
-
try
{
// get the arrow sprites
InfoBox::~InfoBox()
{
for(std::vector<InfoBoxLine*>::iterator i = lines.begin();
- i != lines.end(); i++)
+ i != lines.end(); ++i)
delete *i;
}
{
// draw the scrolling arrows
if (arrow_scrollup.get() && firstline > 0)
- context.draw_surface(arrow_scrollup.get(),
+ context.draw_surface(arrow_scrollup,
Vector( x1 + width - arrow_scrollup->get_width(), // top-right corner of box
y1), LAYER_GUI);
if (arrow_scrolldown.get() && linesLeft && firstline < lines.size()-1)
- context.draw_surface(arrow_scrolldown.get(),
+ context.draw_surface(arrow_scrolldown,
Vector( x1 + width - arrow_scrolldown->get_width(), // bottom-light corner of box
y1 + height - arrow_scrolldown->get_height()),
LAYER_GUI);