Code: Select all
bool MainApp::OnInit(){
...
//Size is weird, 160x144 for the screen, 20 height for the tool bar and then some random amount.
frame = new MainFrame(wxT("yanGBe"), wxDefaultPosition, wxSize(160 + 16, 144 + 20 + 37), g);
panel = new ImagePanel(frame);
...
wxTimer* timer = new wxTimer(this, wxID_EXECUTE);
timer->Start(16);
watch = new wxStopWatch();
lastUpdate = 0;
return true;
}
void MainApp::Update(wxTimerEvent& event){
unsigned long long thisUpdate = watch->Time();
cout << "Update start " << thisUpdate - lastUpdate << "ms" << endl;
lastUpdate = thisUpdate;
if (frame->stateChangeRequested)
return;
if (g == nullptr)
return;
g->UpdateToVBlank();
panel->SetData(&g->g->data[0][0][0]);
panel->PaintNow();
cout << "\tUpdate took " << watch->Time() - thisUpdate << "ms" << endl;
}
Is there possibly some sort of system configuration that's causing this, or is there possibly a better way of doing this?
And as a side question, how exactly is the frame size calculated? I want a 160x144 size for the panel, so I add 20 pixels for the toolbar on the frame but it comes up short in width and height.