Jump to content
Sign in to follow this  
jcboliveira

What C++ Compilers can be used for creating Gauges?

Recommended Posts

Guest grb

Steven,Firstly, if I give an in-adequate answer, do ask it in a new thread to get a better answer.I would start to by saying, if you do not already have the MicrosoftSDK tool kit for Panel development download it. I would include the hyperline here but do not have the address on hand, ask it within a new thread for a quick response. In that SDK Tool Kit, you will find documentation as how to code a gauge file (one that ends with a ".gau"), create gauges (the visible gauge that you place into a panel), and at the end of the one document in that kit, read up on the information regarding how to create xml type gauges.Now I think I understand what your question is...............The gauges are nothing more then a dynamic object link library piece of code. In the windoze world we reference such files with an file extention called ".dll". But ...........and I am not sure at this point, since it is all new to me................I think when one compiles the source code, and gives it the options to compile as a dynamicd link library AS APPOSED TO A STANDALONE EXECUTABLE (file.exe), YOU in the compiler, ask it to call the output (compiled file) "my_gauge.gau". So in essence the my_gauge.gau file is nothing more then a non-linked object file, e.g. my_guage.obj in typicalC programming terms.Now.........I made the above statements on the fly. I two must sit down and read the SDK Panel Development documentation. I just started with all this stuff, so have limited knowledge. I had the Panel SDK on my machine for a few years but never got into this stuff, that is why I forget where I had downloaded it from at the official Microsoft Site.But I hope my explaination was at least partially adequate.

Share this post


Link to post
Share on other sites
Guest Steven007

Hi,well I have learned this year at school Java (first real programming language I learned). I think a DLL (or .gau) is something as a .jar file in the Java-world. I have read the SDK you are referring to some months ago, and I think I still have it on my pc. I'll start reading it again, maybe now some things or more clearer. The question I still have, is: is it sufficient to tell the output must be named file.gau? Probably not, and I think there should be some statements in the code that say the code forms a .gau file. I'm sure I'll find this information in the SDK. About the sonic boom gauge. It's quite interesting to hear the sonic boom. But how will the gauge be used? If it isn't possible to hear the boom inside the aircraft, then the sound may only be used in spot view or tower view. I don't know if it is actually possible to get the data to calculate the position of the viewpoint then, perhaps tower view.Anyway, I believe I have some tutorials to read :-)Thanks for the replies Arne and grb.Steven

Share this post


Link to post
Share on other sites
Guest grb

Arne,------------------------Thanks for the feedback on make. I am looking for some tutorials I created a few years ago that give some good examples of how to create and use make files (in the UNIX/Linux world) but the stuff would be applicable for anyone here just getting started with c programming.As I gather things that can help people I will create new threads on those things. I went to the Flightsimmer site as you recommended and looked for "sd2gauxx.zip as you recommended. Did not find anything. Then didsearches on "sd2*", etc. with no results. Looks like they dropped that zip file from the download dirs. But when I did a search for"sdk"................I found a zip file you authored titled sdkbug.zipwhich I downloaded to examine.----------------------------------------------Steven,Based on your last comments, It appears that you do not have a background in C programming. Therefore unless you really want to start from scratch, learn C/C++ to some degree, then learn how libraries and included Header files (file_name.h) etc., etc., areneeded to do anything in C worth while. Then I would suggest younot get to involved in this stuff. I am not trying to turn you off!I am simply making a clear statement that there is quite a bit you will have to learn about c programming and all the things that go with it that involve how one sets up a compiler etc., to make it do anything usefull, that you may become very frustrated or worse.However, if you want to learn C by all means do so. Download one of the compilers found in this thread JeanLuc, Arne, and another individual referenced, sorry other guy I only saw your name briefly in the thread ............where you suggested where to go for the mingc compiler, then start learning basic C programming. Thenas you get experienced in how to create code, and use compiler options and in the case of Window Driven Front Ends that allow youto create source, compile and link object files etc., set up resourcefiles, and projects, blah ....blah, you will reach a point whereyou can consider scratch building a guage by using the C programming language. I am saying these things to save you a lot of time at attempting to do something that is quite a bit more involved then one may think. You cannot design a gauge for use with FS2002 etc., if you are not totally familiar with compilation techniques and what libraries of files etc., go where and how they are used by the compiler AND OR the MAKE.EXE (MAKEK FILE GENERATOR) that is oftenused by programmers to create link objects and executables etc..In short, it will required a learning curve to get to the point where you can attempt to compile a source file that will create a guage,"gauge_name.gau".Lastly, as you read through the Panel SDK documentation and browse through the directories in that tool kit you will see a file called make. If you open it up with an editor you will find a statement inthat file titled "GOAL:". Then to the right of this token you will see "sdk.gua". This is the name assigned to in their case,a guage that contains a number of different gauges.In essence, this file "sdk.gua" is a dynamic link library file (dll) based on how the MAKE File tells the c compiler (in that example the compiler is called "cl" .....how to compile and link a lot of stuff including the original source file, with the end result being the "sdk.gua" piece of code............THAT is loaded into memory by the Simulator along with all the other gauge's dlls (*.gau) and other stuff that control the aircraft in the simulator.Whew. I hope you have followed the above somewhat. And I hope you can make a decision to learn C. Not for the sake of making gauges but for the endless hours of fun, it can lead you into.Sorry everyone for the rather verbose text. But I sense some folks may need at least a "hint" as what is involved in creating a gauge using the C programming language, and the SDK tool kit files that must be used in order to create a guage. The learning curve may be simply to much for many. As for XML gauges that can be used as is...perhaps there is some useful things some of us can learn how to do.I am a complete newbie to all things related to gauge development.So I will not comment further.best regards all,George

Share this post


Link to post
Share on other sites
Guest JeanLuc_

Yes a GAU file is simply a windows DLL. As with any DLL, to make it loadable / workable, you need to add a stub. With all compiler the stub is a pre compiled lib (a collection of compiled source - .OBJ files).With Borland you just need to build a makefile, than call "make" !! Here is a typical makefile file I use with all the "good" (well the ones I want) options to produce a gauge. Just type "make" to compile, "make fs" to tranfer the compile gauge to the FS gauge dir. You can add any command in th makefile! (this is just an example). NB: $(GAU_NAME)_more_res.rc is an additional ressource file. The v5.5 has a limitation for which a compiled ressource file can't exceed 1MB. So you split your ressources in different files (.rc) and add their filename in the appropriate places in the makefile.I've forgotten to add: I've first started building gauges with the LCC Win32 compiler (the one with the IDA), but I never obtained a working gauge file, so the BCC gives me plenty of satisfaction! the file editor of LCC is really good (most of the modern features are included, like function parameters while you type in a popup tooltip, fast F1 help on the Windows and C API, list of functions, bookmarks, etc....). The code produced though is far from efficient, but enough for a standard windows app. There are also licensing restrictions with LCC which are not found with BCC.Last but not least ( I preach for my choir), but if you feel ready to install and configure GNU C (and derivatives), then you'll enjoy as much BCC and it may even be simpler with BCC than with GNU C.Here is the typical makefile file:GAU_NAME=MYGAUNAMEADD_LIBS=ADD_OBJS=my_additional_object.objADD_DEPS=gauges2k2.hADD_RESS=# RTL, startup module and module definition file for the linkerrtl=IMPORT32.LIB cw32mt.lib uuid.libinit_module=c0d32x.objdeffile=gauges_bcc.defGAU_OBJS=$(GAU_NAME).obj $(ADD_OBJS)GAU_RESS=$(GAU_NAME)_more_res.res $(GAU_NAME).res $(ADD_RESS)GAU_LIBS=$(ADD_LIBS)GAU_DEPS=$(GAU_NAME).c $(GAU_NAME).h Makefile $(ADD_DEPS)RES_DEPS=$(GAU_NAME).rc $(GAU_NAME).h Makefile# the compilers and the linker with their optionsCC=bcc32CFLAGS=-O2 -w-par -q -5 -Oc -OS -Ov -tWD -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 -Oi -RT- -v- -x- -xfCPP=cpp32CPPFLAGS=-qLD=ilink32LDFLAGS=/Tpd /c /C /Gn /x /q /GprRC=brcc32RCFLAGS=# link the gauge$(GAU_NAME).gau: $(GAU_OBJS) $(GAU_LIBS) $(GAU_RESS) $(LD) $(LDFLAGS) $(init_module) $(GAU_OBJS), $@,,$(GAU_LIBS) $(rtl) ,$(deffile),$(GAU_RESS)# compile the gauge$(GAU_NAME).obj: $(GAU_DEPS) $(CC) $(CFLAGS) -c $(GAU_NAME).c# build the resource file$(GAU_NAME).res: $(RES_DEPS) $(CPP) $(CPPFLAGS) -otmp.rc $(GAU_NAME)_more_res.rc $(GAU_NAME).rc $(RC) $(RCFLAGS) -fo $(GAU_NAME).res tmp.rc del tmp.rcclean: del *.res del *.objfs: move MYGAUNAME.gau "E:FS9GAUGESmy_gauge.gau" del *.tds del *.obj

Share this post


Link to post
Share on other sites
Guest bartels

sd2gau14.zip at flightsim.com. Alternatevly search for "Dragonflight".Arne Bartels

Share this post


Link to post
Share on other sites
Guest Steven007

Thanks Georges,I know C isn't easy, certainly not for someone object oriented like me :-). In July I started to search for some tutorials on C++, but did not find anything that went much further than the Hello World example. Another thing that disturbs me is the fact that I can not find a site like http://java.sun.com where almost everything is explained that one can do with C++ without the need of coding a lot of lowlevel things myself. Guess I'll try to read some of the tutorials available here on Avsim and FlightSim.com for the flightsim stuff!Thanks guys,Steven

Share this post


Link to post
Share on other sites
Guest grb

