mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 21:13:13 +02:00
Update to v104r14 release.
byuu says: Changelog: - Emulator::Interface::videoResolution() -\> VideoResolution renamed to videoInformation() -\> VideoInformation - added double VideoInformation::refreshRate - higan: added `binary := (application|library)` — set this to `library` to produce a dynamic link library - higan: removed `-march=native` for macOS application builds; and for all library builds - higan: removed `console` build flag; uncomment `link += -mwindows` instead - nall/GNUmakefile: `macosx` platform renamed `macos` - still need to do this for nall/intrinsics.hpp - Game Gear: return region=NTSC as the only option, so that the system frequency is always set correctly - hiro/cocoa: fixed typo [Sintendo] - hiro/Windows: removed GetDpiForMonitor, as it's Windows 8+ only; DPI is no longer per-monitor aware - icarus: core Icarus class now has virtual functions for directory::create, <file::exists>, <file::copy>, <file::write> - icarus: Sufami Turbo can import save RAM files now - icarus: setting `ICARUS_LIBRARY` define will compile icarus without main(), GUI components - ruby/video/Direct3D: choose the current monitor instead of top-left monitor for fullscreen exclusive [Cydrak] - ruby/video/Direct3D: do not set `WS_EX_TOPMOST` on fullscreen exclusive window [Cydrak] - this isn't necessary for exclusive mode, and it just makes getting out of the application more difficult
This commit is contained in:
@@ -30,7 +30,7 @@ auto pFont::family(const string& family) -> string {
|
||||
auto pFont::create(const Font& font) -> NSFont* {
|
||||
auto fontName = family(font.family());
|
||||
NSString* family = [NSString stringWithUTF8String:fontName];
|
||||
CGFloat size = (float)(font.size() ? font.size() : 8);
|
||||
CGFloat size = Application::scale(font.size() ? font.size() : 8);
|
||||
NSFontTraitMask traits = 0;
|
||||
|
||||
if(font.bold()) traits |= NSBoldFontMask;
|
||||
|
@@ -11,7 +11,7 @@ auto pMonitor::count() -> uint {
|
||||
auto pMonitor::dpi(uint monitor) -> Position {
|
||||
@autoreleasepool {
|
||||
NSScreen* screen = [[NSScreen screens] objectAtIndex:monitor];
|
||||
NSDistionary* dictionary = [screen deviceDescription];
|
||||
NSDictionary* dictionary = [screen deviceDescription];
|
||||
NSSize dpi = [[dictionary objectForKey:NSDeviceSize] sizeValue];
|
||||
return {dpi.width, dpi.height};
|
||||
}
|
||||
|
@@ -55,6 +55,10 @@ auto Application::setScale(float scale) -> void {
|
||||
state.scale = scale;
|
||||
}
|
||||
|
||||
auto Application::unscale(float value) -> float {
|
||||
return value * (1.0 / state.scale);
|
||||
}
|
||||
|
||||
//Windows
|
||||
//=======
|
||||
|
||||
|
@@ -385,6 +385,7 @@ struct Application {
|
||||
static auto setFont(const Font& font = {}) -> void;
|
||||
static auto setName(const string& name = "") -> void;
|
||||
static auto setScale(float scale = 1.0) -> void;
|
||||
static auto unscale(float value) -> float;
|
||||
|
||||
struct Windows {
|
||||
static auto doModalChange(bool modal) -> void;
|
||||
|
@@ -14,7 +14,7 @@ auto pFont::size(PangoFontDescription* font, const string& text) -> Size {
|
||||
PangoLayout* layout = pango_layout_new(context);
|
||||
pango_layout_set_font_description(layout, font);
|
||||
pango_layout_set_text(layout, text, -1);
|
||||
signed width = 0, height = 0;
|
||||
int width = 0, height = 0;
|
||||
pango_layout_get_pixel_size(layout, &width, &height);
|
||||
g_object_unref((gpointer)layout);
|
||||
return {width, height};
|
||||
@@ -39,7 +39,7 @@ auto pFont::family(const string& family) -> string {
|
||||
auto pFont::create(const Font& font) -> PangoFontDescription* {
|
||||
auto p = pango_font_description_new();
|
||||
pango_font_description_set_family(p, family(font.family()));
|
||||
pango_font_description_set_size(p, (font.size() ? font.size() : 8) * PANGO_SCALE);
|
||||
pango_font_description_set_size(p, Application::scale(font.size() ? font.size() : 8) * PANGO_SCALE);
|
||||
pango_font_description_set_weight(p, font.bold() ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
|
||||
pango_font_description_set_style(p, font.italic() ? PANGO_STYLE_OBLIQUE : PANGO_STYLE_NORMAL);
|
||||
return p;
|
||||
|
@@ -26,7 +26,7 @@ auto pFont::family(const string& family) -> QString {
|
||||
auto pFont::create(const Font& font) -> QFont {
|
||||
QFont qtFont;
|
||||
qtFont.setFamily(family(font.family()));
|
||||
qtFont.setPointSize(font.size() ? font.size() : 8);
|
||||
qtFont.setPointSize(Application::scale(font.size() ? font.size() : 8));
|
||||
qtFont.setBold(font.bold());
|
||||
qtFont.setItalic(font.italic());
|
||||
return qtFont;
|
||||
|
@@ -27,7 +27,7 @@ auto pFont::family(const string& family) -> string {
|
||||
|
||||
auto pFont::create(const Font& font) -> HFONT {
|
||||
return CreateFont(
|
||||
-((font.size() ? font.size() : 8) * 96.0 / 72.0 + 0.5),
|
||||
-(Application::scale(font.size() ? font.size() : 8) * 96.0 / 72.0 + 0.5),
|
||||
0, 0, 0, font.bold() ? FW_BOLD : FW_NORMAL, font.italic(), 0, 0, 0, 0, 0, 0, 0,
|
||||
utf16_t(family(font.family()))
|
||||
);
|
||||
|
@@ -5,24 +5,19 @@ namespace hiro {
|
||||
struct MonitorInfo {
|
||||
uint monitor = 0;
|
||||
uint primary = 0;
|
||||
float dpiX = 0;
|
||||
float dpiY = 0;
|
||||
Geometry geometry;
|
||||
uint index = 0;
|
||||
};
|
||||
|
||||
static auto CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) -> BOOL {
|
||||
MonitorInfo& info = *(MonitorInfo*)dwData;
|
||||
MONITORINFOEX mi{sizeof(MONITORINFOEX)};
|
||||
MONITORINFOEX mi{};
|
||||
mi.cbSize = sizeof(MONITORINFOEX);
|
||||
GetMonitorInfo(hMonitor, &mi);
|
||||
string displayName = (const char*)utf8_t(mi.szDevice);
|
||||
if(displayName.beginsWith(R"(\\.\DISPLAYV)")) return true; //ignore pseudo-monitors
|
||||
if(mi.dwFlags & MONITORINFOF_PRIMARY) info.primary = info.index;
|
||||
if(info.monitor == info.index) {
|
||||
UINT dpiX = 0, dpiY = 0;
|
||||
GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
|
||||
info.dpiX = dpiX;
|
||||
info.dpiY = dpiY;
|
||||
info.geometry = {lprcMonitor->left, lprcMonitor->top, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top};
|
||||
}
|
||||
info.index++;
|
||||
@@ -34,10 +29,11 @@ auto pMonitor::count() -> uint {
|
||||
}
|
||||
|
||||
auto pMonitor::dpi(uint monitor) -> Position {
|
||||
MonitorInfo info;
|
||||
info.monitor = monitor;
|
||||
EnumDisplayMonitors(nullptr, nullptr, MonitorEnumProc, (LPARAM)&info);
|
||||
return {info.dpiX, info.dpiY};
|
||||
HDC hdc = GetDC(0);
|
||||
auto dpiX = (float)GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
auto dpiY = (float)GetDeviceCaps(hdc, LOGPIXELSY);
|
||||
ReleaseDC(0, hdc);
|
||||
return {dpiX, dpiY};
|
||||
}
|
||||
|
||||
auto pMonitor::geometry(uint monitor) -> Geometry {
|
||||
|
@@ -173,7 +173,12 @@ auto Button_CustomDraw(HWND hwnd, PAINTSTRUCT& ps, bool bordered, bool checked,
|
||||
SetTextColor(ps.hdc, GetSysColor(IsWindowEnabled(hwnd) ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
|
||||
auto hFont = pFont::create(font);
|
||||
SelectObject(ps.hdc, hFont);
|
||||
RECT rcText{textGeometry.x(), textGeometry.y(), textGeometry.x() + textGeometry.width(), textGeometry.y() + textGeometry.height()};
|
||||
RECT rcText{
|
||||
LONG(textGeometry.x()),
|
||||
LONG(textGeometry.y()),
|
||||
LONG(textGeometry.x() + textGeometry.width()),
|
||||
LONG(textGeometry.y() + textGeometry.height())
|
||||
};
|
||||
DrawText(ps.hdc, wText, -1, &rcText, DT_NOPREFIX | DT_END_ELLIPSIS);
|
||||
DeleteObject(hFont);
|
||||
}
|
||||
|
@@ -31,9 +31,9 @@ auto pFrame::setGeometry(Geometry geometry) -> void {
|
||||
auto size = pFont::size(hfont, state().text);
|
||||
pWidget::setGeometry({
|
||||
geometry.x(),
|
||||
geometry.y() - (empty ? size.height() >> 1 : 0),
|
||||
geometry.y() - (empty ? size.height() / 2 : 0),
|
||||
geometry.width(),
|
||||
geometry.height() + (empty ? size.height() >> 1 : 0)
|
||||
geometry.height() + (empty ? size.height() / 2 : 0)
|
||||
});
|
||||
if(auto layout = state().layout) {
|
||||
if(empty) size.setHeight(1);
|
||||
|
Reference in New Issue
Block a user