Clear text area or graphics area

Discussions related to graphics (2D and 3D), animation and games programming
Ivan
Posts: 33
Joined: Tue 07 May 2019, 16:47

Clear text area or graphics area

Post by Ivan »

Is it possible to clear only text area or clear only graphics area?

REM graphics_window
VDU 24,0,0,1847,1400

REM text_window
VDU 28,0,5,80,0

PRINT TAB(0,0)"CLS test"

MOVE 50,50
DRAW 1200,50
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. Project for the last three month: 3D-drawing program (currently 950 lines).

KenDown
Posts: 137
Joined: Wed 04 Apr 2018, 06:36

Re: Clear text area or graphics area

Post by KenDown »

Yes.

Code: Select all

      VDU28,10,40,36,4
      COLOUR133
      CLS

      VDU24,100;300;800;700;
      GCOL0,132
      CLG

RichardRussell
Posts: 232
Joined: Tue 15 Oct 2019, 09:10

Re: Clear text area or graphics area

Post by RichardRussell »

Ivan wrote:
Wed 11 Mar 2020, 19:47
Is it possible to clear only text area or clear only graphics area?
CLS (VDU 12) and CLG (VDU 16) respectively, or am I misunderstanding?
If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

Ivan
Posts: 33
Joined: Tue 07 May 2019, 16:47

Re: Clear text area or graphics area

Post by Ivan »

Sorry for not writing correct grammar but will text below be understandable:

If I use VDU 12 or VDU 16 or CLS or CLG all the screen area is erased.

I'm only trying to erase text area or graphics area - not both.

REM graphics_window
VDU 24,0,0,1847,1400

REM text_window
VDU 28,0,5,80,0

PRINT TAB(0,0)"CLS test"

MOVE 50,50
DRAW 1200,50

IF condition_what_ever THEN
CLS or VDU 12 REM clear only text window
ELSE
CLG or VDU 16 REM clear only graphics window
ENDIF
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. Project for the last three month: 3D-drawing program (currently 950 lines).

RichardRussell
Posts: 232
Joined: Tue 15 Oct 2019, 09:10

Re: Clear text area or graphics area

Post by RichardRussell »

Ivan wrote:
Thu 12 Mar 2020, 08:07
If I use VDU 12 or VDU 16 or CLS or CLG all the screen area is erased.
By default, yes, but after you define a text viewport with VDU 28... CLS clears only that area:

Code: Select all

      MODE 8
      VDU 28,0,5,79,0
      COLOUR 128+1
      CLS
and after you define a graphics viewport with VDU 24... CLG clears only that area:

Code: Select all

      MODE 8
      VDU 24,0;0;1278;800;
      GCOL 128+4
      CLG
You need to be careful with the parameters when you set the viewports because if they are out-of-range the command may be ignored.
If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

Ivan
Posts: 33
Joined: Tue 07 May 2019, 16:47

Re: Clear text area or graphics area

Post by Ivan »

I think I'm not clear in my writing. I'm trying to have both types of areas on screen at the same time. I attach a drawing.


text_and_graphics_on_same_screen.jpg
text_and_graphics_on_same_screen.jpg (11.27 KiB) Viewed 214 times
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. Project for the last three month: 3D-drawing program (currently 950 lines).

RichardRussell
Posts: 232
Joined: Tue 15 Oct 2019, 09:10

Re: Clear text area or graphics area

Post by RichardRussell »

Ivan wrote:
Thu 12 Mar 2020, 10:15
I'm trying to have both types of areas on screen at the same time.
Yes, you were perfectly clear. My first code snippet defines a text viewport occupying the top 6 lines (rows) and the second snippet defines a graphics viewport occupying the bottom 800 graphics units. If you combine the two snippets into one program you get exactly what you describe, thus:

Code: Select all

      MODE 8

      VDU 28,0,5,79,0
      VDU 24,0;0;1278;800;

      COLOUR 128+1
      GCOL 128+4

      CLS
      CLG
This is what it produces (red is the text viewport, blue is the graphics viewport):

viewports.png
viewports.png (2.44 KiB) Viewed 203 times
If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

Ivan
Posts: 33
Joined: Tue 07 May 2019, 16:47

Re: Clear text area or graphics area

Post by Ivan »

Exactly what I wanted to achieve.

Thanks.
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. Project for the last three month: 3D-drawing program (currently 950 lines).