void text::draw( platform::context &ctxt ) { if ( _update ) update( ctxt ); if ( _mesh.valid() ) { auto &fgc = _stash->_font_glyph_cache; auto x = fgc.find( _font ); if ( x != fgc.end() ) { std::shared_ptr<gl::texture> texture = x->second.texture; gl::api &ogl = ctxt.api(); ogl.save_matrix(); ogl.model_matrix().scale( to_api( _scale[0] ), to_api( _scale[1] ) ); ogl.model_matrix().translate( to_api( _pos[0] ), to_api( _pos[1] ) ); auto txt = texture->bind(); auto b = _mesh.bind(); // std::cout << "scale: " << _scale[0] << " (" << to_api( _scale[0] ) << ")" // << _scale[1] << " (" << to_api(_scale[1]) << ")" << std::endl; // std::cout << "pos: " << _pos[0] << " (" << to_api( _pos[0] ) << ")" // << _pos[1] << " (" << to_api(_pos[1]) << ")" << std::endl; // std::cout << "draw matrix: " << ogl.current_matrix() << std::endl; b.set_uniform( _mat_pos, ogl.current_matrix() ); b.set_uniform( _col_pos, _color ); b.set_uniform( _tex_pos, static_cast<int>( txt.unit() ) ); b.draw(); ogl.restore_matrix(); } } }
rectangle::rectangle( dim x, dim y, dim w, dim h, const color &c ) : _color( c ) { _rect = gl::matrix4::scaling( to_api( w ), to_api( h ) ); _rect.translate_x( to_api( x ) ); _rect.translate_y( to_api( y ) ); }
rc_t create_cmd::issue(connection& con) { msg_t req(con.ctx(), m_ip_addrs.size() * sizeof(vapi_type_address), std::ref(*this)); uint8_t n; auto& payload = req.get_request().get_payload(); payload.endpoint.sw_if_index = m_itf.value(); payload.endpoint.sclass = m_sclass; payload.endpoint.n_ips = m_ip_addrs.size(); payload.endpoint.flags = to_api(m_flags); for (n = 0; n < payload.endpoint.n_ips; n++) { VOM::to_api(m_ip_addrs[n], payload.endpoint.ips[n]); } to_api(m_mac, payload.endpoint.mac); VAPI_CALL(req.execute()); return (wait()); }
rc_t config_cmd::issue(connection& con) { msg_t req(con.ctx(), std::ref(*this)); auto& payload = req.get_request().get_payload(); payload.is_add = 1; payload.punt.rx_sw_if_index = m_rx_itf.value(); payload.punt.tx_sw_if_index = m_tx_itf.value(); to_api(m_addr, payload.punt.nh); VAPI_CALL(req.execute()); return (wait()); }
void rectangle::set_position( dim x, dim y ) { _rect.get( 0, 3 ) = to_api( x ); _rect.get( 1, 3 ) = to_api( y ); }
void rectangle::set_size( dim w, dim h ) { _rect.get( 0, 0 ) = to_api( w ); _rect.get( 1, 1 ) = to_api( h ); }