Esempio n. 1
0
    void draw(const std::string &str, const Markup &m)
    {
        if (h_ == 0)
            return;

        const auto size = str.size();
        if (m.metas.size() != size)
            return;

        for (size_t i = 0; i < size; i += m.metas[i].size)
        {
            const auto &meta = m.metas[i];

            if (meta.rix >= h_)
                break;

            if (meta.rix < 0)
                continue;

            set_style_(meta.style);

            const auto cix_end = std::min<size_t>(meta.cix+meta.size, w_);
            auto it = str.begin()+i;
            for (size_t cix = meta.cix; cix < cix_end; ++cix, ++it)
            {
                cell_.ch = *it;
                tb_put_cell(x_+cix, y_+meta.rix, &cell_);
            }
        }
    }
Esempio n. 2
0
void tb_change_cell(unsigned int x, unsigned int y, uint32_t ch, uint16_t fg, uint16_t bg)
{
	struct tb_cell c = {ch, fg, bg};
	tb_put_cell(x, y, &c);
}
Esempio n. 3
0
/*!
	\brief Puts cell at specified position.

	\param x - position from left side of the screen.
	\param y - position from top of the screen.
	\param w - width of the cell list.
	\param cell - cell to print.
	*/
void putCell(unsigned int x, unsigned int y, QTermboxCell cell){
	Q_ASSERT_X(QTermboxCorePrivate::wasInitialized(), "putCell", "Termbox was not initialized.");

	struct tb_cell tcell = QTermboxCorePrivate::toTermboxCell(cell);
	tb_put_cell(x, y, &tcell);
}