Removed some debug prints

This commit is contained in:
tudnai 2020-06-05 23:16:17 -07:00
parent 469da345f4
commit b91fab6066

View File

@ -284,7 +284,7 @@ class ViewController: NSViewController {
} }
override func keyDown(with event: NSEvent) { override func keyDown(with event: NSEvent) {
print("keyDown") // print("keyDown")
// for i in 0...65536 { // for i in 0...65536 {
// ddd = Int(event.keyCode) + i // ddd = Int(event.keyCode) + i
@ -335,7 +335,7 @@ class ViewController: NSViewController {
let keyCode = Int(event.keyCode) let keyCode = Int(event.keyCode)
switch keyCode { switch keyCode {
case leftArrowKey: case leftArrowKey:
print("LEFT", ddd); // print("LEFT", ddd);
if ( Keyboard2Joystick ) { if ( Keyboard2Joystick ) {
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
pdl_valarr[0] = 0 pdl_valarr[0] = 0
@ -344,7 +344,7 @@ class ViewController: NSViewController {
case rightArrowKey: case rightArrowKey:
print("RIGHT") // print("RIGHT")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
if ( Keyboard2Joystick ) { if ( Keyboard2Joystick ) {
pdl_valarr[0] = 1 pdl_valarr[0] = 1
@ -352,7 +352,7 @@ class ViewController: NSViewController {
kbdInput(0x15) kbdInput(0x15)
case downArrowKey: case downArrowKey:
print("DOWN") // print("DOWN")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
if ( Keyboard2Joystick ) { if ( Keyboard2Joystick ) {
pdl_valarr[1] = 1 pdl_valarr[1] = 1
@ -361,7 +361,7 @@ class ViewController: NSViewController {
kbdInput(0x0B) kbdInput(0x0B)
} }
case upArrowKey: case upArrowKey:
print("UP") // print("UP")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
if ( Keyboard2Joystick ) { if ( Keyboard2Joystick ) {
pdl_valarr[1] = 0 pdl_valarr[1] = 0
@ -389,7 +389,7 @@ class ViewController: NSViewController {
override func keyUp(with event: NSEvent) { override func keyUp(with event: NSEvent) {
print("keyUp") // print("keyUp")
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) { // switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
// case [.command] where event.characters == "l", // case [.command] where event.characters == "l",
// [.command, .shift] where event.characters == "l": // [.command, .shift] where event.characters == "l":
@ -407,28 +407,28 @@ class ViewController: NSViewController {
case leftArrowKey: case leftArrowKey:
// kbdInput(0x08) // kbdInput(0x08)
// setIO(0xC064, 127); // setIO(0xC064, 127);
print("left") // print("left")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
pdl_valarr[0] = 0.5 pdl_valarr[0] = 0.5
case rightArrowKey: case rightArrowKey:
// kbdInput(0x15) // kbdInput(0x15)
// setIO(0xC064, 128); // setIO(0xC064, 128);
print("right") // print("right")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
pdl_valarr[0] = 0.5 pdl_valarr[0] = 0.5
case downArrowKey: case downArrowKey:
// kbdInput(0x0B) // kbdInput(0x0B)
// setIO(0xC065, 127); // setIO(0xC065, 127);
print("down") // print("down")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
pdl_valarr[1] = 0.5 pdl_valarr[1] = 0.5
case upArrowKey: case upArrowKey:
// kbdInput(0x0A) // kbdInput(0x0A)
// setIO(0xC065, 128); // setIO(0xC065, 128);
print("up") // print("up")
// Keyboard 2 JoyStick (Game Controller / Paddle) // Keyboard 2 JoyStick (Game Controller / Paddle)
pdl_valarr[1] = 0.5 pdl_valarr[1] = 0.5
@ -454,62 +454,62 @@ class ViewController: NSViewController {
setIO(0xC061, 0); setIO(0xC061, 0);
setIO(0xC062, 0); setIO(0xC062, 0);
setIO(0xC063, 0); // inverted (bit 7: not pressed) setIO(0xC063, 0); // inverted (bit 7: not pressed)
print("shift key is pressed") // print("shift key is pressed")
case [.control]: // case [.control]:
print("control key is pressed") // print("control key is pressed")
case [.option] : case [.option] :
setIO(0xC061, 1 << 7); setIO(0xC061, 1 << 7);
setIO(0xC062, 0); setIO(0xC062, 0);
setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed) setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed)
print("option key is pressed") // print("option key is pressed")
case [.command]: case [.command]:
print("Command key is pressed") // print("Command key is pressed")
setIO(0xC061, 0); setIO(0xC061, 0);
setIO(0xC062, 1 << 7); setIO(0xC062, 1 << 7);
setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed) setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed)
case [.control, .shift]: // case [.control, .shift]:
print("control-shift keys are pressed") // print("control-shift keys are pressed")
case [.option, .shift]: case [.option, .shift]:
setIO(0xC061, 1 << 7); setIO(0xC061, 1 << 7);
setIO(0xC062, 0); setIO(0xC062, 0);
setIO(0xC063, 0); // inverted (bit 7: not pressed) setIO(0xC063, 0); // inverted (bit 7: not pressed)
print("option-shift keys are pressed") // print("option-shift keys are pressed")
case [.command, .shift]: case [.command, .shift]:
setIO(0xC061, 0); setIO(0xC061, 0);
setIO(0xC062, 1 << 7); setIO(0xC062, 1 << 7);
setIO(0xC063, 0); // inverted (bit 7: not pressed) setIO(0xC063, 0); // inverted (bit 7: not pressed)
print("command-shift keys are pressed") // print("command-shift keys are pressed")
case [.control, .option]: // case [.control, .option]:
print("control-option keys are pressed") // print("control-option keys are pressed")
case [.control, .command]: // case [.control, .command]:
print("control-command keys are pressed") // print("control-command keys are pressed")
case [.option, .command]: case [.option, .command]:
setIO(0xC061, 1 << 7); setIO(0xC061, 1 << 7);
setIO(0xC062, 1 << 7); setIO(0xC062, 1 << 7);
setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed) setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed)
print("option-command keys are pressed") // print("option-command keys are pressed")
case [.shift, .control, .option]: // case [.shift, .control, .option]:
print("shift-control-option keys are pressed") // print("shift-control-option keys are pressed")
case [.shift, .control, .command]: // case [.shift, .control, .command]:
print("shift-control-command keys are pressed") // print("shift-control-command keys are pressed")
case [.control, .option, .command]: // case [.control, .option, .command]:
print("control-option-command keys are pressed") // print("control-option-command keys are pressed")
case [.shift, .command, .option]: case [.shift, .command, .option]:
setIO(0xC061, 1 << 7); setIO(0xC061, 1 << 7);
setIO(0xC062, 1 << 7); setIO(0xC062, 1 << 7);
setIO(0xC063, 0); // inverted (bit 7: not pressed) setIO(0xC063, 0); // inverted (bit 7: not pressed)
print("shift-command-option keys are pressed") // print("shift-command-option keys are pressed")
case [.shift, .control, .option, .command]: // case [.shift, .control, .option, .command]:
print("shift-control-option-command keys are pressed") // print("shift-control-option-command keys are pressed")
case [.function]: // case [.function]:
print("function key is pressed") // print("function key is pressed")
case [.capsLock]: // case [.capsLock]:
print("capsLock key is pressed") // print("capsLock key is pressed")
default: default:
setIO(0xC061, 0); setIO(0xC061, 0);
setIO(0xC062, 0); setIO(0xC062, 0);
setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed) setIO(0xC063, 1 << 7); // inverted (bit 7: not pressed)
print("no modifier keys are pressed") // print("no modifier keys are pressed")
} }
} }