Sign in to follow this  
Guest Fabio Miguez

Vector gauge programming

Recommended Posts

It's been a while since I did any proper gauge/module coding.(FS98 days ... )What is the best way to code vector based gauges?DirectDraw?I saw someone mention GDI+ - is that the new/better way of drawing vector gauges?Are there any tutorials/samples somewhere that will save me some headaches?ThanksPaul

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hey Paul,XML is the easier language, C is the harder to learn, more powerful language (plus much harder for someone to see the code).In C, GDI+ is probably your best bet, although I have only tried GDI as another option. Between the two, I pick GDI+ any day of the week and twice on Sundays. GDI+ is faster, offers antialiasing without slowing down (GREAT asset), gradient brushes, and an alpha value for any color (so anything can be semi-transparent). It is also much more straight forward to use than GDI as far as pens and brushes.By the way, what Jan is doing in that post is mostly just stripping away things from the stock GPS, not sure he is using XML to draw new vectors, although he may for the range rings. I have heard, but not seen, that there is new technology in XML that allows vectors (have not seen because it seems the stock GPS actually calls C funcitons to draw the vectors). But apparently there is no antialiasing for XML, and that, believe me, makes all the difference.No tutorials, it seems, although you can get a file here at AVSIM by Fred Clausen on how to startup GDI+ in your C code, and learn pretty much everything about GDI+ at MSDN at http://msdn.microsoft.com/library/en-us/gd...lus/GDIPlus.asp

Share this post


Link to post
Share on other sites

Thanks Fabio, that's what I was looking for.XML is not powerful enough for what I want to do so C++ is what I'll be using.Also my gauge code needs to be hidden even though it will be freeware.It's for competition flying and I don't want people to be able to hack it easily and cheat in the competitions.Paul

Share this post


Link to post
Share on other sites

Hi,Between accolades, in the "new" xml you can draw very easily rectangles, circles, lines, polygons, polylines etc. and let them move, shift and rotate with the "old" commands.All those figures you can fill with colors and outline them with others etc.And that is what i do. A lot of fun (rebuilding my gauges); many bitmaps can be replaced that way and things look definitely more real.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Yes, there definately is an advantage to using the new XML gauges but can they play sounds, do file/disk IO, socket comms, inter-process comms, data encryption, etc?Some things have to be done the "hard" way. :)Paul

Share this post


Link to post
Share on other sites

Hey Jan,Ah, excellent, so it is possible to do thise in XML, very good! This should allow future developments in this area to be very exciting!Thanks for the info,

Share this post


Link to post
Share on other sites

Hey Paul,I sent you an e-mail through the Avsim e-mail system, see if you got it.

Share this post


Link to post
Share on other sites

Jan,In playing with vector gauges in XML, have you discovered if there is any way to circumvent the anti-aliasing against the scenery? With bitmaps (and so far in playing with vectors) I always get anti-aliased artifacts when trying to simulate a HUD. This includes text which is over 18 point. Anything drawn aganst the sky and then rotated looks horrible, with darker colored artifacts around the edges.Also, In looking at the GPS commands used, I see Polyline, Rectangle and Polygon commands. Is there one for a regular line and/or a circle? If so, do you know what the parameters look like?Thanks--Jon

Share this post


Link to post
Share on other sites

Hi,No experience with HUD etc.Gives a line at point x=-10, 7 pixels long.Gives a circle with radius of 75 pixels.You can add the commands:Backgroundcolor="#......" or Fillincolor="0x......"etc. etc.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Ah, that's great. I should be bale to do lots of interesting things those. I guess there's no way to prevent FS9 from anti-aliasing bitmaps and vectors against the outside world, so I'll just have to try and adjust the colors depending on the time of day...Thanks again, Jan--Jon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this