Game Development Reference
In-Depth Information
m_textBox->SetAutoCompleteSource(runtime_variable::GetDatabase().GetTrie());
m_listBox = std::unique_ptr<listbox>(new listbox(m_core, m_font, m_spriteBatch));
m_listBox->SetPosition(m_rectangle.Position());
m_listBox->SetSize(math::vector2(m_rectangle.Size().x(), m_rectangle.Size().y() - m_font->GetLineSpacing()));
m_listBox->SetBackgroundColor(m_backgroundColor);
m_listBox->SetForegroundColor(render::color::WHITE);
m_listBox->Mode() = ui::listbox::Ascending;
Having initialized the controls we have the advantage that not much else is left to do but to
draw them in the console's Draw function.
m_listBox->Draw();
m_textBox->Draw();
Some settings in this example are hardcoded, such as the white foreground color, these
things are easily exposed as runtime variables themselves as we did in the case of the con-
sole's transparency and height, or as part of the console class itself to allow some amount
of customization by the user.
Search WWH ::




Custom Search