The online racing simulator
Help with Visual Basic and OutGauge
Hi, I'm trying to do a personalized outgauge program for my monitor (a PS1 screen hacked to VGA). I have a big part of work made.

Now want to rotate a picture (needle) in a gauge but I don't know how I can do, how would be the code?
I say rotate an image, becouse is the only way that I thinked. If is easy drawing a needle ok, but.. how will rotate later? I don't want to complicate so much the program.

Be patient with me... I'm too new in programming and VB
By drawing the needle yourself I mean something like DrawLine(point1, point2), whereas you make point1 fixed at the centre and point2 calculated by the angle that results from the given RPM (you just calculate point2Y = sin(angle) * radius and point2X = cos(angle) * radius).

However the last time I "programmed" VB was in Excel some 10 years ago, so I can't really give you any details on how to draw such lines, I just think it should be possible.

One thing you'll need for sure, no matter which way you take (image or drawing), will be a function that maps the input RPM to a specific angle. It really doesn't do more than calculate how much degrees 1 RPM is worth and then multiply this with the current RPM value. Like you want a rotation of 270° (three quarter of a circle) with a maximum of 9000 RPM, which would mean 1 RPM = 270 / 9000 = 0.03°, so at for example 5000 RPM the angle would be 5000 * 0.03 = 150°. Of course you also need to offset this value because you don't want your needle to start facing east at 0 RPM (you know, on the circle east is 0° respectively 360°, north is 90°, west is 180° and south is 270°).

I suggest you to take a look at how sin and cos work (hint), because only if you understand what you're doing you're going to be successful in the long run. It takes a bit to wrap your head around but it's really not that hard. Don't forget that you might have to convert the degrees to radians before working with the VB6 sin & cos functions, as I don't know which kind of value they expect.

In the end if you manage to get the image rotation to work AND are able to transparently overlay the image on the gauge background then this is probably the easier path, as you can skip most of the trigonometry calculations.
Thanks for answers.

First i will try burnsy1882's dll but, how I can to "pop into my program"? I don't know how to use it...
I would also see the average cost of fuel per minute, but I don't know how to link with a variable time, because I do not know time functions. Any idea?
Hi, I have tried AndroidXP method and runs, only with a little modification.

Changing this

point2Y = sin(angle) * radius
point2X = cos(angle) * radius

for
point2Y = (sin(angle) * radius) + point1y
point2X = (cos(angle) * radius) + point1x

To make a circle. And line is
Me.Line (Point1x, Point1y)-(Point2x, Point2y)

Now the problem is that the line only draw one time, and I change value of variable angle no redraw the line.... How I can to erase older line and redraw new line every X seconds?
So every time you receive an OutSim packet you're calculating point2 again and call Me.Line with the new coordinates? Maybe you have to do an Me.Cls beforehand? I really don't know, sorry.
And you're sure you're calling Me.Cls (= clearscreen) before drawing the line?
I have do in another way. Is better if I move a line than draw new lines I have working my first gauge!
Oh, I didn't know lines were actual objects that you can move. Thought it was directly drawing on the control

FGED GREDG RDFGDR GSFDG