IN ORDER FROM LATEST THREAD ENTRIES:Arne, Thanks for the feedback search for your guage file stuff.JeanLuc, Thanks for the detailed Makefile stuff. I shall examineit closely and then most probably use it. Steven, May I suggest that you get some books from your library, or school on C programming. Or try to find someone, who can give you some C user manuals etc.. Then if you are still biting.....download the free Borland Compiler package JeanLuc referenced in this thread.I assume your windoze system is set up so that you can run a DOS Window from the desktop or otherwise. You will have to be able to run DOS in a window to work with the Borland Compiler stuff.If anything. The compiler is free, and it is a good compiler. I used earlier verions both the DOS command line version as well as a very good Window driven version years back. This version is fullycompliant with W95/W98/WME/NT/W2000 ...... so all you need is tobe able to call up a DOS window from your desktop or running it fromthe START MENU/RUN window.I don't know what area of the globe you live in, but I am sure thatif you have access to book stores etc., you can find books with included CDROMs on C/C++. Think of it as a long term project. Do remember that most if not all Object Oriented Applications/programs etc., where developed using C and C++ language.The C language is really the premier language system to create objec oriented apps. Heck, Java was created using C. All your modern operating systems are created using C/C++ and sometimes associated Assembler packages. In short, C is used as the basis for much of what you see on PC, mainframes, minicomputers etc in the past twentyyears plus. As good as it is, Pascal for instance, a choice for years by Chemist for instance, simply cannot compete in the variety of ways the Cprogramming language is used. You mentioned learning Java. Well,what you picked up there will help you in C, because the syntax and contructs are similiar in both languages since Java was created using C. If you decide to go through with it. Ask me or others to direct you to sites that contain full tutorials on C/C++. There are a number of them out there. But there is nothing like having a book in front of you that you can wade through while you are attempting to write code.hang in there,George

Share this post


Link to post
Share on other sites
Guest Steven007

George, I already have the Borland compiler :-). I completely agree with what you stated in your last post :-). In a week, I'm back at my university in Leuven , Belgium(, Europe). Then I have access to the internet with my own pc, which is way easier to learn something than without it. (This pc is not mine, but my dads :-S). I'll search the library here for some books, but sites would be a lot easier. No penalties for bringing books back too late :-). So any URLs would be greatly appreciated.Thanks guys,Steven

Share this post


Link to post
Share on other sites
Guest bartels

For gauges in C it is a bit problematic to recommend any C/C++ books. Teh reasons are, it is plain C without a trace of C++ and most books are now focussing on OOP, which isn't needed for gauges. You can even say that you don't need much C knowledge actually. You can design gauges without a trace of "real" C code (functions). Most of the gauges structure is declared statically with macros, almost no dynamic code is needed. A good knowledge in C makes things a lot easier of course.Arne Bartels

Share this post


Link to post
Share on other sites
Guest Steven007

Hi,JeanLuc_: thanks for the links, the second one has made alot clear already? I'll check the other sites too!Arne: do you mean that macros from FS already provide more higher level programming for gauge coders? So there is no need to program needles,...? Thanks,Steven

Share this post


Link to post
Share on other sites
Guest bartels

There is no need to program neeedles, you just have to fill in the parameters in a MAKE_NEEDLE macro. I won't call it "high level programming" though, it's more "low level" setiing the values in a struct.Arne Bartels

Share this post


Link to post
Share on other sites
Guest JeanLuc_

To shed some light: a gauge is just an ordered and link list of data structures. Each data structure represents an element in the gauge SDK (a bitmap, a moving bitmap, a rotating bitmap - used for needles - etc...). Each data structure provides a way to either make FS read automatically a parameter to change the element behavior (a IAS speed to rotate the IAS needle element), or to let the developper define its own variable callback (a function which is called by FS when it is time to update the variable used by the element for its display). But in its most simple form, a gauge is just a collection of data, in a DLL file.With this in mind, the gauge SDK is a collection of defines and macros, to help the developper defining and laying out these elements in the ordered list. You will notice a very close similarity in the way you lay out a XML gauge and a C gauge. The structures are the same to a large extent.When does programming in C is really needed? when you are building more complex gauges requiring more than the basic variable lookup system. This is where you usually start to use, in addition to the element callbacks the main gauge callback as well (generaly to execute globaly applicable computations, could be checking the state of a switch, triggering a global var, than each element in the gauge list will reuse to react accordingly).Hope this helps!

Share this post


Link to post
Share on other sites
Guest grb

Steven,Just a thought. You mentioned you are attending a University...best luck in completing your goals there. Now.....the school will have a Information Systems Department (computer section). What would prevent you from talking to people in that group and asking if they can lend you (long term) some books on C programming. You may even find some books that are Borland specific which detail how Borland Compiler's versions of the MAKE.exe operate (e.i. what type arguments you feed the make program). In short it would appear that you will have little problem once you have your own system set with Borland compiler package installed. I assume you have a commercial version of Borland with an Interface Development Enviroment(IDE) system such as most Borland, Microsoft, others, companies have sold over the years. Therefore you really are not even concerned with learning details of Make etc., just use the IDE windows system to create source, compile, link etc..And as Arne and JeanLuc make clear above..........one does not require much C programming language experience to get on-board.It is only needed, to develope totally new gauge element structures etc.. and then create dll's to run some specific simulator action.Lasty. I will make no further comments as it appears you know what has to be done. best regards all,George

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