mirror of https://github.com/bsnes-emu/bsnes.git
Proportional Reiszing
This commit is contained in:
parent
9321df9630
commit
39f91f0dd6
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1713" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="Document">
|
<customObject id="-2" userLabel="File's Owner" customClass="Document">
|
||||||
|
@ -26,10 +26,16 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
|
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<openGLView colorSize="5bit_RGB_8bit_Alpha" useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" id="uqf-pe-VAF" customClass="GBView">
|
<customView id="KTk-4M-J7t" customClass="GBBorderView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
|
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
</openGLView>
|
<subviews>
|
||||||
|
<openGLView colorSize="5bit_RGB_8bit_Alpha" useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" id="uqf-pe-VAF" customClass="GBView">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
</openGLView>
|
||||||
|
</subviews>
|
||||||
|
</customView>
|
||||||
</subviews>
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
<connections>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@interface GBBorderView : NSView
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,11 @@
|
||||||
|
#import "GBBorderView.h"
|
||||||
|
|
||||||
|
@implementation GBBorderView
|
||||||
|
|
||||||
|
- (void)drawRect:(NSRect)dirtyRect {
|
||||||
|
[[NSColor blackColor] setFill];
|
||||||
|
NSRectFill(dirtyRect);
|
||||||
|
[super drawRect:dirtyRect];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -87,6 +87,25 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (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;
|
||||||
|
}
|
||||||
|
[super setFrame:frame];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)dirtyRect {
|
- (void)drawRect:(NSRect)dirtyRect {
|
||||||
if (!self.shader) {
|
if (!self.shader) {
|
||||||
self.shader = [[GBShader alloc] initWithName:[[NSUserDefaults standardUserDefaults] objectForKey:@"GBFilter"]];
|
self.shader = [[GBShader alloc] initWithName:[[NSUserDefaults standardUserDefaults] objectForKey:@"GBFilter"]];
|
||||||
|
@ -110,7 +129,6 @@
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) flip
|
- (void) flip
|
||||||
{
|
{
|
||||||
current_buffer = (current_buffer + 1) % self.numberOfBuffers;
|
current_buffer = (current_buffer + 1) % self.numberOfBuffers;
|
||||||
|
|
Loading…
Reference in New Issue