Sign in to follow this  
Guest

"animation in C" - or, "Guess who's stuck again?"

Recommended Posts

Once again, my ignorance rears its ugly head and I am stuck... I have 5 icon images of a pitch trim wheel I need to animate. In XML, it is quite easy to accomplish by use of this formula: (A:Elevator Trim Position,radians) 1000 * int 10000 + 3 % This returns a sequence of integer "values" from 0 to 5 and allows the .bmp files to sequentially display in "forward" or "reverse" motion. How can I "translate" this into a C function? I'm totally clueless, since EG insists that the token variable "ELEVATOR_TRIM" may only be used "...in an instrument gauge." What the heck am I making, chopped liver???BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


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

I'm not used to easygauge to be honest, but in C forcing an integer is casting with "(int)value" (or floor(value) or ceil(value)), and the modulao for integers is also "%", for floats fmod(value,divider). If that helps, I don't know. Also for MAKE_ICONs it's possible to use ICON_SWITCH_TYPE_SET_CUR_USING_RANGE together with proper range pparmas to avoid the need to convert to fixed integers, a modulo is still needed in your case.Arne Bartels

Share this post


Link to post
Share on other sites

I was rather sure the operands were the same, but the mechanics of working "inside the box" with EG is difficult' an irony to be sure... :(I also need to convert a Rankine ITT to celcius. The formula is quite easy, but again it's the durn mechanics that're eluding me:

Share this post


Link to post
Share on other sites

Hey BillFor the temperature conversion, just use one of the several conversions MS has already supplied us in the gauges.h Check out Line 4398 for the macro RANKINE_TO_CELSIUS( rankine ), where rankine is your temperature in

Share this post


Link to post
Share on other sites

Actually, I believe it was Arne who added those in to the header file. The one straight from MS doesn't include those conversions.Matt

Share this post


Link to post
Share on other sites

AFAIK EG uses my gauges.h so the macros can be available there.Arne Bartels

Share this post


Link to post
Share on other sites

HA!Wouldn't you know it??? Sorry about that, Arne, I had no idea you had included those!!! Well, I should've known better. MS trying to help us? Nahhhh, too good to be true...

Share this post


Link to post
Share on other sites

>Hey Bill>>For the temperature conversion, just use one of the several>conversions MS has already supplied us in the gauges.h Check>out Line 4398 for the macro RANKINE_TO_CELSIUS( rankine ),>where rankine is your temperature in

Share this post


Link to post
Share on other sites

Hey Bill.SO I am assuming there is no access to the actual code when using EG?

Share this post


Link to post
Share on other sites

>SO I am assuming there is no access to the actual code when>using EG?Actually, there is... by simply hand-editing the gaugenameG.c file output by EG, one can easily add or modify the actual program instructions, and then recompile it outside the EG environment. After all, it is - strictly speaking - a C source file! :)Of course, the downside is that the very next time you run EG again to make any changes to the gauge, all those mods would have to be re-entered, since there's no way to incorporate them into EG's 'master source file' stored in its own, unique .esk format.BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

Hi Bill and others,you can edit the *.c file in the source folder and add all the things you need.Every detail I add makes the program more difficult. I have to find a balance between usability and functionality. EG has a lot of possibilities - just have a look at Lonny Payne's 757 panel which is completely made with EG - even a small moving map is included. Of course, if you want to develop an FMC, EasyGauge is definately the wrong program - so have a look C++.I appreciate the suggestions and I will include a "makro" editor into the next version.King Regards,Marcel Burrchief programming departement (PC12, EasyGauge)bluesky software development

Share this post


Link to post
Share on other sites

>Hi Bill and others,>>you can edit the *.c file in the source folder and add all the>things you need.>>Every detail I add makes the program more difficult. I have to>find a balance between usability and functionality. EG has a>lot of possibilities - just have a look at Lonny Payne's 757>panel which is completely made with EG - even a small moving>map is included. I think you've done a marvelous job with EG, Marcell! I also understand the limitations you face regarding a proper "balance between usability and functionality."Perhaps if more people would post sample .esk files it would help a lot! I know that whenever I manage to achieve animating the pitch trim wheel I'll most certainly publish the .esk on the support site! :)Now I just wish someone would write a similar WYSIWYG environment for XML coding, especially since FS2004 is exclusively XML gauging... :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

