私はwxWidgetsプログラムに取り組んでいます。これは、wxWikiの「アイドルイベントを使ったレンダリングループの作成」のようなものです。背景パネル、点滅するテキスト、アニメーションを表示するように表示パネルを変更しました。wxWidgetsプログラムはCPU使用量を増やす
void MyApp::onIdle(wxIdleEvent& evt)
{
if(render_loop_on)
{
drawPane->paintNow();
while(Pending())
Dispatch();
evt.RequestMore();
}
}
BasicDrawPane::BasicDrawPane(wxFrame* parent) :
wxPanel(parent)
{
wxBitmap background;
background.LoadFile("background.png", wxBITMAP_TYPE_PNG);
m_pBackground = new wxStaticBitmap(this, -1, background);
m_pBackground->Show();
m_pText = new wxStaticText(this, -1, wxT("blinking"), wxPoint(400, 10));
m_pText->Show();
m_bShow = false;
wxAnimation iconAni;
iconAni.LoadFile("animation.gif");
m_wxIconAnimationCtrl = new wxAnimationCtrl(this, -1, iconAni);
m_wxIconAnimationCtrl->Play();
}
void BasicDrawPane::paintNow()
{
m_bShow = !m_bShow;
m_pText->Show(m_bShow);
}
プログラムが起動した後、それなしでメモリとCPU使用率が直線的に増加しますが、それでも派遣機能とCPU使用率が数時間のために実行した後、徐々に登るますので、私は派遣機能を追加しました。バックグラウンドだけを表示している場合のみ、CPU使用率が安定します。
私はwxWidgets 2.8.11でpuppy linuxでテストしましたが、誰も助言できますか?
で
交換してみてくださいしかし、私はそれを解決する方法を知らない。 – Ruhoo2004