简体   繁体   中英

Why can't I write on the virtual device?

Why does the virtual device doesn't present the sprintf? It does open the window and sets the background color, but doesn't present anything else in the window (like the sprintf and g2_string commands).

char str[256];

case'2':

    dev=g2_open_X11(750, 500); 
    d=g2_open_vd();
    g2_clear(d);
    g2_set_font_size(d, 14); 
    g2_attach(d, dev); 

    g2_set_auto_flush(d, 0);
    g2_pen(d, 0);
    g2_set_background(d, 1);

    sprintf(str, "Atitude:   %.4f graus", alfa);
    g2_string(d, 30, 250, str);

    sprintf(str, "Altitude:   %.4f m", ht);
    g2_string(d, 30, 230, str);

    sprintf(str, "Distancia horizontal:   %.4f m", xt);
    g2_string(d, 30, 210, str);

    sprintf(str, "Velocidade em x:   %.4f m/s", vxt);
    g2_string(d, 30, 190, str);

    sprintf(str, "Velocidade em z:   %.4f m/s", vzt);
    g2_string(d, 30, 170, str);

    sprintf(str, "Combustivel:   %.4f Kg", m_comb);
    g2_string(d, 30, 150, str);
break;

假设是您正在使用的库,则需要启用自动刷新功能(已使用g2_set_auto_flush(d, 0);对其进行了禁用g2_set_auto_flush(d, 0);调用),或者在完成所需的一批操作后调用g2_flush出现。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM