VGAGUI.ARC

Give it a try, it costs you nothing !
Post Reply
BeanieBots
Posts: 345
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 183 times
Been thanked: 112 times

VGAGUI.ARC

Post by BeanieBots »

I've been playing around with the VGAGUI.ARC command hoping to make a custom gauge.
Alas, it is too constrained.
It's great for something like a VU meter but I think it could be made more general purpose.
The current options {VGAGUI.ARC (x, y, width, height, value [,thickness=10])} are a little too limiting.
May I propose something like:
VGAGUI.ARC (x, y, radius1, radius2, startangle, endangle [,colour])
or maybe.
VGAGUI.ARC (x, y, radius1, startangle, value, thickness [,colour])
User avatar
cicciocb
Site Admin
Posts: 2057
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1357 times
Contact:

Re: VGAGUI.ARC

Post by cicciocb »

Hello,
probably this command has been badly named ARC because it is in fact an ARC meter indicator.
For your info, you can use a negative number for the "thickness" (see what happens).

Probably what you want is something like VGA.ARC to draw just an arc?

For your reference, this is (presque) the code that draws the arc

Code: [Local Link Removed for Guests]

sub draw_arc(v)
local tmp
tmp = v/100 *(1.5 * PI) - 0.25*PI
cx = 700
cy = 190
inner = 50
outer = 60
for a = -0.25*PI to 1.25*PI step PI/90
  xi = cx - fix(cos(a) * inner)
  yi = cy - fix(sin(a) * inner)
  xo = cx - fix(cos(a) * outer)
  yo = cy - fix(sin(a) * outer)
  if (a < tmp) then 
    vga.line xo,yo, xi, yi, red, 2
  else
    vga.line xo,yo, xi, yi, blue, 2
  end if
next a
vga.show
end sub
BeanieBots
Posts: 345
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 183 times
Been thanked: 112 times

Re: VGAGUI.ARC

Post by BeanieBots »

Yes, just draw an arc of specified start angle,end angle, colour, width etc. at location x,y.
I've already made a start doing it "old school" and came up with something not far from what you posted above!
Post Reply