简体   繁体   English

为什么我不能在虚拟设备上写?

[英]Why can't I write on the virtual device?

Why does the virtual device doesn't present the sprintf? 为什么虚拟设备不显示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). 它的确打开了窗口并设置了背景颜色,但是在窗口中没有显示其他任何内容(例如sprintf和g2_string命令)。

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出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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