mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2025-01-09 21:31:53 +00:00
- Added delta X/Y scrolling
- Fixed WGPrint doing the wrong thing when entire string is below the clip box - Fixed WGPrint missing end of string if it lands exactly on logical view boundary
This commit is contained in:
parent
ae3f4f491e
commit
5dc871c64e
82
gui.s
82
gui.s
@ -75,6 +75,7 @@ main:
|
||||
jsr WGViewSetTitle
|
||||
|
||||
jsr WGViewPaintAll
|
||||
jsr testPaintContents
|
||||
|
||||
; ldx #5
|
||||
; ldy #0
|
||||
@ -153,6 +154,14 @@ keyLoop:
|
||||
beq keyLoop_toggle
|
||||
cmp #'o'
|
||||
beq keyLoop_focusOkay
|
||||
cmp #8
|
||||
beq keyLoop_leftArrow
|
||||
cmp #21
|
||||
beq keyLoop_rightArrow
|
||||
cmp #11
|
||||
beq keyLoop_upArrow
|
||||
cmp #10
|
||||
beq keyLoop_downArrow
|
||||
|
||||
jmp keyLoop
|
||||
|
||||
@ -168,6 +177,30 @@ keyLoop_toggle:
|
||||
jsr WGViewFocusAction
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_leftArrow:
|
||||
lda #1
|
||||
jsr WGScrollXBy
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_rightArrow:
|
||||
lda #-1
|
||||
jsr WGScrollXBy
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_upArrow:
|
||||
lda #1
|
||||
jsr WGScrollYBy
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_downArrow:
|
||||
lda #-1
|
||||
jsr WGScrollYBy
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_focusOkay:
|
||||
lda #2
|
||||
jsr WGSelectView
|
||||
@ -176,6 +209,50 @@ keyLoop_focusOkay:
|
||||
|
||||
rts ; This seems to work for returning to BASIC.SYSTEM, but I don't think it's right
|
||||
|
||||
testPaintContents:
|
||||
SAVE_AXY
|
||||
|
||||
lda #0
|
||||
jsr WGSelectView
|
||||
jsr WGEraseViewContents
|
||||
|
||||
|
||||
;;
|
||||
ldx #0
|
||||
ldy #4
|
||||
jsr WGSetCursor
|
||||
lda #<testStr
|
||||
sta PARAM0
|
||||
lda #>testStr
|
||||
sta PARAM1
|
||||
jsr WGPrint
|
||||
bra testPaintContents_done
|
||||
;;
|
||||
|
||||
|
||||
ldy #0
|
||||
testPaintContents_loop:
|
||||
ldx #0
|
||||
jsr WGSetCursor
|
||||
|
||||
tya
|
||||
clc
|
||||
adc #'A'
|
||||
sta testStr3
|
||||
|
||||
lda #<testStr3
|
||||
sta PARAM0
|
||||
lda #>testStr3
|
||||
sta PARAM1
|
||||
jsr WGPrint
|
||||
|
||||
iny
|
||||
cpy #25
|
||||
bne testPaintContents_loop
|
||||
|
||||
testPaintContents_done:
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
testCallback:
|
||||
jsr $ff3a
|
||||
@ -243,7 +320,7 @@ read80ColSwitch_40:
|
||||
|
||||
|
||||
testView:
|
||||
.byte "1007033e133e7e" ; 1:0, 7,3,62,19,62,126
|
||||
.byte "1007033e125019" ; 1:0, 7,3,62,18,80,25
|
||||
|
||||
testCheck:
|
||||
.byte "011004"
|
||||
@ -259,6 +336,9 @@ testStr:
|
||||
.byte "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ !",34,"#$%&'()*+,-./0123456789:;<=>?`abcdefghijklmno",0
|
||||
testStr2:
|
||||
.byte "pqrstuvwxyz{|}~",$ff,0
|
||||
testStr3:
|
||||
.byte "x",0
|
||||
|
||||
testTitle0:
|
||||
.byte "Nifty Window",0
|
||||
testTitle1:
|
||||
|
BIN
guidemo.dsk
BIN
guidemo.dsk
Binary file not shown.
1
memory.s
1
memory.s
@ -51,6 +51,7 @@ WG_VIEWCLIP:
|
||||
.byte 0,0,0,0,0
|
||||
|
||||
WG_VIEWRECORDS:
|
||||
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||
; X, Y, Screen Width, Screen Height, Style, X Offset, Y Offset, View Width, View Height, State, CallbackH, CallbackL, TitleH, TitleL
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
@ -138,6 +138,10 @@ WGPrint:
|
||||
SAVE_AXY
|
||||
SAVE_ZPS
|
||||
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+3
|
||||
bcs WGPrint_leapDone ; Entire string is below the clip box
|
||||
|
||||
jsr WGStrLen ; We'll need the length of the string
|
||||
sta SCRATCH1
|
||||
|
||||
@ -172,6 +176,9 @@ WGPrint_lineLoopFirst: ; Calculating start of first line is slightly different
|
||||
sta WG_LOCALCURSORX
|
||||
bra WGPrint_visibleChars
|
||||
|
||||
WGPrint_leapDone:
|
||||
bra WGPrint_done
|
||||
|
||||
WGPrint_skipToEndFirst:
|
||||
lda WG_SCRATCHA ; Skip string index ahead by distance to EOL
|
||||
sec
|
||||
@ -255,6 +262,8 @@ WGPrint_nextLine:
|
||||
beq WGPrint_done
|
||||
cmp WG_VIEWRECORDS,x ; Check for bottom of view
|
||||
beq WGPrint_done
|
||||
lda (PARAM0),y ; Check for end string landing exactly at line end
|
||||
beq WGPrint_done
|
||||
|
||||
lda #0 ; Wrap to next line
|
||||
sta WG_LOCALCURSORX
|
||||
|
112
views.s
112
views.s
@ -814,6 +814,62 @@ WGScrollX_done:
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGScrollXBy
|
||||
; Scrolls the current view horizontally by a delta
|
||||
; A: Scroll delta
|
||||
; Side effects: Clobbers A
|
||||
;
|
||||
WGScrollXBy:
|
||||
phy
|
||||
phx
|
||||
tax
|
||||
|
||||
SAVE_ZPS
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
txa
|
||||
bpl WGScrollXBy_contentRight
|
||||
|
||||
lda WG_VIEWRECORDS+2,y ; Compute left limit
|
||||
sec
|
||||
sbc WG_VIEWRECORDS+7,y
|
||||
sta SCRATCH0
|
||||
|
||||
txa ; Compute new scroll value
|
||||
clc
|
||||
adc WG_VIEWRECORDS+5,y
|
||||
cmp SCRATCH0 ; Clamp if needed
|
||||
bmi WGScrollXBy_clampLeft
|
||||
sta WG_VIEWRECORDS+5,y
|
||||
bra WGScrollXBy_done
|
||||
|
||||
WGScrollXBy_clampLeft:
|
||||
lda SCRATCH0
|
||||
sta WG_VIEWRECORDS+5,y
|
||||
bra WGScrollXBy_done
|
||||
|
||||
WGScrollXBy_contentRight:
|
||||
clc ; Compute new scroll value
|
||||
adc WG_VIEWRECORDS+5,y
|
||||
cmp #0 ; Clamp if needed
|
||||
beq @0
|
||||
bpl WGScrollXBy_clampRight
|
||||
@0: sta WG_VIEWRECORDS+5,y
|
||||
bra WGScrollXBy_done
|
||||
|
||||
WGScrollXBy_clampRight:
|
||||
lda #0
|
||||
sta WG_VIEWRECORDS+5,y
|
||||
|
||||
WGScrollXBy_done:
|
||||
RESTORE_ZPS
|
||||
plx
|
||||
ply
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGScrollY
|
||||
; Scrolls the current view vertically
|
||||
@ -841,6 +897,62 @@ WGScrollY_done:
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGScrollYBy
|
||||
; Scrolls the current view horizontally by a delta
|
||||
; A: Scroll delta
|
||||
; Side effects: Clobbers A
|
||||
;
|
||||
WGScrollYBy:
|
||||
phy
|
||||
phx
|
||||
tax
|
||||
|
||||
SAVE_ZPS
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
txa
|
||||
bpl WGScrollYBy_contentDown
|
||||
|
||||
lda WG_VIEWRECORDS+3,y ; Compute bottom limit
|
||||
sec
|
||||
sbc WG_VIEWRECORDS+8,y
|
||||
sta SCRATCH0
|
||||
|
||||
txa ; Compute new scroll value
|
||||
clc
|
||||
adc WG_VIEWRECORDS+6,y
|
||||
cmp SCRATCH0 ; Clamp if needed
|
||||
bmi WGScrollYBy_clampTop
|
||||
sta WG_VIEWRECORDS+6,y
|
||||
bra WGScrollYBy_done
|
||||
|
||||
WGScrollYBy_clampTop:
|
||||
lda SCRATCH0
|
||||
sta WG_VIEWRECORDS+6,y
|
||||
bra WGScrollYBy_done
|
||||
|
||||
WGScrollYBy_contentDown:
|
||||
clc ; Compute new scroll value
|
||||
adc WG_VIEWRECORDS+6,y
|
||||
cmp #0 ; Clamp if needed
|
||||
beq @0
|
||||
bpl WGScrollYBy_clampBottom
|
||||
@0: sta WG_VIEWRECORDS+6,y
|
||||
bra WGScrollYBy_done
|
||||
|
||||
WGScrollYBy_clampBottom:
|
||||
lda #0
|
||||
sta WG_VIEWRECORDS+6,y
|
||||
|
||||
WGScrollYBy_done:
|
||||
RESTORE_ZPS
|
||||
plx
|
||||
ply
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGViewPaintAll
|
||||
; Repaints all views
|
||||
|
Loading…
x
Reference in New Issue
Block a user