Quality arrows using PROCLR(x,y,w) and PROCUD(x,y,w) tools

Discussions related to graphics (2D and 3D), animation and games programming
mikeg
Posts: 75
Joined: Sat 23 Jun 2018, 19:52

Quality arrows using PROCLR(x,y,w) and PROCUD(x,y,w) tools

Post by mikeg »

The arrows are able to be customizable as buttons and this was created on BBCSDL (the draws are easy to modify without POINT or FILL)

The arrows were created with 2 new tools that allow compact code, easy quality object design, and in program image code.
* no need to share a image link* (forum friendly image sharing)

PROCLR(x,y,w):REM (x,y,width) locates a horizontal line at x,y that extends evenly from a center point


PROCUD(x,y,w):REM (x,y,width) locates a vertical line at x,y that extends evenly from a center point

I hope this makes it easier for people to create custom interface objects in BBCSDL and BBC4W.

Code: Select all

  MODE 8
      REM (x,y,color)
      PROCarrowup(500,500,14)
      PROCarrowdown(500,450,13)
      PROCarrowleft(450,475,12)
      PROCarrowright(550,475,11)
      END
      DEFPROCarrowleft(x,y,c)
      LOCAL ax,aw
      GCOL c
      FOR ax=1 TO 20
        PROCUD(x-ax,y,10)
      NEXT ax
      ax=0:aw=20
      FOR ax=1 TO 20
        PROCUD(x-20-ax,y,aw)
        aw=aw-1
      NEXT ax
      ENDPROC
      DEFPROCarrowright(x,y,c)
      LOCAL ax,aw
      GCOL c
      FOR ax=1 TO 20
        PROCUD(x+ax,y,10)
      NEXT ax
      ax=0:aw=20
      FOR ax=1 TO 20
        PROCUD(x+20+ax,y,aw)
        aw=aw-1
      NEXT ax
      ENDPROC
      DEFPROCarrowup(x,y,c)
      LOCAL ax,aw
      GCOL c
      FOR ax=1 TO 20
        PROCLR(x,y+ax,10)
      NEXT ax
      ax=0:aw=20
      FOR ax=1 TO 20
        PROCLR(x,y+20+ax,aw)
        aw=aw-1
      NEXT ax
      ENDPROC
      DEFPROCarrowdown(x,y,c)
      LOCAL ax,aw
      GCOL c
      FOR ax=1 TO 20
        PROCLR(x,y-ax,10)
      NEXT ax
      ax=0:aw=20
      FOR ax=1 TO 20
        PROCLR(x,y-20-ax,aw)
        aw=aw-1
      NEXT ax
      ENDPROC
      REM Left and Right from center x,y, and width w
      DEFPROCLR(x,y,w)
      LINE x-w,y,x+w,y
      ENDPROC
      DEFPROCUD(x,y,w)
      LINE x,y+w,x,y-w
      ENDPROC
Focus is on code subject. Feel free to judge the quality of my work.

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

Re: Quality arrows using PROCLR(x,y,w) and PROCUD(x,y,w) tools

Post by RichardRussell »

If you are wanting to display "high quality" arrows can I remind you that the antialiased graphics libraries (GDIPLIB for BB4W and aagfxlib for BBCSDL) both support drawing lines with various different end-cap styles, one of which is an arrow. So by drawing a short straight line, with one end cap set appropriately, you can create an arrow! Admittedly you don't have control over the exact shape (which is different between the libraries).

Here is a little program for BBCSDL (it could easily be adapted for BB4W) that draws some random arrows:

Code: Select all

      INSTALL @lib$ + "aagfxlib"
      LineEndArrow = 3

      REPEAT
        shaft = 4
        thick = 4 + RND(20)
        angle = 2*PI*RND(1)
        col% = RND(&FFFFFF)
        x = RND(1280)
        y = RND(1000)

        x1 = x - shaft * thick * COS(angle)
        y1 = y - shaft * thick * SIN(angle)
        x2 = x + shaft * thick * COS(angle)
        y2 = y + shaft * thick * SIN(angle)

        PROC_aaline(x1, y1, x2, y2, thick, &FF000000 OR col%, LineEndArrow)
        *REFRESH
        WAIT 20
      UNTIL FALSE
      END
Image
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.

mikeg
Posts: 75
Joined: Sat 23 Jun 2018, 19:52

Re: Quality arrows using PROCLR(x,y,w) and PROCUD(x,y,w) tools

Post by mikeg »

Very cool Richard. I will experiment with that library
Focus is on code subject. Feel free to judge the quality of my work.