Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1.             UI::Position pos = this->get_position();
  2.             UI::Dimension dim = this->get_dimension();
  3.             batch.add(left_side, pos.get_x(), pos.get_y());
  4.             int i = 0;
  5.             for (int w = dim.get_width() - 3; w > 3; w -= 8) {
  6.                 batch.add(center, pos.get_x() + 3 + 8 * i++, pos.get_y());
  7.             }
  8.             batch.add(right_side, pos.get_x() + 3 + 8 * i, pos.get_y());
  9.             renderer.draw_batch(batch);
  10.             if (this->content.length() > 0 || this->focused) {
  11.                 this->font.draw_string(renderer, pos.get_x() + 3, pos.get_y() + 1, this->content);
  12.             } else {
  13.                 renderer.push_filter();
  14.                 renderer.set_filter(1.0,1.0,1.0,0.5);
  15.                 this->font.draw_string(renderer, pos.get_x() + 3, pos.get_y() + 1, this->hint);
  16.                 renderer.pop_filter();
  17.             }
  18.             if (this->focused && this->blink) {
  19.                 std::string substring = this->content.substr(0, this->caret_position);
  20.                 int caret = font.get_string_width(substring);
  21.                 this->font.draw_string(renderer, pos.get_x() + 2 + caret, pos.get_y() + 1, "|");
  22.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement