mirror of
https://github.com/irmen/ksim65.git
synced 2025-01-23 12:29:54 +00:00
keyboard input
This commit is contained in:
parent
448d74baac
commit
ba8946c29c
@ -59,7 +59,7 @@ tasks.named<Test>("test") {
|
||||
maxParallelForks = max(1, Runtime.getRuntime().availableProcessors() / 2)
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>() {
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
|
@ -3,13 +3,14 @@ package razorvine.examplemachine
|
||||
import razorvine.ksim65.Cpu6502
|
||||
import java.awt.*
|
||||
import java.awt.image.BufferedImage
|
||||
import java.util.ArrayDeque
|
||||
import javax.imageio.ImageIO
|
||||
import javax.swing.event.MouseInputListener
|
||||
import razorvine.ksim65.IHostInterface
|
||||
import razorvine.ksim65.components.MemoryComponent
|
||||
import java.awt.event.*
|
||||
import java.util.*
|
||||
import javax.swing.*
|
||||
import javax.swing.Timer
|
||||
|
||||
|
||||
/**
|
||||
@ -324,6 +325,7 @@ class MainWindow(title: String) : JFrame(title), KeyListener, MouseInputListener
|
||||
pack()
|
||||
requestFocusInWindow()
|
||||
setLocationRelativeTo(null)
|
||||
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, mutableSetOf())
|
||||
isVisible = true
|
||||
}
|
||||
|
||||
@ -343,8 +345,6 @@ class MainWindow(title: String) : JFrame(title), KeyListener, MouseInputListener
|
||||
|
||||
// keyboard events:
|
||||
override fun keyTyped(event: KeyEvent) {
|
||||
println(event)
|
||||
println("[${event.keyChar}]")
|
||||
keyboardBuffer.add(event.keyChar)
|
||||
while (keyboardBuffer.size > 8)
|
||||
keyboardBuffer.pop()
|
||||
|
@ -41,7 +41,7 @@ start
|
||||
jmp +
|
||||
|
||||
_title1 .text "**** COMMODORE 64 BASIC V2 ****", 10, 10, " 64K RAM SYSTEM 38911 BASIC BYTES FREE", 10, 10, "READY.",10,0
|
||||
_text2 .text 10,"Nah, only joking, this is not a weird C-64.",10,"This is a working fantasy virtual 8-bit 6502 machine though!",10
|
||||
_text2 .text 10,"Nah, only joking, this is not a weird C-64.",10,"This is a working fantasy 8-bit 6502 machine though!",10
|
||||
.text "Type some stuff on the keyboard, use the mouse (with Left button/Right button)", 10, "to draw/erase pixels.",10,10,0
|
||||
_text3 .text "Mouse drawing and keyboard scanning: done in main program loop.",10
|
||||
.text "Time displayed at the bottom of the screen: done in timer IRQ.",10,10,0
|
||||
@ -56,7 +56,11 @@ _text3 .text "Mouse drawing and keyboard scanning: done in main program loop.",1
|
||||
|
||||
;--------- draw with mouse
|
||||
mousedraw
|
||||
sta MOUSE+5 ; sample position and buttons
|
||||
lda KEYBOARD
|
||||
beq + ; no key
|
||||
sta DISPLAY+$a
|
||||
|
||||
+ sta MOUSE+5 ; sample position and buttons
|
||||
lda MOUSE+0
|
||||
sta DISPLAY+3
|
||||
lda MOUSE+1
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user