Jump to content
Sign in to follow this  
Guest

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

Recommended Posts

Guest

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
Guest bartels

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
Guest

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
Guest Fabio Miguez

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
Guest bartels

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
Guest Fabio Miguez

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
Guest

>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
Guest Fabio Miguez

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
Guest

>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
Guest

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
Guest

>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
Guest Fabio Miguez

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
Guest

>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
Guest

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

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...