• Print

Author Topic: "cls 1" clears down the graphics view port an the the text view port .  (Read 217 times)

funkheld

  • Full Member
  • ***
  • Posts: 229
    • Email
"cls 1" clears down the graphics view port an the the text view port .
« on: July 04, 2011, 10:37:39 AM »
"cls 1 "not funktion  : 1 - Clears only the graphics view port. Has no effect for text mode.

"cls 1"  clears down the graphics view port an the the text view port  ???

Code: [Select]
dim scr as long
scr= _newimage(640,480,32)
screen scr

VIEW PRINT 20 TO 25
VIEW (0,0)-(639,400)

rot& = _RGB(255, 0, 0)
rot_l$ = "c=" + VARPTR$(rot&)

gosub lin_rech
do
_limit 30
a$ = INKEY$

  IF _KEYDOWN(ASC("q")) THEN
angle= angle+5
gosub lin_rech
end if
IF _KEYDOWN(ASC("e")) THEN
angle= angle-5
gosub lin_rech
end if
loop

lin_rech:
  cls 1
  Preset (320,150)
  DRAW "TA=" + VARPTR$(angle) + rot_l$+"U100"
  print "x: " ; point(0);
  print "  y: " ; point(1)
return

Clippy

  • Hero Member
  • *****
  • Posts: 16431
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: "cls 1" clears down the graphics view port an the the text view port .
« Reply #1 on: July 04, 2011, 11:41:49 AM »
CLS 1 is INDEED clearing the text as well. CLS 2 clears the text only. I changed code to run in Qbasic:

Code: [Select]
SCREEN 12

VIEW PRINT 20 TO 25
VIEW (0, 0)-(639, 400)

GOSUB linrech
DO
  a$ = LCASE$(INKEY$)
  IF a$ = "q" THEN 'AND angle <= 355 THEN
    angle = angle + 5
    GOSUB linrech
  END IF
  IF a$ = "e" THEN ' AND angle >= 5 THEN
    angle = angle - 5
    GOSUB linrech
  END IF
LOOP UNTIL a$ = CHR$(27)

END 'must use or RETURN W/O GOSUB error!

linrech:
CLS 1
PSET (320, 150), 12
DRAW "TA" + STR$(angle) + "U100"
PRINT "x: "; POINT(0); "  y: "; POINT(1); angle; CSRLIN
RETURN

I also found that QB64 allows TA to exceed - 360 and + 360 which Qbasic does not!

I shall report these errors.

Ted
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

funkheld

  • Full Member
  • ***
  • Posts: 229
    • Email
Re: "cls 1" clears down the graphics view port an the the text view port .
« Reply #2 on: July 04, 2011, 12:50:58 PM »
hmmmm.....,  ???

    * method% specifies which parts of the page to clear, and can have one of the following values:
          o 0 or no method - Clears the entire page. The print cursor is moved to the top row of the text view port at column 1.
          o 1 - Clears only the graphics view port. Has no effect for text mode. !!!!!!!!!!!!!!!!!!!!!!!
          o 2 - Clears only the text view port. The print cursor is moved to the top row of the text view port at column 1.
    * The BGcolor& specifies the color attribute or palette index to use when clearing the screen in QB64 only.
          o In legacy SCREEN modes BGcolor& specifies the color attribute of the background.
          o For 32-bit graphics mode, BGcolor& specifies the _RGB or _RGBA color to use.
          o NOTE: Default 32 bit backgrounds are clear black or _RGBA(0, 0, 0, 0)! Use CLS to make the black opaque!
          o If not specified, BGcolor& is assumed to be the current background color. 32 bit backgrounds will change to opaque!
          o If BGColor& is not a valid attribute, an illegal function call error will occur!
    * Use _PRINTMODE to allow the background colors to be visible through the text or the text background.


http://qb64.net/wiki/index.php?title=CLS
« Last Edit: July 04, 2011, 01:04:13 PM by funkheld »

funkheld

  • Full Member
  • ***
  • Posts: 229
    • Email
Re: "cls 1" clears down the graphics view port an the the text view port .
« Reply #3 on: July 04, 2011, 12:56:53 PM »
no SCREEN 12, i make in the screen _newimage(....)
it is qb64 and not qbasic .

gruss

Clippy

  • Hero Member
  • *****
  • Posts: 16431
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: "cls 1" clears down the graphics view port an the the text view port .
« Reply #4 on: July 04, 2011, 12:59:43 PM »
I ran it in Qbasic to see how it worked.

Qbasic doesn't allow VARPTR$ to return less than -360 or more than 360 using TA also.

I reported BOTH issues.

Ted
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

funkheld

  • Full Member
  • ***
  • Posts: 229
    • Email
Re: "cls 1" clears down the graphics view port an the the text view port .
« Reply #5 on: July 04, 2011, 01:05:54 PM »
ok, thanks.

I do not know qbasic.

  • Print