Jump to content
Sign in to follow this  
Guest darrenecm

C++ basic info for MSFS

Recommended Posts

Guest iholrf

LOLYer not old enough yet for curmudgeonly.

Share this post


Link to post
Share on other sites

>LOL>>Yer not old enough yet for curmudgeonly.Actually, he is.No one really knows this... but he was the 13th disciple of Christ. Never mentioned in the Bible because of that fateful mistake of convincing ******* to wear shorts one day. Talk about Middle Eastern fashion faux paux!!!(ya know I lubs ya Bill! ;) )


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

>>>>Then only difference in all of this is the name. In other>>words, whatever name is given a variable is the best 'clue'>as>>to what the variable represents to the developer.>>Wow, I appreciate how difficult it is to break down a complex>issue and make it so even I can understand it. I applaud you.>>If I may add: And effective and verbose in-line commenting>will save your butt many a time (not to mention being>bookmarkable/highlightable in most IDE's/editors).>>Cheers>ShadI learned many years ago that 'professional' knowledge is simply knowing the 'secrets' to a job. Most of the time those 'secrets' are extremely simple in reality, yet obfuscated by professional lingo to confuse the mere 'commoner'. ;)


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Guest darrenecm

>>>>Then only difference in all of this is the name. In other>>words, whatever name is given a variable is the best 'clue'>as>>to what the variable represents to the developer.>>Wow, I appreciate how difficult it is to break down a complex>issue and make it so even I can understand it. I applaud you.>>If I may add: And effective and verbose in-line commenting>will save your butt many a time (not to mention being>bookmarkable/highlightable in most IDE's/editors).>>Cheers>ShadSo very true.If only the original gauges.h SDK file followed such sensible advice on using 'in-line' comments. I find myself regularly delving deep into the gauges.h file in order to figure out how to get at the data I need and to get my gauge DLL to 'produce' code How *I* see fit rather than how all those obscure macros see fit :)Thanks to the sterling work of Arne Bartels, Dai Griffiths and others on the fs9gauges.h alternative header file, things are bit more fathomable, but there are still large tracts of 'commentless' and cryptic parts of the header file in evidence because that's how it was originally written.Comments cost nothing in terms of program execution so I'm not sure why anyone writing code that is plainly going to be seen and used by others should not be sufficiently documented by comments.For example, I'm pouring through lots of OpenGL sample code from all over the Internet in order to get my own OpenGL drawing tricks within a gauge to the level where hardware acceleration can be easily utilised. As such, my C/C++ files are awash with green-hued slashes and explanatory text wherever I'm using concepts I've derived from these sources. As Shad points out, such verbose commentary will always save your own butt when you find yourself returning to your code at a later date to update it with new tricks.One thing I like about Visual Studio 2005 IDE is that if you mark sections of your code using a comment like the following://TODO Need to optimise this blitcopy routinethe IDE notices the TODO text and places that comment line in a helpful Task list section for you to refer to and finish off at a later date. Double clicking on the Task entries in the listing will then whiz you right on over to that section of your code so you can make your edits. I'm not sure if this same feature is in the Visual Studio .NET 2003 IDE but I find it invaluable in keeping track of my code development.That blitcopy reference reminds me. I've read posts in other forums about blitcopying sometimes being required during drawing gauges, particularly those who are bypassing the use of clunky rotating bitmaps and are insstead drawing directly to a gauge surface.I find all the C++ and GDI/GDI+ memory blitcopy routines somewhat inefficient because they all do their copying on a byte-by-byte basis. Modern CPUs are at their fastest and most efficient when dealing with 32-bits (some even 64-bits), not bytes.So I'm wondering if it's not better to 'roll your own' blitcopy routine. This would involve the use of pointers with one pointing at the start of your image source in memory and the other pointing at the destination surface. You then start copying the data from one to the other using a loop that copies entire 32-bit chunks rather than bytes as you increment the pointers.You do have to be comfortable with using 'pointer arithmetic' techniques as you increment these pointers in the loop, but it's not as bad as it sounds :)

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...