mirror of
https://github.com/trudnai/Steve2.git
synced 2026-01-23 04:16:34 +00:00
Mouse 2 Joystick emulation improvements
This commit is contained in:
@@ -1899,7 +1899,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MARKETING_VERSION = 0.85;
|
||||
OTHER_CFLAGS = (
|
||||
"-DDISASSEMBLER",
|
||||
@@ -1942,7 +1942,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
LLVM_LTO = YES_THIN;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MARKETING_VERSION = 0.85;
|
||||
OTHER_CFLAGS = (
|
||||
"-DDISASSEMBLER",
|
||||
@@ -2096,7 +2096,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MARKETING_VERSION = 0.86;
|
||||
OTHER_CFLAGS = (
|
||||
"-D_NO_DISASSEMBLER",
|
||||
@@ -2138,7 +2138,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
LLVM_LTO = YES_THIN;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MARKETING_VERSION = 0.86;
|
||||
OTHER_CFLAGS = (
|
||||
"-D_NO_DISASSEMBLER",
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
contextName = "spkr_toggle:speaker.c">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "spkr_samples[spkr_sample_last_idx]">
|
||||
value = "( (spkr_clk + m6502.clkfrm) / ( default_MHz_6502 * 1000 * 1000 / spkr_sample_rate)) * 2">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "(int16_t)28000 + (int16_t)-32768">
|
||||
@@ -63,7 +63,7 @@
|
||||
value = "(int)spkr_sample_idx_diff">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "( (spkr_clk + m6502.clkfrm) / ( default_MHz_6502 * 1000 * 1000 / spkr_sample_rate)) * 2">
|
||||
value = "spkr_samples[spkr_sample_last_idx]">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -152,7 +152,7 @@
|
||||
contextName = "closure #1 in ViewController.Update():ViewController.swift">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "MEMcfg.txt_page_2">
|
||||
value = "txtArr">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "self.shadowTxt">
|
||||
@@ -161,10 +161,10 @@
|
||||
value = "txt">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "MEMcfg.is_80STORE">
|
||||
value = "MEMcfg.txt_page_2">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "txtArr">
|
||||
value = "MEMcfg.is_80STORE">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -238,6 +238,20 @@
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
<ContextState
|
||||
contextName = "ViewController.mouseMoved(with:):ViewController.swift">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "oldLocation">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "mouseLocation">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "view.bounds">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
<ContextState
|
||||
contextName = "HiRes.refreshChanged(blockSize:):HiRes.swift">
|
||||
<PersistentStrings>
|
||||
@@ -270,7 +284,7 @@
|
||||
contextName = "LoRes.Update():LoRes.swift">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "UInt8( (block >> 4) & 0x0F )">
|
||||
value = "blockChanged[ screenIdx ]">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "UInt8(block)">
|
||||
@@ -279,7 +293,7 @@
|
||||
value = "UInt8(block & 4)">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "blockChanged[ screenIdx ]">
|
||||
value = "UInt8( (block >> 4) & 0x0F )">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -547,13 +561,13 @@
|
||||
contextName = "HiRes.compute():HiRes.swift">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "UnsafeRawBufferPointer(result)">
|
||||
value = "computePipelineState.maxTotalThreadsPerThreadgroup">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "result[2]">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "computePipelineState.maxTotalThreadsPerThreadgroup">
|
||||
value = "UnsafeRawBufferPointer(result)">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -612,7 +626,7 @@
|
||||
value = "new">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "WOZtmp.shift16">
|
||||
value = "WOZwrite.shift16">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "WOZwrite.shift">
|
||||
@@ -624,7 +638,7 @@
|
||||
value = "(1 << i) - 1">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "WOZwrite.shift16">
|
||||
value = "WOZtmp.shift16">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -773,10 +787,10 @@
|
||||
contextName = "set_flags_NZC:common.h">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "(unsigned)0xFF">
|
||||
value = "(unsigned)test ">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "(unsigned)test ">
|
||||
value = "(unsigned)0xFF">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -784,10 +798,10 @@
|
||||
contextName = "HiRes.draw(_:):HiRes.swift">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "HiRes.blockCols">
|
||||
value = "linAddr">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "ctx?.data">
|
||||
value = "ctx?.bitsPerComponent">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "ctx?.width">
|
||||
@@ -804,6 +818,9 @@
|
||||
<PersistentString
|
||||
value = "HiResLineAddrTbl">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "HiRes.blockCols">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "shadowScreen">
|
||||
</PersistentString>
|
||||
@@ -814,10 +831,7 @@
|
||||
value = "ctx?.height">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "linAddr">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "ctx?.bitsPerComponent">
|
||||
value = "ctx?.data">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -841,6 +855,9 @@
|
||||
<PersistentString
|
||||
value = "textDisplay_height_diff">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "textDisplay.frame">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "frame.size">
|
||||
</PersistentString>
|
||||
@@ -853,9 +870,6 @@
|
||||
<PersistentString
|
||||
value = "textDisplay_width_diff">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "textDisplay.frame">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
<ContextState
|
||||
@@ -865,16 +879,16 @@
|
||||
value = "m6502">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "Apple2_64K_RAM + 0x3600">
|
||||
value = "m6502.PC">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "Apple2_64K_AUX + 0x3600">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "(void*)Apple2_64K_RAM">
|
||||
value = "Apple2_64K_RAM + 0x3600">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "m6502.PC">
|
||||
value = "(void*)Apple2_64K_RAM">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -978,6 +992,17 @@
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
<ContextState
|
||||
contextName = "DisplayView.mouseExited(with:):DisplayView.swift">
|
||||
<PersistentStrings>
|
||||
<PersistentString
|
||||
value = "bounds">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "frame">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
<ContextState
|
||||
contextName = "pdl_read:paddle.h">
|
||||
<PersistentStrings>
|
||||
@@ -988,7 +1013,7 @@
|
||||
value = "pdl_value[pdl]">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "normalized_time">
|
||||
value = "normalized_time >= pdl_value[pdl] ? 255 : 0">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "(3300 * 255/3300)">
|
||||
@@ -1000,7 +1025,7 @@
|
||||
value = "1 * 512 * (1 - ( 3300 / 3300.0 ))">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "normalized_time >= pdl_value[pdl] ? 255 : 0">
|
||||
value = "normalized_time">
|
||||
</PersistentString>
|
||||
</PersistentStrings>
|
||||
</ContextState>
|
||||
@@ -1071,10 +1096,10 @@
|
||||
value = "Apple2_64K_AUX + 0xC600">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "Apple2_64K_RAM + 0xC600">
|
||||
value = "(void*)rom">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "(void*)rom">
|
||||
value = "Apple2_64K_RAM + 0xC600">
|
||||
</PersistentString>
|
||||
<PersistentString
|
||||
value = "strlen(fullPath)">
|
||||
|
||||
@@ -1439,7 +1439,7 @@
|
||||
<popUpButton key="view" id="rfS-6q-EKe">
|
||||
<rect key="frame" x="0.0" y="14" width="43" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:8bV-Aa-zHf:image" imagePosition="only" alignment="right" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" id="8bV-Aa-zHf">
|
||||
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="Quick Disk" imagePosition="only" alignment="right" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" id="8bV-Aa-zHf">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="7Vp-Rc-UbT">
|
||||
@@ -1682,6 +1682,7 @@
|
||||
</connections>
|
||||
</window>
|
||||
<connections>
|
||||
<outlet property="MouseToJoystickMenuItem" destination="GSq-wV-Mi3" id="fPa-ih-8v2"/>
|
||||
<outlet property="PauseButton" destination="s08-fv-vSO" id="BKA-QB-bh2"/>
|
||||
<outlet property="PauseToolbarItem" destination="QIP-vh-jcn" id="ooH-W5-2QO"/>
|
||||
<outlet property="SpeedSelector" destination="djd-zw-gXS" id="CsA-TF-ozP"/>
|
||||
@@ -1853,7 +1854,7 @@
|
||||
<subviews>
|
||||
<popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="49f-8R-QCc">
|
||||
<rect key="frame" x="0.0" y="83" width="120" height="103"/>
|
||||
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:8bV-Aa-zHf:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" id="CNs-lh-urM">
|
||||
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:CNs-lh-urM:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" id="CNs-lh-urM">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="N33-K0-nba">
|
||||
@@ -1887,7 +1888,7 @@
|
||||
</popUpButton>
|
||||
<popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="QDr-Cp-9QQ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="120" height="103"/>
|
||||
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:8bV-Aa-zHf:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" selectedItem="28N-X8-n7Q" id="8FA-1D-k8p">
|
||||
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:CNs-lh-urM:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" selectedItem="28N-X8-n7Q" id="8FA-1D-k8p">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="8He-mk-LVI">
|
||||
@@ -138916,7 +138917,7 @@ BQB9EQcAfREJAH0RCwB9ERQAfREZAH0RHwB9EScAfREpAH0RKwB9ES0AfREvAH0imwB9IqAAfSKtAH0i
|
||||
sAB9Ir0AfSLCAH0iygB9Is0AfSLSAH0i2gAAAAAAAAQBAAAAAAAAAFAAAAAAAAAAAAAAAAAAfSLdA
|
||||
</mutableData>
|
||||
</image>
|
||||
<image name="popUpButtonCell:8bV-Aa-zHf:image" width="1" height="1">
|
||||
<image name="popUpButtonCell:CNs-lh-urM:image" width="1" height="1">
|
||||
<mutableData key="keyedArchiveRepresentation">
|
||||
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T
|
||||
S2V5ZWRBcmNoaXZlctEICVRyb290gAGvEBcLDBkaIRQmKisyNTo9PkNGR0pUXF1hZFUkbnVsbNYNDg8Q
|
||||
|
||||
@@ -16,6 +16,28 @@ class DisplayView: NSTextView {
|
||||
// }
|
||||
// }
|
||||
|
||||
var trackingArea: NSTrackingArea?
|
||||
|
||||
/// Install tracking area if window is set, remove previous one if needed.
|
||||
func installTrackingArea() {
|
||||
guard let window = window else { return }
|
||||
window.acceptsMouseMovedEvents = true
|
||||
if trackingArea != nil { removeTrackingArea(trackingArea!) }
|
||||
let trackingOptions : NSTrackingArea.Options = [.activeAlways, .mouseEnteredAndExited, .mouseMoved]
|
||||
trackingArea = NSTrackingArea(rect: bounds,
|
||||
options: trackingOptions,
|
||||
owner: self, userInfo: nil)
|
||||
self.addTrackingArea(trackingArea!)
|
||||
}
|
||||
|
||||
|
||||
// Called when layout is modified
|
||||
override func updateTrackingAreas() {
|
||||
super.updateTrackingAreas()
|
||||
installTrackingArea()
|
||||
}
|
||||
|
||||
|
||||
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -26,6 +26,13 @@ import Cocoa
|
||||
|
||||
class ToolBarController: NSWindowController, NSWindowDelegate {
|
||||
|
||||
static var current : ToolBarController? = nil
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
ToolBarController.current = self
|
||||
}
|
||||
|
||||
func window(_ window: NSWindow, willUseFullScreenPresentationOptions proposedOptions: NSApplication.PresentationOptions = []) -> NSApplication.PresentationOptions {
|
||||
return [.autoHideToolbar, .autoHideMenuBar, .fullScreen]
|
||||
}
|
||||
@@ -260,6 +267,16 @@ class ToolBarController: NSWindowController, NSWindowDelegate {
|
||||
if let state = ViewController.current?.Mouse2Joystick {
|
||||
ViewController.current?.Mouse2Joystick = !state
|
||||
sender.selectedItem?.state = state ? .off : .on
|
||||
|
||||
if !state {
|
||||
// NSCursor.hide()
|
||||
ViewController.current?.mouseCursorJoystickEmulation.set()
|
||||
}
|
||||
else {
|
||||
NSCursor.unhide()
|
||||
// NSCursor.arrow.set()
|
||||
}
|
||||
|
||||
}
|
||||
break
|
||||
|
||||
@@ -275,6 +292,8 @@ class ToolBarController: NSWindowController, NSWindowDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet weak var MouseToJoystickMenuItem: NSMenuItem!
|
||||
|
||||
@IBAction func DiskOptions(_ sender: NSPopUpButton) {
|
||||
switch sender.selectedItem?.tag {
|
||||
case 1: // "Quick Disk"
|
||||
|
||||
@@ -462,31 +462,84 @@ class ViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
let mouseCursorJoystickEmulation = NSCursor.crosshair
|
||||
|
||||
func getScreenWithMouse() -> NSScreen? {
|
||||
let mouseLocation = NSEvent.mouseLocation
|
||||
let screens = NSScreen.screens
|
||||
let screenWithMouse = (screens.first { NSMouseInRect(mouseLocation, $0.frame, false) })
|
||||
|
||||
return screenWithMouse
|
||||
}
|
||||
|
||||
|
||||
func convertPoint(toCG : NSPoint) -> CGPoint {
|
||||
/// Cocoa and Core Graphics (a.k.a. Quartz) use different coordinate systems. In Cocoa, the origin is at the lower left of the primary screen and y increases as you go up. In Core Graphics, the origin is at the top left of the primary screen and y increases as you go down.
|
||||
/// Need to convert coordinates from Cocoa to Core Graphics
|
||||
var CGPoint = view.window!.convertPoint(toScreen: toCG)
|
||||
if let screen = getScreenWithMouse() {
|
||||
CGPoint.y = NSHeight(screen.frame) - CGPoint.y;
|
||||
}
|
||||
return CGPoint
|
||||
}
|
||||
|
||||
|
||||
override func mouseMoved(with event: NSEvent) {
|
||||
// print(#function)
|
||||
mouseLocation = event.locationInWindow
|
||||
var location = event.locationInWindow
|
||||
// displayOrigin = textDisplayScroller.frame.origin.
|
||||
// print("mx:", location.x, " my:", location.y)
|
||||
|
||||
var mouseCursorNeedsReplace = false
|
||||
|
||||
if location.x < 8 {
|
||||
mouseCursorNeedsReplace = true
|
||||
location.x = 8
|
||||
}
|
||||
if location.x >= textDisplay.frame.width - 7 {
|
||||
mouseCursorNeedsReplace = true
|
||||
location.x = textDisplay.frame.width - 8
|
||||
}
|
||||
if location.y < 8 {
|
||||
mouseCursorNeedsReplace = true
|
||||
location.y = 8
|
||||
}
|
||||
if location.y >= textDisplay.frame.height - 7 {
|
||||
mouseCursorNeedsReplace = true
|
||||
location.y = textDisplay.frame.height - 8
|
||||
}
|
||||
|
||||
if ( Mouse2Joystick ) {
|
||||
mouseCursorJoystickEmulation.set()
|
||||
|
||||
if mouseCursorNeedsReplace {
|
||||
CGWarpMouseCursorPosition(convertPoint(toCG: location))
|
||||
}
|
||||
|
||||
pdl_prevarr[0] = pdl_valarr[0]
|
||||
pdl_valarr[0] = Double(mouseLocation.x / (textDisplayScroller.frame.width) )
|
||||
pdl_valarr[0] = Double(location.x / (textDisplay.frame.width) )
|
||||
pdl_diffarr[0] = pdl_valarr[0] - pdl_prevarr[0]
|
||||
|
||||
pdl_prevarr[1] = pdl_valarr[1]
|
||||
pdl_valarr[1] = 1 - Double(mouseLocation.y / (textDisplayScroller.frame.height) )
|
||||
pdl_valarr[1] = 1 - Double(location.y / (textDisplay.frame.height) )
|
||||
pdl_diffarr[1] = pdl_valarr[1] - pdl_prevarr[1]
|
||||
}
|
||||
else {
|
||||
NSCursor.arrow.set()
|
||||
}
|
||||
|
||||
if ( MouseInterface ) {
|
||||
pdl_prevarr[2] = pdl_valarr[2]
|
||||
pdl_valarr[2] = Double(mouseLocation.x / (textDisplayScroller.frame.width) )
|
||||
pdl_valarr[2] = Double(location.x / (textDisplay.frame.width) )
|
||||
pdl_diffarr[2] = pdl_valarr[2] - pdl_prevarr[2]
|
||||
|
||||
pdl_prevarr[3] = pdl_valarr[3]
|
||||
pdl_valarr[3] = 1 - Double(mouseLocation.y / (textDisplayScroller.frame.height) )
|
||||
pdl_valarr[3] = 1 - Double(location.y / (textDisplay.frame.height) )
|
||||
pdl_diffarr[3] = pdl_valarr[3] - pdl_prevarr[3]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override func keyDown(with event: NSEvent) {
|
||||
|
||||
if ( cpuMode == cpuMode_eco ) {
|
||||
@@ -734,8 +787,6 @@ class ViewController: NSViewController {
|
||||
var frameCounter : UInt32 = 0
|
||||
var clkCounter : Double = 0
|
||||
|
||||
var mouseLocation = NSPoint.zero
|
||||
|
||||
var shadowTxt : String = ""
|
||||
var unicodeTextString : String = ""
|
||||
|
||||
@@ -977,9 +1028,27 @@ class ViewController: NSViewController {
|
||||
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
// print(#function)
|
||||
|
||||
switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
|
||||
case [.control, .command, .option]:
|
||||
Mouse2Joystick = !Mouse2Joystick
|
||||
|
||||
if Mouse2Joystick {
|
||||
ToolBarController.current?.MouseToJoystickMenuItem.state = .on
|
||||
mouseCursorJoystickEmulation.set()
|
||||
}
|
||||
else {
|
||||
ToolBarController.current?.MouseToJoystickMenuItem.state = .off
|
||||
NSCursor.arrow.set()
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
if ( Mouse2Joystick ) {
|
||||
setIO(0xC061, 1 << 7)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override func mouseUp(with event: NSEvent) {
|
||||
|
||||
Reference in New Issue
Block a user