mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Ensured machines can nominate their own aspect ratio windows. Switched to 11/10 for the Electron.
This commit is contained in:
parent
7276a06cc0
commit
2cc72169ff
@ -55,7 +55,7 @@ Machine::Machine() :
|
||||
_tape.set_delegate(this);
|
||||
}
|
||||
|
||||
void Machine::setup_output()
|
||||
void Machine::setup_output(float aspect_ratio)
|
||||
{
|
||||
_crt = std::unique_ptr<Outputs::CRT::CRT>(new Outputs::CRT::CRT(crt_cycles_per_line, 8, Outputs::CRT::DisplayType::PAL50, 1));
|
||||
_crt->set_rgb_sampling_function(
|
||||
|
@ -151,7 +151,7 @@ class Machine: public CPU6502::Processor<Machine>, Tape::Delegate {
|
||||
|
||||
void set_key_state(Key key, bool isPressed);
|
||||
|
||||
void setup_output();
|
||||
void setup_output(float aspect_ratio);
|
||||
Outputs::CRT::CRT *get_crt() { return _crt.get(); }
|
||||
Outputs::Speaker *get_speaker() { return &_speaker; }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
|
||||
</dependencies>
|
||||
@ -16,15 +16,15 @@
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="133" y="235" width="400" height="300"/>
|
||||
<rect key="contentRect" x="133" y="235" width="440" height="400"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>
|
||||
<value key="minSize" type="size" width="228" height="171"/>
|
||||
<view key="contentView" id="gIp-Ho-8D9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="300"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="440" height="400"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<openGLView useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DEG-fq-cjd" customClass="CSOpenGLView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="300"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="440" height="400"/>
|
||||
</openGLView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
@ -18,7 +18,7 @@ class Atari2600Document: MachineDocument {
|
||||
|
||||
override func windowControllerDidLoadNib(aController: NSWindowController) {
|
||||
super.windowControllerDidLoadNib(aController)
|
||||
atari2600.view = openGLView
|
||||
atari2600.setView(openGLView, aspectRatio: 4.0 / 3.0)
|
||||
}
|
||||
|
||||
override class func autosavesInPlace() -> Bool {
|
||||
|
@ -16,6 +16,7 @@ class ElectronDocument: MachineDocument {
|
||||
override func windowControllerDidLoadNib(aController: NSWindowController) {
|
||||
super.windowControllerDidLoadNib(aController)
|
||||
self.intendedCyclesPerSecond = 2000000
|
||||
aController.window?.contentAspectRatio = NSSize(width: 11.0, height: 10.0)
|
||||
openGLView.performWithGLContext({
|
||||
if let osPath = NSBundle.mainBundle().pathForResource("os", ofType: "rom") {
|
||||
self.electron.setOSROM(NSData(contentsOfFile: osPath)!)
|
||||
@ -23,7 +24,7 @@ class ElectronDocument: MachineDocument {
|
||||
if let basicPath = NSBundle.mainBundle().pathForResource("basic", ofType: "rom") {
|
||||
self.electron.setBASICROM(NSData(contentsOfFile: basicPath)!)
|
||||
}
|
||||
self.electron.view = self.openGLView
|
||||
self.electron.setView(self.openGLView, aspectRatio: 11.0 / 10.0)
|
||||
self.electron.audioQueue = self.audioQueue
|
||||
})
|
||||
}
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
@interface CSElectron : CSMachine
|
||||
|
||||
- (void)setupOutput;
|
||||
|
||||
- (void)setOSROM:(nonnull NSData *)rom;
|
||||
- (void)setBASICROM:(nonnull NSData *)rom;
|
||||
- (void)setROM:(nonnull NSData *)rom slot:(int)slot;
|
||||
|
@ -152,9 +152,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setupOutput {
|
||||
- (void)setupOutputWithAspectRatio:(float)aspectRatio {
|
||||
@synchronized(self) {
|
||||
_electron.setup_output();
|
||||
_electron.setup_output(aspectRatio);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,6 @@
|
||||
- (void)speaker:(Outputs::Speaker *)speaker didCompleteSamples:(const int16_t *)samples length:(int)length;
|
||||
- (void)performAsync:(dispatch_block_t)action;
|
||||
- (void)performSync:(dispatch_block_t)action;
|
||||
- (void)setupOutput;
|
||||
- (void)setupOutputWithAspectRatio:(float)aspectRatio;
|
||||
|
||||
@end
|
||||
|
@ -13,8 +13,8 @@
|
||||
@interface CSMachine : NSObject
|
||||
|
||||
- (void)runForNumberOfCycles:(int)numberOfCycles;
|
||||
- (void)setView:(CSOpenGLView *)view aspectRatio:(float)aspectRatio;
|
||||
|
||||
@property (nonatomic, weak) CSOpenGLView *view;
|
||||
@property (nonatomic, weak) AudioQueue *audioQueue;
|
||||
|
||||
@end
|
||||
|
@ -51,12 +51,11 @@ struct SpeakerDelegate: public Outputs::Speaker::Delegate {
|
||||
dispatch_async(_serialDispatchQueue, action);
|
||||
}
|
||||
|
||||
- (void)setupOutput {}
|
||||
- (void)setupOutputWithAspectRatio:(float)aspectRatio {}
|
||||
|
||||
- (void)setView:(CSOpenGLView *)view {
|
||||
_view = view;
|
||||
- (void)setView:(CSOpenGLView *)view aspectRatio:(float)aspectRatio {
|
||||
[view performWithGLContext:^{
|
||||
[self setupOutput];
|
||||
[self setupOutputWithAspectRatio:aspectRatio];
|
||||
}];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user