Teletext paint program

bbc micro/electron/atom/risc os coding queries and routines
User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Mon Aug 10, 2020 9:45 pm

Small update, have rejigged the E function as a toggle to work with "PD2" draw and dither. If E is on (green) the using PD2 will erase, and if E is off (white) then PD2 will draw normal. Have a play and let me know what you think.

I started adding in a file load box, should be able to click load and get a list of picture files to load, might even be able to scroll through the files even on an ipad with the scroll gesture... just playing with this for now.

Good to see you can actually use it on the go =D>

Code: Select all

      MODE 7

      MOUSE ON 0

      REM drawing bounds used for < and >
      xMin%=1
      xMax%=80
      yMin%=2
      yMax%=75


      REM fill bounds & BUFFER used with < and >
      fxMin%=2
      fxMax%=80
      fyMin%=3
      fyMax%=74
      DIM fill{(100) x%,y%}

      REM UNDO TEST ARRAY
      UNDO_MAX%=19
      DIM UNDO_BUFFER(UNDO_MAX%,959)
      UNDO_INDEX%=0

      REM OLD PIXEL & MOUSE COORDS
      OLD_PX%=0
      OLD_PY%=0
      OLD_MX%=0
      OLD_MY%=0

      REM MOUSE COORDS
      MX%=0
      MY%=0
      MB%=0

      REM TEXT & PIXEL COORDS FOR CURRENT MOUSE READ LOCATION
      TX%=0
      TY%=0
      PX%=0
      PY%=0

      REM TOOL VARS
      curcol%=7
      backcol%=7
      toolsel%=1
      toolcursor%=15
      erase%=0
      dither%=0

      PROCGR
      PROCdrawmenu

      REPEAT

        PROCREADMOUSE

        IF MX%<>OLD_MX% OR MY%<>OLD_MY% OR MB% THEN
          IF TY%=0 THEN
            REM CLICK INSIDE MENU AREA
            IF MB%=4 THEN
              CASE TX% OF
                WHEN 1: curcol%=1
                WHEN 3: curcol%=2
                WHEN 5: curcol%=3
                WHEN 7: curcol%=4
                WHEN 9: curcol%=5
                WHEN 11: curcol%=6
                WHEN 13: curcol%=7

                WHEN 15: toolsel%=1:toolcursor%=TX%: REM PAINT
                WHEN 16: toolsel%=2:toolcursor%=TX%: REM DITHER
                WHEN 17: dither%=(dither%+1) MOD 4: REM DITHER SCALE

                WHEN 19: erase%=(erase%+1) AND 1: REM TOGLE ERASER

                WHEN 21: REM CLEARSCREEN
                  PROCundosave
                  PROCGR

                WHEN 22: toolsel%=51:toolcursor%=TX%: REM CLEARPAPERCOL
                WHEN 23: toolsel%=6:toolcursor%=TX%: REM PAPERCOL

                WHEN 25: toolsel%=7:toolcursor%=TX%: REM CIRCEL
                WHEN 26: toolsel%=8:toolcursor%=TX%: REM RECTANGLE
                WHEN 27: toolsel%=9:toolcursor%=TX%: REM LINE
                WHEN 28: toolsel%=10:toolcursor%=TX%: REM FILL

                WHEN 30: PROCloadfile: REM LOAD
                WHEN 31: PROCsavefile: REM SAVE

                WHEN 33: PROCundorestore: REM ERASE


              ENDCASE

              REM CHANGE BACKGROUND COLOUR, TEMPORARY CLUDGE
              IF TX%<14 THEN
                FOR Y%=1 TO 24
                  PRINTTAB(0,Y%) CHR$(144+curcol%);
                NEXT
              ENDIF

              PROCdrawmenu

              PROCWAITMOUSE(0)

            ENDIF

          ELSE
            REM CLICK INSIDE DRAWING AREA
            CASE MB% OF
              WHEN 1:
                REM PLACE HOLDER FOR RIGHT MOUSE

              WHEN 2:
                REM PLACE HOLDER FOR MIDDLE MOUSE

              WHEN 4:
                REM LEFT MOUSE CLICK OR TOUCH SCREEN CLICK
                CASE toolsel% OF
                  WHEN 1: REM PAINT TOOL
                    PROCundosave
                    PROCpoint(PX%,PY%,1)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<2 THEN PX%=2
                      IF PX%>79 THEN PX%=79
                      IF PY%<2 THEN PY%=2
                      IF PY%>74 THEN PY%=74
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN PROCpoint(PX%,PY%,1-erase%)
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                  WHEN 2: REM DITHER TOOL
                    PROCundosave
                    D%=2^(dither%)
                    DA%=2
                    IF dither%=2 THEN DA%=4
                    IF dither%=3 THEN DA%=8

                    X%=(PX% DIV DA%)*DA%
                    Y%=(PY% DIV DA%)*DA%
                    PROCpoint(X%,Y%,1-erase%)
                    PROCpoint(X%+D%,Y%+D%,1-erase%)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<2 THEN PX%=2
                      IF PX%>79 THEN PX%=79
                      IF PY%<2 THEN PY%=2
                      IF PY%>74 THEN PY%=74
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        X%=(PX% DIV DA%)*DA%
                        Y%=(PY% DIV DA%)*DA%
                        PROCpoint(X%,Y%,1-erase%)
                        PROCpoint(X%+D%,Y%+D%,1-erase%)
                      ENDIF
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                  WHEN 7: REM CIRCLE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    REM PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCcircle(startx%,starty%,startx%-OLD_PX%,2)
                        PROCcircle(startx%,starty%,startx%-PX%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCcircle(startx%,starty%,startx%-PX%,1)

                  WHEN 8: REM RECTANGLE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCrectangle(startx%,starty%,OLD_PX%,OLD_PY%,2)
                        PROCrectangle(startx%,starty%,PX%,PY%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCrectangle(startx%,starty%,PX%,PY%,1)

                  WHEN 9: REM LINE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCbresenham(startx%,starty%,OLD_PX%,OLD_PY%,2)
                        PROCbresenham(startx%,starty%,PX%,PY%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCbresenham(startx%,starty%,PX%,PY%,1)

                  WHEN 10: REM FILL TOOL
                    PROCundosave
                    PROCfloodfill(PX%,PY%)
                    REPEAT
                      PROCREADMOUSE
                      WAIT 2
                    UNTIL MB%=0

                  WHEN 12: REM ERASER TOOL
                    PROCundosave
                    PROCpoint(PX%,PY%,0)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<2 THEN PX%=2
                      IF PX%>79 THEN PX%=79
                      IF PY%<2 THEN PY%=2
                      IF PY%>74 THEN PY%=74
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN PROCpoint(PX%,PY%,0)
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                ENDCASE


            ENDCASE

          ENDIF

        ELSE
          WAIT 2
        ENDIF

        REM SHOW ALL MOUSE TRACKING DETAILS
        REM PRINTTAB(0,0)SPC(40)
        REM PRINTTAB(0,0)"MX:";STR$(MX%);" MY:";STR$(MY%);" TX:";STR$(TX%);" TY:";STR$(TY%);" PX:";STR$(PX%);" PY:";STR$(PY%)


        REM REMEMBER MOUSE POSITION
        OLD_MX%=MX%
        OLD_MY%=MY%

      UNTIL 0

      END

      REM READ MOUSE AND CALCULATE TEXT AND SIXEL LOCATIONS
      DEF PROCREADMOUSE

      MOUSE MX%,MY%,MB%

      REM TEXT LOCATION RELEATIVE TO MOUSE
      TX%=MX% DIV 32
      TY%=(999-MY%) DIV 40

      REM SIXEL LOCATION RELEATIVE TO MOUSE
      PX%=MX% DIV 16
      PY%=(999-MY%)/13.3333333

      VDU 31,toolcursor%,0
      ENDPROC

      REM WAIT FOR MOUSE TO BE A SPECIFIC BUTTON CLICK
      DEF PROCWAITMOUSE(M%)
      REPEAT
        PROCREADMOUSE
        WAIT 2
      UNTIL MB%=M%
      ENDPROC


      REM Read the point at the specified coordinates (1=set, 0=cleared)
      DEFFNpoint(x%,y%)
      LOCAL cx%,cy%,chr%,C%
      REM Get character cell
      cx% = x% DIV 2
      cy% = y% DIV 3
      chr%=GET(cx%,cy%) AND &5F
      C%=(x% AND 1)+(y% MOD 3)*2
      C%=2^C% - (C%=5)*32
      =SGN(chr% AND C%)

      REM Plot a Teletext sixel point
      REM SIXEL COORDINATES WITH 0,0 BEING TOP LEFT THE SAME AS THE TEXT SCREEN
      REM cmd% 0: Clear the point
      REM cmd% 1: Set the point
      REM cmd% 2: Toggle the point
      DEFPROCpoint(x%, y%, cmd%)

      IF x%>xMin% AND x%<xMax% AND y%>yMin% AND y%<yMax% THEN

        LOCAL cx%,cy%,chr%,C%
        REM Get character cell
        cx% = x% DIV 2
        cy% = y% DIV 3
        chr%=GET(cx%,cy%) AND &5F
        C%=(x% AND 1)+(y% MOD 3)*2
        C%=2^C% - (C%=5)*32
        CASE cmd% OF
          WHEN 0:chr% AND=(&5F - C%)
          WHEN 1:chr% OR=C%
          WHEN 2:chr% EOR=C%
        ENDCASE

        VDU 31,cx%, cy%,(chr%+160)
      ENDIF

      ENDPROC

      REM LINE ROUTINE USE m% TO PERFORM 0=ERASE / 1=DRAW / 2=EOR
      DEF PROCbresenham(x1%,y1%,x2%,y2%,m%)
      LOCAL dx%, dy%, sx%, sy%, e
      dx% = ABS(x2% - x1%) : sx% = SGN(x2% - x1%)
      dy% = ABS(y2% - y1%) : sy% = SGN(y2% - y1%)
      IF dx% > dy% e = dx% / 2 ELSE e = dy% / 2
      REPEAT
        PROCpoint(x1%,y1%,m%)
        IF x1% = x2% IF y1% = y2% EXIT REPEAT
        IF dx% > dy% THEN
          x1% += sx% : e -= dy% : IF e < 0 e += dx% : y1% += sy%
        ELSE
          y1% += sy% : e -= dx% : IF e < 0 e += dy% : x1% += sx%
        ENDIF
      UNTIL FALSE
      ENDPROC

      REM RECTANGLE ROUTINE
      DEF PROCrectangle(x1%,y1%,x2%,y2%,m%)

      REM CHECK FOR SPECIAL CASES TO PRESERVE EOR OPERATIONS
      IF x1%=x2% AND y1%=y2% THEN
        PROCpoint(x1%,y1%,m%)
      ELSE
        IF x1%=x2% OR y1%=y2% THEN
          PROCbresenham(x1%,y1%,x2%,y2%,m%)
        ELSE
          PROCbresenham(x1%,y1%,x2%,y1%,m%)
          PROCbresenham(x1%,y2%,x2%,y2%,m%)
          IF ABS(y2%-y1%)>1 THEN
            IF y1%>y2% THEN SWAP y1%,y2%
            FOR Y%=y1%+1 TO y2%-1
              PROCpoint(x1%,Y%,m%)
              PROCpoint(x2%,Y%,m%)
            NEXT
          ENDIF
        ENDIF
      ENDIF
      ENDPROC

      REM CIRCLE ROUTINE
      DEF PROCcircle(x1%,y1%,r%,m%)
      LOCAL p,x%,y%

      r%=ABS(r%)
      p=(5-r%*4)/4
      x%=0
      y%=r%

      PROCcirclepoints(x1%,y1%,x%,y%,m%)

      WHILE x%<y%
        x%+=1
        IF p<0 THEN
          p+=2*x%+1
        ELSE
          y%-=1
          p+=2*(x%-y%)+1
        ENDIF
        PROCcirclepoints(x1%,y1%,x%,y%,m%)
      ENDWHILE

      ENDPROC

      REM THIS PLOTS THE POINTS FOR CIRCLE ROUTINE
      DEF PROCcirclepoints(cx%,cy%,x%,y%,m%)
      IF x%=0 THEN
        PROCpoint(cx%,cy%+y%,m%)
        PROCpoint(cx%,cy%-y%,m%)
        PROCpoint(cx%+y%,cy%,m%)
        PROCpoint(cx%-y%,cy%,m%)
      ELSE
        IF x%<=y% THEN
          PROCpoint(cx%+x%,cy%+y%,m%)
          PROCpoint(cx%-x%,cy%+y%,m%)
          PROCpoint(cx%+x%,cy%-y%,m%)
          PROCpoint(cx%-x%,cy%-y%,m%)
          IF x%<y% THEN
            PROCpoint(cx%+y%,cy%+x%,m%)
            PROCpoint(cx%-y%,cy%+x%,m%)
            PROCpoint(cx%+y%,cy%-x%,m%)
            PROCpoint(cx%-y%,cy%-x%,m%)
          ENDIF
        ENDIF
      ENDIF
      ENDPROC

      REM ### flood fill from ART4BBW
      DEF PROCfloodfill(sx%,sy%)

      IF sx%>xMin% AND sx%<xMax% AND sy%>yMin% AND sy%<yMax% THEN

        LOCAL uf,df,c%,x%,y%,mc%
        uf=0
        df=0

        REM fill with mask colour first
        bCnt%=0
        PROCaddFill(sx%,sy%)

        REPEAT
          REM get next fill point
          bCnt%-=1
          x%=fill{(bCnt%)}.x%
          y%=fill{(bCnt%)}.y%
          IF FNpoint(x%,y%) = 0 THEN

            uf=1 : df=1

            REM scan left
            WHILE x%>fxMin% AND FNpoint(x%-1,y%) =0
              x%-=1
            ENDWHILE

            REM scan right
            WHILE x%<fxMax% AND FNpoint(x%,y%) = 0
              PROCpoint(x%,y%,1)

              REM detect colour changes above and add to list
              IF y%<fyMax% THEN
                c%=FNpoint(x%,y%+1)
                IF uf AND c%=0 THEN PROCaddFill(x%,y%+1) : uf=0
                IF c%=1 THEN uf=1
              ENDIF

              REM detect colour changes below and add to list
              IF y%>fyMin% THEN
                c%=FNpoint(x%,y%-1)
                IF df AND c%=0 THEN PROCaddFill(x%,y%-1) : df=0
                IF c%=1 THEN df=1
              ENDIF
              x%+=1
            ENDWHILE
          ENDIF

        UNTIL bCnt%=0
      ENDIF

      ENDPROC

      REM ### fill quasi stack
      DEF PROCaddFill(x%,y%)
      fill{(bCnt%)}.x%=x%
      fill{(bCnt%)}.y%=y%
      IF bCnt%<100 THEN bCnt%+=1
      ENDPROC

      REM SAVE UNDO SCREEN
      DEF PROCundosave
      LOCAL U%
      UNDO_INDEX%+=1
      IF UNDO_INDEX%>UNDO_MAX% THEN UNDO_INDEX%=0

      FOR U%=0 TO 959
        UNDO_BUFFER(UNDO_INDEX%,U%)=GET(U% MOD 40,U% DIV 40+1)
      NEXT

      ENDPROC

      REM SAVE UNDO SCREEN
      DEF PROCundorestore
      LOCAL U%

      FOR U%=0 TO 959
        VDU 31,(U% MOD 40),(U% DIV 40+1),UNDO_BUFFER(UNDO_INDEX%,U%)
      NEXT

      UNDO_INDEX%-=1
      IF UNDO_INDEX%<0 THEN UNDO_INDEX%=UNDO_MAX%

      ENDPROC

      REM LOADFILE
      DEF PROCloadfile
      PROCWAITMOUSE(0)
      PROCundosave
      PRINTTAB(7,6)CHR$(151);CHR$(232);STRING$(5,CHR$(172));CHR$(130);"LOAD FILE";CHR$(151);STRING$(6,CHR$(172));CHR$(180);CHR$(144+curcol%);
      FOR L%=7 TO 17
        PRINTTAB(7,L%)CHR$(151);CHR$(234);STRING$(21," ");CHR$(151);CHR$(181);CHR$(144+curcol%);
      NEXT
      PRINTTAB(7,18)CHR$(151);CHR$(170);STRING$(22,CHR$(172));CHR$(165);CHR$(144+curcol%);

      REM READ FILES
      PRINTTAB(10,7)CHR$(131);"..";
      PRINTTAB(10,8)CHR$(131);"PICTURE FOLDER 001";
      PRINTTAB(10,9)CHR$(131);"PICTURE 001";
      PRINTTAB(10,10)CHR$(131);"PICTURE 001";
      PRINTTAB(10,11)CHR$(131);"PICTURE 001";
      PRINTTAB(10,12)CHR$(131);"PICTURE 001";
      PRINTTAB(10,13)CHR$(131);"PICTURE 001";
      PRINTTAB(10,14)CHR$(131);"PICTURE 001";
      PRINTTAB(10,15)CHR$(131);"PICTURE 001";
      PRINTTAB(10,16)CHR$(131);"PICTURE 001";
      PRINTTAB(10,17)CHR$(131);"PICTURE 001";

      PROCWAITMOUSE(4)

      PROCWAITMOUSE(0)

      PROCundorestore
      ENDPROC

      REM SAVEFILE
      DEF PROCsavefile
      PROCWAITMOUSE(0)
      PROCundosave
      PRINTTAB(9,10)CHR$(151);CHR$(232);STRING$(18,CHR$(172));CHR$(180);CHR$(144+curcol%);
      FOR L%=11 TO 13
        PRINTTAB(9,L%)CHR$(151);CHR$(234);STRING$(17," ");CHR$(151);CHR$(181);CHR$(144+curcol%);
      NEXT
      PRINTTAB(9,14)CHR$(151);CHR$(170);STRING$(18,CHR$(172));CHR$(165);CHR$(144+curcol%);

      REM READ FILES
      PRINTTAB(13,12)CHR$(130);"FILE SAVED!";

      PROCWAITMOUSE(4)

      PROCWAITMOUSE(0)

      PROCundorestore

      ENDPROC

      REM INITIALISE THE SCREEN
      DEF PROCGR

      REM CLS
      VDU 12

      REM ADD GRAPHICS CODE TO LEFT SIDE OF CANVAS
      FOR Y%=1 TO 24
        PRINTTAB(0,Y%) CHR$(144+curcol%);
      NEXT

      ENDPROC

      REM PRINT PALETTE AND MENU
      DEF PROCdrawmenu
      FOR count%=1 TO 7
        PRINTTAB(count%*2-2,0) CHR$(128+count%);CHR$(255+(count%=curcol%)*213);
      NEXT count%
      PRINTTAB(14,0) CHR$(135);"PD"STR$(dither%+1);CHR$(135-erase%*5);"E";CHR$(135);"CKB ORLF LS U A<>PS"
      ENDPROC
Last edited by FourthStone on Mon Aug 10, 2020 11:28 pm, edited 3 times in total.

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Mon Aug 10, 2020 10:12 pm

He's on fire!
Thanks a lot. Sorry there were lots of please sir can I have some more :lol:
It's really great to be able to do teletext pictures on the ipad. Honestly it's a dream come true for me!

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Mon Aug 10, 2020 10:24 pm

That dithering is so cool!
I think it would be helpful if there could be more level of dithering a bit denser. Chess checkerboard style......sorry I've asked for another thing now but it would give 3 great varied shades......the trouble is the menus are kind of set aren't they........so I wonder....

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Mon Aug 10, 2020 10:37 pm

pixelblip wrote:
Mon Aug 10, 2020 10:24 pm
That dithering is so cool!
I think it would be helpful if there could be more level of dithering a bit denser. Chess checkerboard style......sorry I've asked for another thing now but it would give 3 great varied shades......the trouble is the menus are kind of set aren't they........so I wonder....
I fixed a bug in the x2 dither, and I've adjusted the D tool to be checker style :D

EDIT: Yes menu is quite full, we could think of ways to combine items or have a popup for somethings... like the load and save :D
Last edited by FourthStone on Mon Aug 10, 2020 10:39 pm, edited 1 time in total.

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Mon Aug 10, 2020 10:38 pm

Oh now you are just showing off! :lol:

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Mon Aug 10, 2020 10:38 pm

I will do some mode 2 pics this week as well fear ye not!

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Mon Aug 10, 2020 11:00 pm

Thinking about the dither tool, it could work something like this: "PD1" "PD2" "PD3" "PD4" Clicking the number next to "D" will increment between 1-4 and that will determine the level of dither applied. Once we get to the the maximum dither level, say 4 it can cycle back around to 1.

Will that work for you?

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Mon Aug 10, 2020 11:02 pm

Yes that is a great idea !

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Mon Aug 10, 2020 11:29 pm

pixelblip wrote:
Mon Aug 10, 2020 11:02 pm
Yes that is a great idea !
Updated code above with a dither index, have a play and let me know if it feels right?

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Tue Aug 11, 2020 3:30 am

That works so well Fourthstone. Talented you are. Thanks mucho.
The extra pattern make a massive difference.
It’s great to see this program come on now!

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Tue Aug 11, 2020 8:57 am

Here's a little update that adds background and foreground colour codes.

I've done it separate to the drawing tool because when drawing with paint, dither, lines etc. trying to plot a colour code in the char to the left could be immediately erased if the mouse is moving left so it didn't make sense in my head... but happy to be told otherwise!

So...
'F' will plot the currently selected colour at the cursor as a graphics colour code
'B' will plot the currently selected colour at the cursor in addition to the new background colour code
'B' + 'E' plot the remove background code at the cursor

All seems to work pretty well apart from not really being able to tell where the codes are printed!

I'm brewing around a few idea's for tracking either the current sixel or current text location with some form of text cursor. We will need to display the code number under the current text cursor in the (very full) toolbar... so still thinking my way through this but at some point will need to move some functions into a dialog panel, or something such, to free up some much needed toolbar real-estate.

As always, please play and offer up any ideas, bugs, suggestions, criticism etc.etc.

Code: Select all

      MODE 7

      MOUSE ON 0

      REM drawing bounds used for < and >
      xMin%=1
      xMax%=80
      yMin%=2
      yMax%=75


      REM fill bounds & BUFFER used with < and >
      fxMin%=2
      fxMax%=80
      fyMin%=3
      fyMax%=74
      DIM fill{(100) x%,y%}

      REM UNDO TEST ARRAY
      UNDO_MAX%=19
      DIM UNDO_BUFFER(UNDO_MAX%,959)
      UNDO_INDEX%=0

      REM OLD PIXEL & MOUSE COORDS
      OLD_PX%=0
      OLD_PY%=0
      OLD_MX%=0
      OLD_MY%=0
      OLD_TX%=0
      OLD_TY%=0

      REM MOUSE COORDS
      MX%=0
      MY%=0
      MB%=0

      REM TEXT & PIXEL COORDS FOR CURRENT MOUSE READ LOCATION
      TX%=0
      TY%=0
      PX%=0
      PY%=0

      REM TOOL VARS
      curcol%=7
      backcol%=7
      toolsel%=1
      toolcursor%=15
      erase%=0
      dither%=0

      PROCGR
      PROCdrawmenu

      REPEAT

        PROCREADMOUSE

        IF MX%<>OLD_MX% OR MY%<>OLD_MY% OR MB% THEN
          IF TY%=0 THEN
            REM CLICK INSIDE MENU AREA
            IF MB%=4 THEN
              CASE TX% OF
                WHEN 1: curcol%=1
                WHEN 3: curcol%=2
                WHEN 5: curcol%=3
                WHEN 7: curcol%=4
                WHEN 9: curcol%=5
                WHEN 11: curcol%=6
                WHEN 13: curcol%=7

                WHEN 15: toolsel%=1:toolcursor%=TX%: REM PAINT
                WHEN 16: toolsel%=2:toolcursor%=TX%: REM DITHER
                WHEN 17: dither%=(dither%+1) MOD 4: REM DITHER SCALE

                WHEN 19: erase%=(erase%+1) AND 1: REM TOGLE ERASER

                WHEN 21: REM CLEARSCREEN
                  PROCundosave
                  PROCGR

                WHEN 22: toolsel%=5:toolcursor%=TX%: REM BACKGROUND COLOUR
                WHEN 23: toolsel%=6:toolcursor%=TX%: REM FORGROUND

                WHEN 25: toolsel%=7:toolcursor%=TX%: REM CIRCEL
                WHEN 26: toolsel%=8:toolcursor%=TX%: REM RECTANGLE
                WHEN 27: toolsel%=9:toolcursor%=TX%: REM LINE
                WHEN 28: toolsel%=10:toolcursor%=TX%: REM FILL

                WHEN 30: PROCloadfile: REM LOAD
                WHEN 31: PROCsavefile: REM SAVE

                WHEN 33: PROCundorestore: REM ERASE


              ENDCASE

              REM CHANGE BACKGROUND COLOUR, TEMPORARY CLUDGE
              REMIF TX%<14 THEN
              REMFOR Y%=1 TO 24
              REMPRINTTAB(0,Y%) CHR$(144+curcol%);
              REMNEXT
              REMENDIF

              PROCdrawmenu

              PROCWAITMOUSE(0)

            ENDIF

          ELSE
            REM CLICK INSIDE DRAWING AREA
            CASE MB% OF
              WHEN 1:
                REM PLACE HOLDER FOR RIGHT MOUSE

              WHEN 2:
                REM PLACE HOLDER FOR MIDDLE MOUSE

              WHEN 4:
                REM LEFT MOUSE CLICK OR TOUCH SCREEN CLICK
                CASE toolsel% OF
                  WHEN 1: REM PAINT TOOL
                    PROCundosave
                    PROCpoint(PX%,PY%,1)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN PROCpoint(PX%,PY%,1-erase%)
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                  WHEN 2: REM DITHER TOOL
                    PROCundosave
                    D%=2^(dither%)
                    DA%=2
                    IF dither%=2 THEN DA%=4
                    IF dither%=3 THEN DA%=8

                    X%=(PX% DIV DA%)*DA%
                    Y%=(PY% DIV DA%)*DA%
                    PROCpoint(X%,Y%,1-erase%)
                    PROCpoint(X%+D%,Y%+D%,1-erase%)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        X%=(PX% DIV DA%)*DA%
                        Y%=(PY% DIV DA%)*DA%
                        PROCpoint(X%,Y%,1-erase%)
                        PROCpoint(X%+D%,Y%+D%,1-erase%)
                      ENDIF
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                  WHEN 5: REM BACKGROUND COLOUR
                    PROCundosave
                    VDU 31,TX%,TY%,(curcol%+128),157-erase%
                    REPEAT
                      PROCREADMOUSE
                      IF TX%<>OLD_TX% OR TY%<>OLD_TY% THEN VDU 31,TX%,TY%,(curcol%+128),157-erase%
                      OLD_TX%=TX%
                      OLD_TY%=TY%
                    UNTIL MB%=0

                  WHEN 6: REM FORGROUND COLOUR
                    PROCundosave
                    VDU 31,TX%,TY%,(curcol%+144)
                    REPEAT
                      PROCREADMOUSE
                      IF TX%<>OLD_TX% OR TY%<>OLD_TY% THEN VDU 31,TX%,TY%,(curcol%+144)
                      OLD_TX%=TX%
                      OLD_TY%=TY%
                    UNTIL MB%=0

                  WHEN 7: REM CIRCLE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    REM PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCcircle(startx%,starty%,startx%-OLD_PX%,2)
                        PROCcircle(startx%,starty%,startx%-PX%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCcircle(startx%,starty%,startx%-PX%,1)

                  WHEN 8: REM RECTANGLE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCrectangle(startx%,starty%,OLD_PX%,OLD_PY%,2)
                        PROCrectangle(startx%,starty%,PX%,PY%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCrectangle(startx%,starty%,PX%,PY%,1)

                  WHEN 9: REM LINE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCbresenham(startx%,starty%,OLD_PX%,OLD_PY%,2)
                        PROCbresenham(startx%,starty%,PX%,PY%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCbresenham(startx%,starty%,PX%,PY%,1)

                  WHEN 10: REM FILL TOOL
                    PROCundosave
                    PROCfloodfill(PX%,PY%)
                    REPEAT
                      PROCREADMOUSE
                      WAIT 2
                    UNTIL MB%=0

                  WHEN 12: REM ERASER TOOL
                    PROCundosave
                    PROCpoint(PX%,PY%,0)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<2 THEN PX%=2
                      IF PX%>79 THEN PX%=79
                      IF PY%<2 THEN PY%=2
                      IF PY%>74 THEN PY%=74
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN PROCpoint(PX%,PY%,0)
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                ENDCASE


            ENDCASE

          ENDIF

        ELSE
          WAIT 2
        ENDIF

        REM SHOW ALL MOUSE TRACKING DETAILS
        REM PRINTTAB(0,0)SPC(40)
        REM PRINTTAB(0,0)"MX:";STR$(MX%);" MY:";STR$(MY%);" TX:";STR$(TX%);" TY:";STR$(TY%);" PX:";STR$(PX%);" PY:";STR$(PY%)


        REM REMEMBER MOUSE POSITION
        OLD_MX%=MX%
        OLD_MY%=MY%

      UNTIL 0

      END

      REM READ MOUSE AND CALCULATE TEXT AND SIXEL LOCATIONS
      DEF PROCREADMOUSE

      MOUSE MX%,MY%,MB%

      REM TEXT LOCATION RELEATIVE TO MOUSE
      TX%=MX% DIV 32
      TY%=(999-MY%) DIV 40

      REM SIXEL LOCATION RELEATIVE TO MOUSE
      PX%=MX% DIV 16
      PY%=(999-MY%)/13.3333333

      VDU 31,toolcursor%,0
      ENDPROC

      REM WAIT FOR MOUSE TO BE A SPECIFIC BUTTON CLICK
      DEF PROCWAITMOUSE(M%)
      REPEAT
        PROCREADMOUSE
        WAIT 2
      UNTIL MB%=M%
      ENDPROC


      REM Read the point at the specified coordinates (1=set, 0=cleared)
      DEFFNpoint(x%,y%)
      LOCAL cx%,cy%,chr%,C%
      REM Get character cell
      cx% = x% DIV 2
      cy% = y% DIV 3
      chr%=GET(cx%,cy%) AND &5F
      C%=(x% AND 1)+(y% MOD 3)*2
      C%=2^C% - (C%=5)*32
      =SGN(chr% AND C%)

      REM Plot a Teletext sixel point
      REM SIXEL COORDINATES WITH 0,0 BEING TOP LEFT THE SAME AS THE TEXT SCREEN
      REM cmd% 0: Clear the point
      REM cmd% 1: Set the point
      REM cmd% 2: Toggle the point
      DEFPROCpoint(x%, y%, cmd%)

      IF x%>xMin% AND x%<xMax% AND y%>yMin% AND y%<yMax% THEN

        LOCAL cx%,cy%,chr%,C%
        REM Get character cell
        cx% = x% DIV 2
        cy% = y% DIV 3
        chr%=GET(cx%,cy%) AND &5F
        C%=(x% AND 1)+(y% MOD 3)*2
        C%=2^C% - (C%=5)*32
        CASE cmd% OF
          WHEN 0:chr% AND=(&5F - C%)
          WHEN 1:chr% OR=C%
          WHEN 2:chr% EOR=C%
        ENDCASE

        VDU 31,cx%, cy%,(chr%+160)
      ENDIF

      ENDPROC

      REM LINE ROUTINE USE m% TO PERFORM 0=ERASE / 1=DRAW / 2=EOR
      DEF PROCbresenham(x1%,y1%,x2%,y2%,m%)
      LOCAL dx%, dy%, sx%, sy%, e
      dx% = ABS(x2% - x1%) : sx% = SGN(x2% - x1%)
      dy% = ABS(y2% - y1%) : sy% = SGN(y2% - y1%)
      IF dx% > dy% e = dx% / 2 ELSE e = dy% / 2
      REPEAT
        PROCpoint(x1%,y1%,m%)
        IF x1% = x2% IF y1% = y2% EXIT REPEAT
        IF dx% > dy% THEN
          x1% += sx% : e -= dy% : IF e < 0 e += dx% : y1% += sy%
        ELSE
          y1% += sy% : e -= dx% : IF e < 0 e += dy% : x1% += sx%
        ENDIF
      UNTIL FALSE
      ENDPROC

      REM RECTANGLE ROUTINE
      DEF PROCrectangle(x1%,y1%,x2%,y2%,m%)

      REM CHECK FOR SPECIAL CASES TO PRESERVE EOR OPERATIONS
      IF x1%=x2% AND y1%=y2% THEN
        PROCpoint(x1%,y1%,m%)
      ELSE
        IF x1%=x2% OR y1%=y2% THEN
          PROCbresenham(x1%,y1%,x2%,y2%,m%)
        ELSE
          PROCbresenham(x1%,y1%,x2%,y1%,m%)
          PROCbresenham(x1%,y2%,x2%,y2%,m%)
          IF ABS(y2%-y1%)>1 THEN
            IF y1%>y2% THEN SWAP y1%,y2%
            FOR Y%=y1%+1 TO y2%-1
              PROCpoint(x1%,Y%,m%)
              PROCpoint(x2%,Y%,m%)
            NEXT
          ENDIF
        ENDIF
      ENDIF
      ENDPROC

      REM CIRCLE ROUTINE
      DEF PROCcircle(x1%,y1%,r%,m%)
      LOCAL p,x%,y%

      r%=ABS(r%)
      p=(5-r%*4)/4
      x%=0
      y%=r%

      PROCcirclepoints(x1%,y1%,x%,y%,m%)

      WHILE x%<y%
        x%+=1
        IF p<0 THEN
          p+=2*x%+1
        ELSE
          y%-=1
          p+=2*(x%-y%)+1
        ENDIF
        PROCcirclepoints(x1%,y1%,x%,y%,m%)
      ENDWHILE

      ENDPROC

      REM THIS PLOTS THE POINTS FOR CIRCLE ROUTINE
      DEF PROCcirclepoints(cx%,cy%,x%,y%,m%)
      IF x%=0 THEN
        PROCpoint(cx%,cy%+y%,m%)
        PROCpoint(cx%,cy%-y%,m%)
        PROCpoint(cx%+y%,cy%,m%)
        PROCpoint(cx%-y%,cy%,m%)
      ELSE
        IF x%<=y% THEN
          PROCpoint(cx%+x%,cy%+y%,m%)
          PROCpoint(cx%-x%,cy%+y%,m%)
          PROCpoint(cx%+x%,cy%-y%,m%)
          PROCpoint(cx%-x%,cy%-y%,m%)
          IF x%<y% THEN
            PROCpoint(cx%+y%,cy%+x%,m%)
            PROCpoint(cx%-y%,cy%+x%,m%)
            PROCpoint(cx%+y%,cy%-x%,m%)
            PROCpoint(cx%-y%,cy%-x%,m%)
          ENDIF
        ENDIF
      ENDIF
      ENDPROC

      REM ### flood fill from ART4BBW
      DEF PROCfloodfill(sx%,sy%)

      IF sx%>xMin% AND sx%<xMax% AND sy%>yMin% AND sy%<yMax% THEN

        LOCAL uf,df,c%,x%,y%,mc%
        uf=0
        df=0

        REM fill with mask colour first
        bCnt%=0
        PROCaddFill(sx%,sy%)

        REPEAT
          REM get next fill point
          bCnt%-=1
          x%=fill{(bCnt%)}.x%
          y%=fill{(bCnt%)}.y%
          IF FNpoint(x%,y%) = 0 THEN

            uf=1 : df=1

            REM scan left
            WHILE x%>fxMin% AND FNpoint(x%-1,y%) =0
              x%-=1
            ENDWHILE

            REM scan right
            WHILE x%<fxMax% AND FNpoint(x%,y%) = 0
              PROCpoint(x%,y%,1)

              REM detect colour changes above and add to list
              IF y%<fyMax% THEN
                c%=FNpoint(x%,y%+1)
                IF uf AND c%=0 THEN PROCaddFill(x%,y%+1) : uf=0
                IF c%=1 THEN uf=1
              ENDIF

              REM detect colour changes below and add to list
              IF y%>fyMin% THEN
                c%=FNpoint(x%,y%-1)
                IF df AND c%=0 THEN PROCaddFill(x%,y%-1) : df=0
                IF c%=1 THEN df=1
              ENDIF
              x%+=1
            ENDWHILE
          ENDIF

        UNTIL bCnt%=0
      ENDIF

      ENDPROC

      REM ### fill quasi stack
      DEF PROCaddFill(x%,y%)
      fill{(bCnt%)}.x%=x%
      fill{(bCnt%)}.y%=y%
      IF bCnt%<100 THEN bCnt%+=1
      ENDPROC

      REM SAVE UNDO SCREEN
      DEF PROCundosave
      LOCAL U%
      UNDO_INDEX%+=1
      IF UNDO_INDEX%>UNDO_MAX% THEN UNDO_INDEX%=0

      FOR U%=0 TO 959
        UNDO_BUFFER(UNDO_INDEX%,U%)=GET(U% MOD 40,U% DIV 40+1)
      NEXT

      ENDPROC

      REM SAVE UNDO SCREEN
      DEF PROCundorestore
      LOCAL U%

      FOR U%=0 TO 959
        VDU 31,(U% MOD 40),(U% DIV 40+1),UNDO_BUFFER(UNDO_INDEX%,U%)
      NEXT

      UNDO_INDEX%-=1
      IF UNDO_INDEX%<0 THEN UNDO_INDEX%=UNDO_MAX%

      ENDPROC

      REM LOADFILE
      DEF PROCloadfile
      PROCWAITMOUSE(0)
      PROCundosave
      PRINTTAB(7,6)CHR$(151);CHR$(232);STRING$(5,CHR$(172));CHR$(130);"LOAD FILE";CHR$(151);STRING$(6,CHR$(172));CHR$(180);CHR$(144+curcol%);
      FOR L%=7 TO 17
        PRINTTAB(7,L%)CHR$(151);CHR$(234);STRING$(21," ");CHR$(151);CHR$(181);CHR$(144+curcol%);
      NEXT
      PRINTTAB(7,18)CHR$(151);CHR$(170);STRING$(22,CHR$(172));CHR$(165);CHR$(144+curcol%);

      REM READ FILES
      PRINTTAB(10,7)CHR$(131);"..";
      PRINTTAB(10,8)CHR$(131);"PICTURE FOLDER 001";
      PRINTTAB(10,9)CHR$(131);"PICTURE 001";
      PRINTTAB(10,10)CHR$(131);"PICTURE 001";
      PRINTTAB(10,11)CHR$(131);"PICTURE 001";
      PRINTTAB(10,12)CHR$(131);"PICTURE 001";
      PRINTTAB(10,13)CHR$(131);"PICTURE 001";
      PRINTTAB(10,14)CHR$(131);"PICTURE 001";
      PRINTTAB(10,15)CHR$(131);"PICTURE 001";
      PRINTTAB(10,16)CHR$(131);"PICTURE 001";
      PRINTTAB(10,17)CHR$(131);"PICTURE 001";

      PROCWAITMOUSE(4)

      PROCWAITMOUSE(0)

      PROCundorestore
      ENDPROC

      REM SAVEFILE
      DEF PROCsavefile
      PROCWAITMOUSE(0)
      PROCundosave
      PRINTTAB(9,10)CHR$(151);CHR$(232);STRING$(18,CHR$(172));CHR$(180);CHR$(144+curcol%);
      FOR L%=11 TO 13
        PRINTTAB(9,L%)CHR$(151);CHR$(234);STRING$(17," ");CHR$(151);CHR$(181);CHR$(144+curcol%);
      NEXT
      PRINTTAB(9,14)CHR$(151);CHR$(170);STRING$(18,CHR$(172));CHR$(165);CHR$(144+curcol%);

      REM READ FILES
      PRINTTAB(13,12)CHR$(130);"FILE SAVED!";

      PROCWAITMOUSE(4)

      PROCWAITMOUSE(0)

      PROCundorestore

      ENDPROC

      REM INITIALISE THE SCREEN
      DEF PROCGR

      REM CLS
      VDU 12

      REM ADD GRAPHICS CODE TO LEFT SIDE OF CANVAS
      FOR Y%=1 TO 24
        PRINTTAB(0,Y%) CHR$(144+curcol%);
      NEXT

      ENDPROC

      REM PRINT PALETTE AND MENU
      DEF PROCdrawmenu
      FOR count%=1 TO 7
        PRINTTAB(count%*2-2,0) CHR$(128+count%);CHR$(255+(count%=curcol%)*213);
      NEXT count%
      PRINTTAB(14,0) CHR$(135);"PD"STR$(dither%+1);CHR$(135-erase%*5);"E";CHR$(135);"CBF ORLF LS U A<>PS"
      ENDPROC

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Tue Aug 11, 2020 9:27 am

Great!
Well done. I am going to the park today so I will paint some more piccies! ( with colour!)

I like the way you underline the tool with a flashing cursor. That is simple and doesn't use up any more screen estate for menus. Very well thought out.

I am not sure if it's the end of the world not being able to see the graphic control codes but I suppose it is useful to stop one overwriting bits of the picture...but since there is an undo it's not a big deal if you can't see them.....

I look forward to sitting under the tree in the shade and doing some painting. Thanks!

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Tue Aug 11, 2020 9:29 am

That works so well just nice to put background colour down!
Attachments
colours.PNG

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Tue Aug 11, 2020 9:31 am

As for the menu ....I wonder if it would make sense to move the menu onto a a sep page - or have a menu switcher button - that way you can have two menus.....
I do like the fact it is always at the top ready for action....

Soruk
Posts: 793
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Teletext paint program

Post by Soruk » Tue Aug 11, 2020 9:42 am

You have the code to save the screen memory to file. You could use those memory pointers to dump the screen memory to another block of DIMmed memory, do whatever menu screens you want, then restore the screen memory once done.

Sorry, no code examples, on holiday with no computer!
Matrix Brandy BASIC VI (work in progress)

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Tue Aug 11, 2020 10:06 am

Soruk wrote:
Tue Aug 11, 2020 9:42 am
You have the code to save the screen memory to file. You could use those memory pointers to dump the screen memory to another block of DIMmed memory, do whatever menu screens you want, then restore the screen memory once done.

Sorry, no code examples, on holiday with no computer!
I'm already doing that for the undo routines, and also if you click the L or S buttons I have dialogs that pop up in front of the picture by first saving an undo... when the dialog is closed I restore the saved memory.

It will be a case of determining what is essential to have in the main menu bar and shuffling off other non-essential items to a second menu screen or dialog.

One issue I've just noticed, the background colour leeches into the dialog popup! haha :lol: will need to either add more codes or just have an entirely different screen for dialogs etc. all possible now we have the base framework in place.

I must say that with out the work of Soruk and Richard I wouldn't have attempted to do the tool in Mode 7, well done for showing the way with usable example code and primitives =D>
Mode7_ART.PNG

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Tue Aug 11, 2020 10:08 am

I love that loading screen it's so old skool!
I'm gonna put me some Jefferson Airplane on and go under a tree and paint soon!

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Tue Aug 11, 2020 4:51 pm

Just love doodling it’s really nice to paint with.
Someone once asked me have you done any finger painting in teletext. I thought that was whacky but now it’s perfectly possible!

It will be great when animation is added. Imagine all the pics that will come out.
Attachments
1A866AD3-E336-4B0E-AEB3-301B44404A05.jpeg

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Wed Aug 12, 2020 9:19 am

Experimental update today, added a cursor for when using background or foreground tool and the ascii code at the end of the toolbar, not permanent changes but just trying out what works. It is really helpful have the cursor move to the text location where the mouse is.

Noticed the first issue with adding colour codes, once they're added if any other drawing tool is used such as circle or square etc. the very act of dragging the shape around to draw over writes any colour codes... ooops!

We could just ignore any non sixel codes but then you'll end up with holes in the shape... but still an option.

I recommend doing all the drawing first with a single colour and then adding colour and micro changes after that... otherwise I'm not sure how to handle it other than rewriting everything as proposed with buffer layers that get rendered rather than poking the screen directly.

Thoughts? Comments? Suggestions?

Code: Select all

      MODE 7

      MOUSE ON 3

      REM drawing bounds used for < and >
      xMin%=1
      xMax%=80
      yMin%=2
      yMax%=75


      REM fill bounds & BUFFER used with < and >
      fxMin%=2
      fxMax%=80
      fyMin%=3
      fyMax%=74
      DIM fill{(100) x%,y%}

      REM UNDO TEST ARRAY
      UNDO_MAX%=19
      DIM UNDO_BUFFER(UNDO_MAX%,959)
      UNDO_INDEX%=0

      REM OLD PIXEL & MOUSE COORDS
      OLD_PX%=0
      OLD_PY%=0
      OLD_MX%=0
      OLD_MY%=0
      OLD_TX%=0
      OLD_TY%=0

      REM MOUSE COORDS
      MX%=0
      MY%=0
      MB%=0

      REM TEXT & PIXEL COORDS FOR CURRENT MOUSE READ LOCATION
      TX%=0
      TY%=0
      PX%=0
      PY%=0

      REM TOOL VARS
      curcol%=7
      backcol%=7
      toolsel%=1
      toolcursor%=15
      erase%=0
      dither%=0

      PROCGR
      PROCdrawmenu

      REPEAT

        PROCREADMOUSE

        IF MX%<>OLD_MX% OR MY%<>OLD_MY% OR MB% THEN
          IF TY%=0 THEN
            REM CLICK INSIDE MENU AREA
            IF MB%=4 THEN
              CASE TX% OF
                WHEN 1: curcol%=1
                WHEN 3: curcol%=2
                WHEN 5: curcol%=3
                WHEN 7: curcol%=4
                WHEN 9: curcol%=5
                WHEN 11: curcol%=6
                WHEN 13: curcol%=7

                WHEN 15: toolsel%=1:toolcursor%=TX%: REM PAINT
                WHEN 16: toolsel%=2:toolcursor%=TX%: REM DITHER
                WHEN 17: dither%=(dither%+1) MOD 4: REM DITHER SCALE

                WHEN 19: erase%=(erase%+1) AND 1: REM TOGLE ERASER

                WHEN 21: REM CLEARSCREEN
                  PROCundosave
                  PROCGR

                WHEN 22: toolsel%=5:toolcursor%=TX%: REM BACKGROUND COLOUR
                WHEN 23: toolsel%=6:toolcursor%=TX%: REM FORGROUND

                WHEN 25: toolsel%=7:toolcursor%=TX%: REM CIRCEL
                WHEN 26: toolsel%=8:toolcursor%=TX%: REM RECTANGLE
                WHEN 27: toolsel%=9:toolcursor%=TX%: REM LINE
                WHEN 28: toolsel%=10:toolcursor%=TX%: REM FILL

                WHEN 30: PROCloadfile: REM LOAD
                WHEN 31: PROCsavefile: REM SAVE

                WHEN 33: PROCundorestore: REM ERASE


              ENDCASE

              REM CHANGE BACKGROUND COLOUR, TEMPORARY CLUDGE
              REMIF TX%<14 THEN
              REMFOR Y%=1 TO 24
              REMPRINTTAB(0,Y%) CHR$(144+curcol%);
              REMNEXT
              REMENDIF

              PROCdrawmenu

              PROCWAITMOUSE(0)

            ENDIF

          ELSE
            REM CLICK INSIDE DRAWING AREA
            CASE MB% OF

              WHEN 1:
                REM PLACE HOLDER FOR RIGHT MOUSE

              WHEN 2:
                REM PLACE HOLDER FOR MIDDLE MOUSE

              WHEN 4:
                REM LEFT MOUSE CLICK OR TOUCH SCREEN CLICK
                CASE toolsel% OF
                  WHEN 1: REM PAINT TOOL
                    PROCundosave
                    PROCpoint(PX%,PY%,1)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN PROCpoint(PX%,PY%,1-erase%)
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                  WHEN 2: REM DITHER TOOL
                    PROCundosave
                    D%=2^(dither%)
                    DA%=2
                    IF dither%=2 THEN DA%=4
                    IF dither%=3 THEN DA%=8

                    X%=(PX% DIV DA%)*DA%
                    Y%=(PY% DIV DA%)*DA%
                    PROCpoint(X%,Y%,1-erase%)
                    PROCpoint(X%+D%,Y%+D%,1-erase%)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        X%=(PX% DIV DA%)*DA%
                        Y%=(PY% DIV DA%)*DA%
                        PROCpoint(X%,Y%,1-erase%)
                        PROCpoint(X%+D%,Y%+D%,1-erase%)
                      ENDIF
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                  WHEN 5: REM BACKGROUND COLOUR
                    PROCundosave
                    VDU 31,TX%,TY%,(curcol%+128),157-erase%
                    REPEAT
                      PROCREADMOUSE
                      IF TX%<>OLD_TX% OR TY%<>OLD_TY% THEN VDU 31,TX%,TY%,(curcol%+128),157-erase%
                      OLD_TX%=TX%
                      OLD_TY%=TY%
                    UNTIL MB%=0

                  WHEN 6: REM FORGROUND COLOUR
                    PROCundosave
                    VDU 31,TX%,TY%,(curcol%+144)
                    REPEAT
                      PROCREADMOUSE
                      IF TX%<>OLD_TX% OR TY%<>OLD_TY% THEN VDU 31,TX%,TY%,(curcol%+144)
                      OLD_TX%=TX%
                      OLD_TY%=TY%
                    UNTIL MB%=0

                  WHEN 7: REM CIRCLE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    REM PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCcircle(startx%,starty%,startx%-OLD_PX%,2)
                        PROCcircle(startx%,starty%,startx%-PX%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCcircle(startx%,starty%,startx%-PX%,1)

                  WHEN 8: REM RECTANGLE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCrectangle(startx%,starty%,OLD_PX%,OLD_PY%,2)
                        PROCrectangle(startx%,starty%,PX%,PY%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCrectangle(startx%,starty%,PX%,PY%,1)

                  WHEN 9: REM LINE TOOL
                    PROCundosave
                    startx%=PX%: starty%=PY%
                    OLD_PX%=PX% : OLD_PY%=PY%
                    PROCpoint(startx%,starty%,2)

                    REPEAT
                      PROCREADMOUSE
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN
                        PROCbresenham(startx%,starty%,OLD_PX%,OLD_PY%,2)
                        PROCbresenham(startx%,starty%,PX%,PY%,2)
                        OLD_PX%=PX%
                        OLD_PY%=PY%
                      ENDIF
                    UNTIL MB%=0
                    PROCbresenham(startx%,starty%,PX%,PY%,1)

                  WHEN 10: REM FILL TOOL
                    PROCundosave
                    PROCfloodfill(PX%,PY%)
                    REPEAT
                      PROCREADMOUSE
                      WAIT 2
                    UNTIL MB%=0

                  WHEN 12: REM ERASER TOOL
                    PROCundosave
                    PROCpoint(PX%,PY%,0)
                    REPEAT
                      PROCREADMOUSE
                      IF PX%<2 THEN PX%=2
                      IF PX%>79 THEN PX%=79
                      IF PY%<2 THEN PY%=2
                      IF PY%>74 THEN PY%=74
                      IF PX%<>OLD_PX% OR PY%<>OLD_PY% THEN PROCpoint(PX%,PY%,0)
                      OLD_PX%=PX%
                      OLD_PY%=PY%
                    UNTIL MB%=0

                ENDCASE


            ENDCASE

          ENDIF

        ELSE
          WAIT 2
        ENDIF

        REM SHOW ALL MOUSE TRACKING DETAILS
        REM PRINTTAB(0,0)SPC(40)
        REM PRINTTAB(0,0)"MX:";STR$(MX%);" MY:";STR$(MY%);" TX:";STR$(TX%);" TY:";STR$(TY%);" PX:";STR$(PX%);" PY:";STR$(PY%)


        REM REMEMBER MOUSE POSITION
        OLD_MX%=MX%
        OLD_MY%=MY%

      UNTIL 0

      END

      REM READ MOUSE AND CALCULATE TEXT AND SIXEL LOCATIONS
      DEF PROCREADMOUSE

      MOUSE MX%,MY%,MB%

      REM TEXT LOCATION RELEATIVE TO MOUSE
      TX%=MX% DIV 32
      TY%=(999-MY%) DIV 40

      REM SIXEL LOCATION RELEATIVE TO MOUSE
      PX%=MX% DIV 16
      PY%=(999-MY%)/13.3333333

      IF toolsel%=5 OR toolsel%=6 THEN
        A$=STR$(GET(TX%,TY%))
        IF LEN(A$)<3 THEN A$=STRING$(3-LEN(A$)," ")+A$
        VDU 23,1,0;0;0;0; : REM Disable cursor
        PRINTTAB(37,0)A$;
        VDU 23,1,1;0;0;0; : REM Enable cursor
        VDU 31,TX%,TY%
      ELSE
        VDU 31,toolcursor%,0
      ENDIF


      ENDPROC

      REM WAIT FOR MOUSE TO BE A SPECIFIC BUTTON CLICK
      DEF PROCWAITMOUSE(M%)
      REPEAT
        PROCREADMOUSE
        WAIT 2
      UNTIL MB%=M%
      ENDPROC


      REM Read the point at the specified coordinates (1=set, 0=cleared)
      DEFFNpoint(x%,y%)
      LOCAL cx%,cy%,chr%,C%
      REM Get character cell
      cx% = x% DIV 2
      cy% = y% DIV 3
      chr%=GET(cx%,cy%) AND &5F
      C%=(x% AND 1)+(y% MOD 3)*2
      C%=2^C% - (C%=5)*32
      =SGN(chr% AND C%)

      REM Plot a Teletext sixel point
      REM SIXEL COORDINATES WITH 0,0 BEING TOP LEFT THE SAME AS THE TEXT SCREEN
      REM cmd% 0: Clear the point
      REM cmd% 1: Set the point
      REM cmd% 2: Toggle the point
      DEFPROCpoint(x%, y%, cmd%)

      IF x%>xMin% AND x%<xMax% AND y%>yMin% AND y%<yMax% THEN

        LOCAL cx%,cy%,chr%,C%
        REM Get character cell
        cx% = x% DIV 2
        cy% = y% DIV 3
        chr%=GET(cx%,cy%) AND &5F
        C%=(x% AND 1)+(y% MOD 3)*2
        C%=2^C% - (C%=5)*32
        CASE cmd% OF
          WHEN 0:chr% AND=(&5F - C%)
          WHEN 1:chr% OR=C%
          WHEN 2:chr% EOR=C%
        ENDCASE

        VDU 31,cx%, cy%,(chr%+160)
      ENDIF

      ENDPROC

      REM LINE ROUTINE USE m% TO PERFORM 0=ERASE / 1=DRAW / 2=EOR
      DEF PROCbresenham(x1%,y1%,x2%,y2%,m%)
      LOCAL dx%, dy%, sx%, sy%, e
      dx% = ABS(x2% - x1%) : sx% = SGN(x2% - x1%)
      dy% = ABS(y2% - y1%) : sy% = SGN(y2% - y1%)
      IF dx% > dy% e = dx% / 2 ELSE e = dy% / 2
      REPEAT
        PROCpoint(x1%,y1%,m%)
        IF x1% = x2% IF y1% = y2% EXIT REPEAT
        IF dx% > dy% THEN
          x1% += sx% : e -= dy% : IF e < 0 e += dx% : y1% += sy%
        ELSE
          y1% += sy% : e -= dx% : IF e < 0 e += dy% : x1% += sx%
        ENDIF
      UNTIL FALSE
      ENDPROC

      REM RECTANGLE ROUTINE
      DEF PROCrectangle(x1%,y1%,x2%,y2%,m%)

      REM CHECK FOR SPECIAL CASES TO PRESERVE EOR OPERATIONS
      IF x1%=x2% AND y1%=y2% THEN
        PROCpoint(x1%,y1%,m%)
      ELSE
        IF x1%=x2% OR y1%=y2% THEN
          PROCbresenham(x1%,y1%,x2%,y2%,m%)
        ELSE
          PROCbresenham(x1%,y1%,x2%,y1%,m%)
          PROCbresenham(x1%,y2%,x2%,y2%,m%)
          IF ABS(y2%-y1%)>1 THEN
            IF y1%>y2% THEN SWAP y1%,y2%
            FOR Y%=y1%+1 TO y2%-1
              PROCpoint(x1%,Y%,m%)
              PROCpoint(x2%,Y%,m%)
            NEXT
          ENDIF
        ENDIF
      ENDIF
      ENDPROC

      REM CIRCLE ROUTINE
      DEF PROCcircle(x1%,y1%,r%,m%)
      LOCAL p,x%,y%

      r%=ABS(r%)
      p=(5-r%*4)/4
      x%=0
      y%=r%

      PROCcirclepoints(x1%,y1%,x%,y%,m%)

      WHILE x%<y%
        x%+=1
        IF p<0 THEN
          p+=2*x%+1
        ELSE
          y%-=1
          p+=2*(x%-y%)+1
        ENDIF
        PROCcirclepoints(x1%,y1%,x%,y%,m%)
      ENDWHILE

      ENDPROC

      REM THIS PLOTS THE POINTS FOR CIRCLE ROUTINE
      DEF PROCcirclepoints(cx%,cy%,x%,y%,m%)
      IF x%=0 THEN
        PROCpoint(cx%,cy%+y%,m%)
        PROCpoint(cx%,cy%-y%,m%)
        PROCpoint(cx%+y%,cy%,m%)
        PROCpoint(cx%-y%,cy%,m%)
      ELSE
        IF x%<=y% THEN
          PROCpoint(cx%+x%,cy%+y%,m%)
          PROCpoint(cx%-x%,cy%+y%,m%)
          PROCpoint(cx%+x%,cy%-y%,m%)
          PROCpoint(cx%-x%,cy%-y%,m%)
          IF x%<y% THEN
            PROCpoint(cx%+y%,cy%+x%,m%)
            PROCpoint(cx%-y%,cy%+x%,m%)
            PROCpoint(cx%+y%,cy%-x%,m%)
            PROCpoint(cx%-y%,cy%-x%,m%)
          ENDIF
        ENDIF
      ENDIF
      ENDPROC

      REM ### flood fill from ART4BBW
      DEF PROCfloodfill(sx%,sy%)

      IF sx%>xMin% AND sx%<xMax% AND sy%>yMin% AND sy%<yMax% THEN

        LOCAL uf,df,c%,x%,y%,mc%
        uf=0
        df=0

        REM fill with mask colour first
        bCnt%=0
        PROCaddFill(sx%,sy%)

        REPEAT
          REM get next fill point
          bCnt%-=1
          x%=fill{(bCnt%)}.x%
          y%=fill{(bCnt%)}.y%
          IF FNpoint(x%,y%) = 0 THEN

            uf=1 : df=1

            REM scan left
            WHILE x%>fxMin% AND FNpoint(x%-1,y%) =0
              x%-=1
            ENDWHILE

            REM scan right
            WHILE x%<fxMax% AND FNpoint(x%,y%) = 0
              PROCpoint(x%,y%,1)

              REM detect colour changes above and add to list
              IF y%<fyMax% THEN
                c%=FNpoint(x%,y%+1)
                IF uf AND c%=0 THEN PROCaddFill(x%,y%+1) : uf=0
                IF c%=1 THEN uf=1
              ENDIF

              REM detect colour changes below and add to list
              IF y%>fyMin% THEN
                c%=FNpoint(x%,y%-1)
                IF df AND c%=0 THEN PROCaddFill(x%,y%-1) : df=0
                IF c%=1 THEN df=1
              ENDIF
              x%+=1
            ENDWHILE
          ENDIF

        UNTIL bCnt%=0
      ENDIF

      ENDPROC

      REM ### fill quasi stack
      DEF PROCaddFill(x%,y%)
      fill{(bCnt%)}.x%=x%
      fill{(bCnt%)}.y%=y%
      IF bCnt%<100 THEN bCnt%+=1
      ENDPROC

      REM SAVE UNDO SCREEN
      DEF PROCundosave
      LOCAL U%
      UNDO_INDEX%+=1
      IF UNDO_INDEX%>UNDO_MAX% THEN UNDO_INDEX%=0

      FOR U%=0 TO 959
        UNDO_BUFFER(UNDO_INDEX%,U%)=GET(U% MOD 40,U% DIV 40+1)
      NEXT

      ENDPROC

      REM SAVE UNDO SCREEN
      DEF PROCundorestore
      LOCAL U%

      FOR U%=0 TO 959
        VDU 31,(U% MOD 40),(U% DIV 40+1),UNDO_BUFFER(UNDO_INDEX%,U%)
      NEXT

      UNDO_INDEX%-=1
      IF UNDO_INDEX%<0 THEN UNDO_INDEX%=UNDO_MAX%

      ENDPROC

      REM LOADFILE
      DEF PROCloadfile
      PROCWAITMOUSE(0)
      PROCundosave
      PRINTTAB(7,6)CHR$(151);CHR$(232);STRING$(5,CHR$(172));CHR$(130);"LOAD FILE";CHR$(151);STRING$(6,CHR$(172));CHR$(180);CHR$(144+curcol%);
      FOR L%=7 TO 17
        PRINTTAB(7,L%)CHR$(151);CHR$(234);STRING$(21," ");CHR$(151);CHR$(181);CHR$(144+curcol%);
      NEXT
      PRINTTAB(7,18)CHR$(151);CHR$(170);STRING$(22,CHR$(172));CHR$(165);CHR$(144+curcol%);

      REM READ FILES
      PRINTTAB(10,7)CHR$(131);"..";
      PRINTTAB(10,8)CHR$(131);"PICTURE FOLDER 001";
      PRINTTAB(10,9)CHR$(131);"PICTURE 001";
      PRINTTAB(10,10)CHR$(131);"PICTURE 001";
      PRINTTAB(10,11)CHR$(131);"PICTURE 001";
      PRINTTAB(10,12)CHR$(131);"PICTURE 001";
      PRINTTAB(10,13)CHR$(131);"PICTURE 001";
      PRINTTAB(10,14)CHR$(131);"PICTURE 001";
      PRINTTAB(10,15)CHR$(131);"PICTURE 001";
      PRINTTAB(10,16)CHR$(131);"PICTURE 001";
      PRINTTAB(10,17)CHR$(131);"PICTURE 001";

      PROCWAITMOUSE(4)

      PROCWAITMOUSE(0)

      PROCundorestore
      ENDPROC

      REM SAVEFILE
      DEF PROCsavefile
      PROCWAITMOUSE(0)
      PROCundosave
      PRINTTAB(9,10)CHR$(151);CHR$(232);STRING$(18,CHR$(172));CHR$(180);CHR$(144+curcol%);
      FOR L%=11 TO 13
        PRINTTAB(9,L%)CHR$(151);CHR$(234);STRING$(17," ");CHR$(151);CHR$(181);CHR$(144+curcol%);
      NEXT
      PRINTTAB(9,14)CHR$(151);CHR$(170);STRING$(18,CHR$(172));CHR$(165);CHR$(144+curcol%);

      REM READ FILES
      PRINTTAB(13,12)CHR$(130);"FILE SAVED!";

      PROCWAITMOUSE(4)

      PROCWAITMOUSE(0)

      PROCundorestore

      ENDPROC

      REM INITIALISE THE SCREEN
      DEF PROCGR

      REM CLS
      VDU 12

      REM ADD GRAPHICS CODE TO LEFT SIDE OF CANVAS
      FOR Y%=1 TO 24
        PRINTTAB(0,Y%) CHR$(144+curcol%);
      NEXT

      ENDPROC

      REM PRINT PALETTE AND MENU
      DEF PROCdrawmenu
      FOR count%=1 TO 7
        PRINTTAB(count%*2-2,0) CHR$(128+count%);CHR$(255+(count%=curcol%)*213);
      NEXT count%
      PRINTTAB(14,0) CHR$(135);"PD"STR$(dither%+1);CHR$(135-erase%*5);"E";CHR$(135);"CBF ORLF LS U A<>PS"
      ENDPROC

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Wed Aug 12, 2020 9:29 am

Thanks Fourthstone I'll give it a whirl.
I've got it on my phone now which is handy....so I can paint teletext any time I want. I'll report back many thanks!

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Wed Aug 12, 2020 12:14 pm

I think you are right...draw first then colour the colour it afterward

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Thu Aug 13, 2020 12:41 am

Question for Richard if I may, with our Teletext program running in Mode 7 is it possible to continue reading the mouse coordinates when the mouse is outside the range of the running program window?

I find it is useful for drawing shapes such as circles and lines with end points outside of the current window.

Cheers :)

EDIT: Another question if possible... have you got example code for loading a list of files in the current folder either into an array or some sort of list I can search through and display certain sections?

The intent with the second question is to be able to display around 10 filenames and using the mouse (or touch) scroll through the list and select one for loading.

:idea:

So far I have this but not sure if I am on the right track:

Code: Select all

      DIM FILELIST LOCAL 2000
      *SPOOL TEMPM7FILES.
      *CD
      OSCLI "LOAD ""TEMPM7FILES"" "+STR$~FILELIST+" +"+STR$~2000
      PRINT
      FOR I=0 TO 2000
        PRINTCHR$(FILELIST(I));
      NEXT

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Thu Aug 13, 2020 4:24 am

I’ve also hit a snag...need to get rid of the back button blocking the palette
Attachments
73DD3B63-89F1-4DF4-849C-1484A626B3A1.png

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Thu Aug 13, 2020 4:41 am

pixelblip wrote:
Thu Aug 13, 2020 4:24 am
I’ve also hit a snag...need to get rid of the back button blocking the palette
That's a good one Pixelblip, there may be a phone / device setting to hide it or move it, what device is it?

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Thu Aug 13, 2020 9:51 am

It's an Ipad.
To be honest I think you will find this is the case on Android as well.

Soruk
Posts: 793
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Teletext paint program

Post by Soruk » Thu Aug 13, 2020 9:53 am

pixelblip wrote:
Thu Aug 13, 2020 9:51 am
It's an Ipad.
To be honest I think you will find this is the case on Android as well.
I don't get this with the Telstar app on Android...
Matrix Brandy BASIC VI (work in progress)

User avatar
pixelblip
Posts: 2062
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Teletext paint program

Post by pixelblip » Thu Aug 13, 2020 10:01 am

Apologies Soruk you are correct I don't see this on my Android phone.
Another off topic thing is that I would really like to use this on my phone but not sure if really its suitable. One needs to expand the screen a bit and sort of lock pinch to zoom (if you are doing landscape on the phone).

I find using art programs in landscape mode on tablets or phones quite difficult to use but it does give you a larger image... I am always split about it. Holding phones it is natural to hold them in the cusp of your hand vertically and with Ipads I find the most comfortable position is portrait with it resting on my lap or belly.

We have been here before Fourthstone with this ! I wrestle with it and am split.
The thing is about a phone - one always has it on them at all times. So mabye more likely be used when out and about.

User avatar
Richard Russell
Posts: 1658
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Teletext paint program

Post by Richard Russell » Thu Aug 13, 2020 11:43 pm

FourthStone wrote:
Thu Aug 13, 2020 12:41 am
Question for Richard if I may
I've replied to these questions by PM, but for the record...
is it possible to continue reading the mouse coordinates when the mouse is outside the range of the running program window?
This is addressed in section 5d of the document here.
have you got example code for loading a list of files in the current folder either into an array or some sort of list
FN_dirscan in the supplied library filedlg.bbc does that.

User avatar
FourthStone
Posts: 998
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Teletext paint program

Post by FourthStone » Thu Aug 13, 2020 11:58 pm

Richard Russell wrote:
Thu Aug 13, 2020 11:43 pm
FourthStone wrote:
Thu Aug 13, 2020 12:41 am
Question for Richard if I may
I've replied to these questions by PM, but for the record...
is it possible to continue reading the mouse coordinates when the mouse is outside the range of the running program window?
This is addressed in section 5d of the document here.
have you got example code for loading a list of files in the current folder either into an array or some sort of list
FN_dirscan in the supplied library filedlg.bbc does that.
Many thanks Richard and much appreciated, will have a go at integrating into our little program :)

User avatar
Richard Russell
Posts: 1658
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Teletext paint program

Post by Richard Russell » Fri Aug 14, 2020 12:02 am

pixelblip wrote:
Thu Aug 13, 2020 4:24 am
I’ve also hit a snag...need to get rid of the back button blocking the palette
Again I've replied by PM, but this will remove the back button:

Code: Select all

      *ESC OFF

Post Reply

Return to “programming”