1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-29 00:29:28 +00:00

Fixed mismatch between initial tick box states and communicated switches; ensured they're visible upon launching a game.

This commit is contained in:
Thomas Harte 2016-06-20 21:31:07 -04:00
parent 2f00b841d8
commit 3591479571
2 changed files with 18 additions and 3 deletions

View File

@ -68,7 +68,7 @@
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="3qw-C1-NYW">
<rect key="frame" x="18" y="58" width="164" height="18"/>
<buttonCell key="cell" type="check" title="Black and White" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="UP7-mf-IKo">
<buttonCell key="cell" type="check" title="Black and White" bezelStyle="regularSquare" imagePosition="left" inset="2" id="UP7-mf-IKo">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@ -78,7 +78,7 @@
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="Xbc-cw-Sc2">
<rect key="frame" x="18" y="38" width="164" height="18"/>
<buttonCell key="cell" type="check" title="Left Player Difficulty" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="wlJ-8s-PEh">
<buttonCell key="cell" type="check" title="Left Player Difficulty" bezelStyle="regularSquare" imagePosition="left" inset="2" id="wlJ-8s-PEh">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@ -88,7 +88,7 @@
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="kPV-Tm-TTc">
<rect key="frame" x="18" y="18" width="164" height="18"/>
<buttonCell key="cell" type="check" title="Right Player Difficulty" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="F05-cA-66S">
<buttonCell key="cell" type="check" title="Right Player Difficulty" bezelStyle="regularSquare" imagePosition="left" inset="2" id="F05-cA-66S">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>

View File

@ -28,6 +28,17 @@ class Atari2600Document: MachineDocument {
atari2600.setROM(data)
}
override func windowControllerDidLoadNib(aController: NSWindowController) {
super.windowControllerDidLoadNib(aController)
// push whatever settings the switches have in the NIB into the emulation
pushSwitchValues()
// show the options window but ensure the OpenGL view is key
showOptions(self)
self.openGLView.window?.makeKeyWindow()
}
// MARK: CSOpenGLViewResponderDelegate
private func inputForKey(event: NSEvent) -> Atari2600DigitalInput? {
switch event.keyCode {
@ -72,6 +83,10 @@ class Atari2600Document: MachineDocument {
@IBOutlet var rightPlayerDifficultyButton: NSButton!
@IBAction func optionDidChange(sender: AnyObject!) {
pushSwitchValues()
}
private func pushSwitchValues() {
atari2600.colourButton = colourButton.state == NSOnState
atari2600.leftPlayerDifficultyButton = leftPlayerDifficultyButton.state == NSOnState
atari2600.rightPlayerDifficultyButton = rightPlayerDifficultyButton.state == NSOnState