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 ldx #$FF
txs txs
jsr PaintMain ; create all WeeGUI views (UI elements) and paint them jsr PaintMain ; create all WeeGUI views (UI elements) and paint them
bit $C010 ; clear keyboard strobe jsr ClearPendingInput
ldx #WGClearPendingClick ; clear WeeGUI mouse strobe
jsr WeeGUI
.mainRunLoop .mainRunLoop
jsr RepaintMainIfDirty jsr RepaintMainIfDirty
ldx #WGPendingViewAction ldx #WGPendingViewAction
jsr WeeGUI ; handle mouse movement and clicks jsr WeeGUI ; handle mouse movement and clicks
lda $C000 lda $C000
bpl .mainRunLoop bpl .mainRunLoop
bit $C010 jsr ClearPendingInput
jsr HandleKey ; handle keypresses jsr HandleKey ; handle keypresses
bra .mainRunLoop bra .mainRunLoop

View File

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

View File

@ -6,6 +6,7 @@
; Public functions ; Public functions
; - HardResetWeeGUI ; - HardResetWeeGUI
; - ExitWeeGUI ; - ExitWeeGUI
; - ClearPendingInput
; - CreateRadio ; - CreateRadio
; - CreateCheckbox ; - CreateCheckbox
; - CreateButton ; - CreateButton
@ -71,6 +72,21 @@ ExitWeeGUI
jmp WeeGUI 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 ; CreateRadio/CreateCheckbox/CreateButton
; creates a WeeGUI UI control with the 'raw title' option set ; creates a WeeGUI UI control with the 'raw title' option set

View File

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

View File

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