refactor out ClearPendingInput and use before and after all run loops

This commit is contained in:
4am 2018-04-17 16:16:45 -04:00
parent 0fb0761010
commit e82bbdf78a
5 changed files with 24 additions and 16 deletions

View File

@ -64,16 +64,14 @@ MainScreen
ldx #$FF
txs
jsr PaintMain ; create all WeeGUI views (UI elements) and paint them
bit $C010 ; clear keyboard strobe
ldx #WGClearPendingClick ; clear WeeGUI mouse strobe
jsr WeeGUI
jsr ClearPendingInput
.mainRunLoop
jsr RepaintMainIfDirty
ldx #WGPendingViewAction
jsr WeeGUI ; handle mouse movement and clicks
lda $C000
bpl .mainRunLoop
bit $C010
jsr ClearPendingInput
jsr HandleKey ; handle keypresses
bra .mainRunLoop

View File

@ -51,9 +51,7 @@ DisplayArtwork
sta $C054
sta $C050
bit $C010 ; clear keyboard strobe
ldx #WGClearPendingClick ; clear WeeGUI mouse strobe
jsr WeeGUI
jsr ClearPendingInput
.runLoop
ldx #WGPendingClick
jsr WeeGUI
@ -62,7 +60,7 @@ DisplayArtwork
lda $C000
bpl .runLoop
+ sta $C051 ; back to text
rts
jmp ClearPendingInput
.error
jmp SoftBell
}

View File

@ -6,6 +6,7 @@
; Public functions
; - HardResetWeeGUI
; - ExitWeeGUI
; - ClearPendingInput
; - CreateRadio
; - CreateCheckbox
; - CreateButton
@ -71,6 +72,21 @@ ExitWeeGUI
jmp WeeGUI
}
;------------------------------------------------------------------------------
; ClearPendingInput
; clears keyboard strobe and WeeGUI mouse click queue
;
; in: WeeGUI initialized
; out: A,Y preserved
; X clobbered
;------------------------------------------------------------------------------
!zone {
ClearPendingInput
bit $C010 ; clear keyboard strobe
ldx #WGClearPendingClick ; clear WeeGUI mouse strobe
jmp WeeGUI
}
;------------------------------------------------------------------------------
; CreateRadio/CreateCheckbox/CreateButton
; creates a WeeGUI UI control with the 'raw title' option set

View File

@ -104,15 +104,13 @@ OptionsDialog
!byte 6,18
!word kStringAutoScriptDescription
bit $C010 ; clear keyboard strobe
ldx #WGClearPendingClick ; clear WeeGUI mouse strobe
jsr WeeGUI
jsr ClearPendingInput
.runLoop
ldx #WGPendingViewAction
jsr WeeGUI ; handle mouse movement and clicks
lda $C000
bpl .runLoop
bit $C010
jsr ClearPendingInput
jsr HandleOptionsKey ; handle keypresses
bra .runLoop

View File

@ -162,15 +162,13 @@ iNumVersions=*+1
!word gVersionsStore
!word PrintVersionLabelCallback
bit $C010 ; clear keyboard strobe
ldx #WGClearPendingClick ; clear WeeGUI mouse strobe
jsr WeeGUI
jsr ClearPendingInput
.runLoop
ldx #WGPendingViewAction
jsr WeeGUI ; handle mouse movement and clicks
lda $C000
bpl .runLoop
bit $C010
jsr ClearPendingInput
jsr HandleVersionsKey ; handle keypresses
bra .runLoop