bsnes/higan/target-bsnes/program/utility.cpp

61 lines
1.7 KiB
C++
Raw Normal View History

auto Program::showMessage(string text) -> void {
statusTime = chrono::timestamp();
statusMessage = text;
}
auto Program::showFrameRate(string text) -> void {
statusFrameRate = text;
}
auto Program::updateStatus() -> void {
string message;
if(chrono::timestamp() - statusTime <= 2) {
message = statusMessage;
}
if(message != presentation->statusLeft.text()) {
presentation->statusLeft.setText(message);
}
string frameRate;
if(!emulator->loaded()) {
frameRate = "Unloaded";
} else if(presentation->pauseEmulation.checked()) {
frameRate = "Paused";
} else if(!focused() && settingsWindow->input.pauseEmulation.checked()) {
frameRate = "Paused";
} else {
frameRate = statusFrameRate;
}
if(frameRate != presentation->statusRight.text()) {
presentation->statusRight.setText(frameRate);
}
}
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
auto Program::captureScreenshot() -> bool {
if(emulator->loaded() && screenshot.data) {
if(auto filename = screenshotPath()) {
if(Encode::BMP::create(filename,
(const uint32_t*)screenshot.data, screenshot.pitch, screenshot.width, screenshot.height, false
)) {
showMessage({"Captured screenshot [", Location::file(filename), "]"});
return true;
}
}
}
return false;
}
auto Program::paused() -> bool {
if(!emulator->loaded()) return true;
if(presentation->pauseEmulation.checked()) return true;
if(!focused() && settingsWindow->input.pauseEmulation.checked()) return true;
return false;
}
auto Program::focused() -> bool {
//exclusive mode creates its own top-level window: presentation window will not have focus
if(video && video->exclusive()) return true;
if(presentation && presentation->focused()) return true;
return false;
}