QB64pe icon indicating copy to clipboard operation
QB64pe copied to clipboard

VIEW and WINDOW do not work together.

Open oitofelix opened this issue 1 year ago • 1 comments

Describe the bug Drawing statements don't work properly when both VIEW and WINDOW are active.

To Reproduce Run the folowing program.

SCREEN 7: _FULLSCREEN

WINDOW (-1, 1)-(1, -1)
WXMin = -.5: WYMin = -.5
WXMax = .5: WYMax = .5
VXMin = PMAP(WXMin, 0): VYMin = PMAP(WYMin, 1)
VXMax = PMAP(WXMax, 0): VYMax = PMAP(WYMax, 1)

PRINT "No WINDOW nor VIEW active."
PRINT "This work as expected."
VIEW SCREEN(VXMin, VYMin)-(VXMax, VYMax), , 4
VIEW
WINDOW
LINE (VXMin, VYMin)-(VXMax, VYMax)
SLEEP

CLS
PRINT "Only WINDOW active."
PRINT "This work as expected."
WINDOW (-1, 1)-(1, -1)
VIEW SCREEN(VXMin, VYMin)-(VXMax, VYMax), , 4
VIEW
LINE (WXMin, WYMin)-(WXMax, WYMax)
SLEEP

CLS 0
PRINT "Only VIEW active."
PRINT "This work as expected."
WINDOW
VIEW SCREEN(VXMin, VYMin)-(VXMax, VYMax), , 4
LINE (VXMin, VYMin)-(VXMax, VYMax)
SLEEP

CLS 0
PRINT "Both WINDOW and VIEW active."
PRINT "Bug!  This does not work as expected."
WINDOW (-1, 1)-(1, -1)
VIEW SCREEN(VXMin, VYMin)-(VXMax, VYMax), , 4
LINE (WXMin, WYMin)-(WXMax, WYMax)

Expected behavior The drawing behavior must be the same for equivalent drawing statements, regardless of WINDOW and VIEW effects.

Screenshots image image image image

Desktop (please complete the following information):

  • QB64PE 3.14.1
  • OS: Debian GNU/Linux

oitofelix avatar Sep 24 '24 18:09 oitofelix

Just want to share that to work around this bug, I use PMAP to get the VIEWport coordinates from the WINDOW coordinates for the drawing at hand, then reset the WINDOW coordinates (as to let only VIEW active), then do the drawing using those physical coordinates obtained in the aforementioned step, and then restore the previous WINDOW coordinates.

oitofelix avatar Oct 07 '24 03:10 oitofelix