Bill, just a correction.FS2004 is exclusevily XML only on the stock gauges. C and C++ will remain far superior than XML for more complex gauges, so my guess is you will continue to see most dvelopers, particularly commerical ones (also for security reasons), use these languages for gauges.And Marcel, I have not used EG, but I hear wonderful things about it!

Share this post


Link to post
Share on other sites

>Bill, just a correction.>>FS2004 is exclusevily XML only on the stock gauges. C and C++>will remain far superior than XML for more complex gauges, so>my guess is you will continue to see most dvelopers,>particularly commerical ones (also for security reasons), use>these languages for gauges.It would be nice if MS would redo the .CAB to make it password protected, just for the sake of security. Now that would be a truly useful utility for someone to make! :) I have no real problem with folks using any of the XML gauges made for freeware release, but there should be a way to protect the intellectual rights of commercial developers.Of course FS2004 will continue to support C type gauges. They have to maintain backward compatibility! I didn't mean to imply otherwise... :)EG is a lot like a new pair of shoes: it will simply take time to get 'broken in' and comfortable. For basic layout and mouse area definition, it is fantastic! As Marcell pointed out, with the "Programmer's Edition" it is possible to work outside the EG environment and add to or modify the .c file as needed.I am extremely pleased with it so far!BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

Hi Bill,I cannot really believe that XML will support GDI functions. Can you prove it or did you only hear this from "somewhere"?Only one small thing, Bill: my name is written without a second "l", only Marcel ;-)No problem so far, enjoy gauge programming!King Reagards,Marcel Burrbluesky

Share this post


Link to post
Share on other sites

>I cannot really believe that XML will support GDI functions.>Can you prove it or did you only hear this from "somewhere"?>>Only one small thing, Bill: my name is written without a>second "l", only Marcel ;-)I should think that the lack of .gau files in the gauges folder is a pretty good indication of the gauge types used. This was reported by a number of folks with press copies.BTW, I finally managed to lick the animation problem I was having, due in no small part to your replies in the support forum... :)Once I got off my duff and started thinking like a programmer again, I went back to square one and penciled out a flowchart of the problem on real paper. :)I should be ashamed of myself for violating the most basic "rule" I hammered into all of my students in the freshman "Intro. to Computing" classes at UF, Gainesville many years ago:"If you cannot solve the problem yourself with pencil, paper and your own intelligence, do not expect become a programmer, much less pass this class!"To further reinforce this dictum, none of the students were allowed to touch a keypunch machine or the mainframe until they'd solved this problem:"At its most basic level, a computer only 'knows' one mathematical operation, viz. either addition or subtraction. All other math operations depend on machine level programs that define the processes. For this excercise, I will allow you to assume that the four basic operators are present: addition, subtraction, multiplication and division; in addition, you may assume that the three comparative operators are available: greater than, less than and equals.Outline the steps necessary and flowchart the process needed to derive the square root of any positive integer to six decimal places using the minimum number of discrete steps."A few of the students would have a workable solution within hours. Most of them took at least a week, and a few never managed to solve the problem at all, but wound up dropping the class to take up something less intellectually challenging... :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

Hi, Bill.>It would be nice if MS would redo the .CAB to make it password protected, just for the sake of security

Share this post


Link to post
Share on other sites

>Hi Bill,>>I cannot really believe that XML will support GDI functions.>Can you prove it or did you only hear this from "somewhere"?Hi again, Marcel <= note only one "L" this time! :)I suspect that MSFS is now using a variant of VML - Vector Markup Language, which is a superset of XML itself. Remember when I said that XML and LISP shared the characteristics of "self-definition?" Most people are completely unaware that HTML is simply another superset of XML. :)As far as API interaction, it is a simple matter to utilize the SAX (Simple API for XML), which again is a superset of XML: a "module" of code that allows for access to all WIN APIs. Of course, SAX has been ported into multiple languages, including C, and C++ among others. It was originally written to support Java based XML web applications to facilitate realtime document/data I/O.For more information and specifications for VML, see: http://msdn.microsoft.com/workshop/author/.../data/vmlom.aspFor more information about practicing safe SAX, see:http://www.saxproject.org/BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

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