mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-24 17:39:47 +00:00
Keeping aspect ratio is now optional (but default)
This commit is contained in:
parent
c9d4a4ebb5
commit
1268bf3a35
@ -3,4 +3,5 @@
|
||||
@interface GBPreferencesWindow : NSWindow <NSTableViewDelegate, NSTableViewDataSource>
|
||||
@property IBOutlet NSTableView *controlsTableView;
|
||||
@property IBOutlet NSPopUpButton *graphicsFilterPopupButton;
|
||||
@property (strong) IBOutlet NSButton *aspectRatioCheckbox;
|
||||
@end
|
||||
|
@ -8,6 +8,7 @@
|
||||
NSInteger button_being_modified;
|
||||
|
||||
NSPopUpButton *_graphicsFilterPopupButton;
|
||||
NSButton *_aspectRatioCheckbox;
|
||||
}
|
||||
|
||||
+ (NSArray *)filterList
|
||||
@ -100,4 +101,22 @@
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"GBFilterChanged" object:nil];
|
||||
}
|
||||
|
||||
- (IBAction)changeAspectRatio:(id)sender
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setBool: [(NSButton *)sender state] != NSOnState
|
||||
forKey:@"GBAspectRatioUnkept"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"GBAspectChanged" object:nil];
|
||||
}
|
||||
|
||||
- (NSButton *)aspectRatioCheckbox
|
||||
{
|
||||
return _aspectRatioCheckbox;
|
||||
}
|
||||
|
||||
- (void)setAspectRatioCheckbox:(NSButton *)aspectRatioCheckbox
|
||||
{
|
||||
_aspectRatioCheckbox = aspectRatioCheckbox;
|
||||
[_aspectRatioCheckbox setState: ![[NSUserDefaults standardUserDefaults] boolForKey:@"GBAspectRatioUnkept"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -41,6 +41,7 @@
|
||||
image_buffers[2] = malloc(160 * 144 * 4);
|
||||
_shouldBlendFrameWithPrevious = 1;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(filterChanged) name:@"GBFilterChanged" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ratioKeepingChanged) name:@"GBAspectChanged" object:nil];
|
||||
}
|
||||
|
||||
- (void) filterChanged
|
||||
@ -49,6 +50,11 @@
|
||||
self.shader = nil;
|
||||
}
|
||||
|
||||
- (void) ratioKeepingChanged
|
||||
{
|
||||
[self setFrame:self.superview.frame];
|
||||
}
|
||||
|
||||
- (void) setShouldBlendFrameWithPrevious:(BOOL)shouldBlendFrameWithPrevious
|
||||
{
|
||||
_shouldBlendFrameWithPrevious = shouldBlendFrameWithPrevious;
|
||||
@ -90,18 +96,20 @@
|
||||
- (void)setFrame:(NSRect)frame
|
||||
{
|
||||
frame = self.superview.frame;
|
||||
double ratio = frame.size.width / frame.size.height;
|
||||
if (ratio >= 160.0/144.0) {
|
||||
double new_width = round(frame.size.height / 144.0 * 160.0);
|
||||
frame.origin.x = floor((frame.size.width - new_width) / 2);
|
||||
frame.size.width = new_width;
|
||||
frame.origin.y = 0;
|
||||
}
|
||||
else {
|
||||
double new_height = round(frame.size.width / 160.0 * 144.0);
|
||||
frame.origin.y = floor((frame.size.height - new_height) / 2);
|
||||
frame.size.height = new_height;
|
||||
frame.origin.x = 0;
|
||||
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"GBAspectRatioUnkept"]) {
|
||||
double ratio = frame.size.width / frame.size.height;
|
||||
if (ratio >= 160.0/144.0) {
|
||||
double new_width = round(frame.size.height / 144.0 * 160.0);
|
||||
frame.origin.x = floor((frame.size.width - new_width) / 2);
|
||||
frame.size.width = new_width;
|
||||
frame.origin.y = 0;
|
||||
}
|
||||
else {
|
||||
double new_height = round(frame.size.width / 160.0 * 144.0);
|
||||
frame.origin.y = floor((frame.size.height - new_height) / 2);
|
||||
frame.size.height = new_height;
|
||||
frame.origin.x = 0;
|
||||
}
|
||||
}
|
||||
[super setFrame:frame];
|
||||
}
|
||||
|
@ -15,10 +15,10 @@
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="292" height="292"/>
|
||||
<rect key="contentRect" x="196" y="240" width="292" height="330"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||
<view key="contentView" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="292" height="292"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="292" height="330"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Utu-t4-cLx">
|
||||
@ -30,7 +30,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T91-rh-rRp">
|
||||
<rect key="frame" x="18" y="255" width="256" height="17"/>
|
||||
<rect key="frame" x="18" y="293" width="256" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Graphics Filter:" id="pXg-WY-8Q5">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -38,7 +38,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6pP-kK-EEC">
|
||||
<rect key="frame" x="30" y="223" width="245" height="26"/>
|
||||
<rect key="frame" x="30" y="261" width="245" height="26"/>
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="I1w-05-lGl">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
@ -70,6 +70,16 @@
|
||||
<action selector="graphicFilterChanged:" target="QvC-M9-y7g" id="n87-t4-fbV"/>
|
||||
</connections>
|
||||
</popUpButton>
|
||||
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vfj-tg-7OP">
|
||||
<rect key="frame" x="18" y="237" width="256" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Keep Aspect Ratio" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="lsj-rC-Eo6">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="changeAspectRatio:" target="QvC-M9-y7g" id="mQG-Ib-1jN"/>
|
||||
</connections>
|
||||
</button>
|
||||
<scrollView focusRingType="none" fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="PBp-dj-EIa">
|
||||
<rect key="frame" x="20" y="20" width="252" height="173"/>
|
||||
<clipView key="contentView" focusRingType="none" ambiguous="YES" drawsBackground="NO" id="AMs-PO-nid">
|
||||
@ -130,11 +140,12 @@
|
||||
</subviews>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="aspectRatioCheckbox" destination="Vfj-tg-7OP" id="Yw0-xS-DBr"/>
|
||||
<outlet property="controlsTableView" destination="UDd-IJ-fxX" id="a1D-Md-yXv"/>
|
||||
<outlet property="delegate" destination="-2" id="ASc-vN-Zbq"/>
|
||||
<outlet property="graphicsFilterPopupButton" destination="6pP-kK-EEC" id="LS7-HY-kHC"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="179" y="431"/>
|
||||
<point key="canvasLocation" x="179" y="450"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
|
Loading…
Reference in New Issue
Block a user