Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to fill 2D circle with image

Author
Message
Snookie
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 12th Dec 2002 14:48
i need to fill circles with a speed'O and a rev counter... how can this be done? please

if speed#80.0 then speed#=80.0
rz#=rz#/1.1
x=x-(2*rz#)

circle 150,400,90
circle 500,400,90
G Man X
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 13th Dec 2002 01:06
Drawing the needle using 3D primitives may be possible; I haven't looked into DB's drawing primitives too far yet so I can't really comment on what is available to you in the 3D area. You might try drawing a line at first. I'm so new to DB that I can't say with any certainty that 0 degrees is 3 o'clock in 2D world and rotation counterclockwise but I'm pretty sure that a bit of code like

REMSTART
Insert some multiplying or dividing code to get speed values to relate to approx 270 degree range. If your max speed is 90 then you just multiply the current speed value by 3 here. If necessary offset this new angle to get the gap to go to the bottom and subtract the whole thing from 360 to reverse the direction of rotation e.g.,
newangle = 360 - (speed*3 - 45)
And of course, you need to offset the x,y values to accommodate your virtual console position
REMEND
oldx=midx: newy=midy'stops your first run of the code `from drawing a white line through the speedo boss
newangle = 360 - (speed*3 - 45)
newx = (needle_length * (Cos(newangle))) + midx
newy = (needle_length * (Sin(newangle))) + midy


ink RGB(255,255,255)`White to draw out the old line
line (midx,midy) - (oldx,oldy)
ink RGB(0,0,0)`black to draw in the new
line (midx,midy) - (newx,newy)
oldx = newx : oldy = newy

rem***************************************

will do the trick of relating the road and engine speed to polar measurements and drawing a needle in a fairly rough and ready style. Then you can think about averaging values and adding needle lag for smoothness and extra realism.


Good The Boyz Have Done It Is!
G Man X
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 13th Dec 2002 01:19
...whoops! Ah well, Rome wasn't built in a day.Howsabout

(360 - speed * 3) - 45

Good The Boyz Have Done It Is!
G Man X
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 13th Dec 2002 01:56
...oh boy, I should take more tobacco with it

Good The Boyz Have Done It Is!

Login to post a reply

Server time is: 2024-03-28 08:43:49
Your offset time is: 2024-03-28 08:43:49