2011-09-05 03:48:23 +00:00
|
|
|
Geometry pFont::geometry(const string &description, const string &text) {
|
|
|
|
return pFont::geometry(pFont::create(description), text);
|
|
|
|
}
|
|
|
|
|
|
|
|
QFont pFont::create(const string &description) {
|
|
|
|
lstring part;
|
|
|
|
part.split(",", description);
|
2011-09-27 11:55:02 +00:00
|
|
|
for(auto &item : part) item.trim(" ");
|
2011-09-05 03:48:23 +00:00
|
|
|
|
2011-10-16 09:44:48 +00:00
|
|
|
string family = "Sans";
|
|
|
|
unsigned size = 8u;
|
|
|
|
bool bold = false;
|
|
|
|
bool italic = false;
|
|
|
|
|
|
|
|
if(part[0] != "") family = part[0];
|
|
|
|
if(part.size() >= 2) size = decimal(part[1]);
|
|
|
|
if(part.size() >= 3) bold = part[2].position("Bold");
|
|
|
|
if(part.size() >= 3) italic = part[2].position("Italic");
|
2011-09-05 03:48:23 +00:00
|
|
|
|
|
|
|
QFont qtFont;
|
2011-10-16 09:44:48 +00:00
|
|
|
qtFont.setFamily(family);
|
Update to v082r18 release.
byuu says:
There we go, the GUI is nearly feature-complete once again.
All cores now output their native video format (NES={emphasis}{palette},
SNES=BGR555, GameBoy={ bright, normal, darker, darkest }), and are
transformed to RGB555 data that is passed to the video renderer.
The video renderer then uses its internal palette to apply
brightness/contrast/gamma/ramp adjustments and outputs in RGB888 color
space.
This does add in another rendering pass, unfortunately, but it's
a necessary one for universal support.
The plan is to adapt all filters to take RGB555 input, and output RGB555
data as well. By doing this, it will be possible to stack filters.
However, it's a bit complicated: I need to plan how the stacking should
occur (eg we never want to apply scanlines before HQ2x, etc.)
Added input frequency adjustments for all three systems. I can easily
get perfect video/audio sync on all three now, hooray.
Long-term, it seems like we only really need one, and we can do
a video/audio delta to get an adjusted value. But for now, this gets the
job done.
Added audio volume adjust. I left out the balance for now, since it's
obviously impossible to balance the NES' single channel audio (I can
duplicate the channel, and do twice the filtering work, but ... why?)
I replaced NTSC/PAL TV mode selection with an "Enable Overscan"
checkbox. On, you get 240 lines on NES+SNES. Off, you get 224 lines on
NES+SNES.
Also added aspect correction box back. I don't do that gross PAL
distortion shit anymore, sorry PAL people. I just scale up the
54/47*(240/224) aspect correction for overscan off mode.
All memory is loaded and saved now, for all three systems (hooray, now
you can actually play Zelda 1&2.)
Added all of the old bsnes hotkeys, with the exception of capture
screenshot. May add again later. May come up with something a bit
different for extra features.
Re-added the NSS DIP switch setting window. Since geometry is saved,
I didn't want to auto-hide rows, so now you'll see all eight possible
DIPs, and the ones not used are grayed out.
Ultimately, nobody will notice since we only have DIPs for ActRaiser
NSS, and nobody's probably even using the XML file for that anyway.
Whatever, it's nice to have anyway.
Took FitzRoy's advice and single-item combo boxes on the input selection
are disabled, so the user doesn't waste time checking them.
I wanted to leave text so that you know there's not a problem. Qt
disabled radio box items look almost exactly like enabled ones.
Fixed lots of issues in phoenix and extended it a bit. But I was still
having trouble with radio box grouping, so I said fuck it and made the
panels show/hide based instead of append/remove based.
That's all for stuff off the checklist, I did a bunch of other things
I don't recall.
So yeah, I'd say the GUI is 100% usable now. This is my opinion on how
multi-platform GUIs should be done =)
Oh, I figure I should mention, but the NES core is GPLv3, and all future
SNES+GB releases will be as well. It's a move against Microsoft's Metro
store.
2011-09-20 14:04:43 +00:00
|
|
|
qtFont.setPointSize(size);
|
2011-09-05 03:48:23 +00:00
|
|
|
if(bold) qtFont.setBold(true);
|
|
|
|
if(italic) qtFont.setItalic(true);
|
|
|
|
return qtFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
Geometry pFont::geometry(const QFont &qtFont, const string &text) {
|
|
|
|
QFontMetrics metrics(qtFont);
|
2011-03-22 12:56:49 +00:00
|
|
|
|
|
|
|
lstring lines;
|
|
|
|
lines.split("\n", text);
|
|
|
|
|
|
|
|
unsigned maxWidth = 0;
|
2011-09-27 11:55:02 +00:00
|
|
|
for(auto &line : lines) {
|
2011-03-22 12:56:49 +00:00
|
|
|
maxWidth = max(maxWidth, metrics.width(line));
|
|
|
|
}
|
|
|
|
|
|
|
|
return { 0, 0, maxWidth, metrics.height() * lines.size() };
|
|
|
|
}
|