FS-GUI Library


FS-GUI Library is a set of classes and functions that I developed for building graphical user interface of YS Flight Simulator and YSFLIGHT Scenery Editor.  It provides with menus, dialogs, as well as 3D viewing control.

Honestly, I am sick and tired of writing separate user-interface code for MacOSX, Linux, and Windows.  At first, full functionality of YSFLIGHT was available only on the Windows platform, and YSFLIGHT for Mac and Linux were just a sub-set.  But, the future of Windows is clouded, and I don't want to sink YSFLIGHT with Windows, and wanted to make full functionality of YSFLIGHT available on Mac and Linux as well.  However, writing user-interface for three separate platforms were daunting task, and it was absolutely impossible for a single programmer to do during spare time.

I thought about Qt.  But, the future of Qt is uncertain after Nokia bugged out.  I made a decision on not to use Qt long before Nokia's retreat, but I think I made a right decision.

I kept YSFLIGHT not depend on huge external libraries.  If I use a small external library, it's not a big deal if the library is discontinued.  I should be able to find another one, or write by myself.  But, if YSFLIGHT depends on a huge library, and one day someone says "We decided to discontinue this library.  I wish you the best of luck.  Good bye!", I would need to make a huge change.

Especially, I can only spend my spare time (when I am not working, not bowling, not flying, not going to an air show, and not bird-watching) for YSFLIGHT development.  Such a loss of a huge library would be the end of YSFLIGHT.

So, I kept YSFLIGHT's dependency absolutely minimum.  That's why I am able to keep developing.

One day, I heard from one of my friends that every widget of MacOSX is drawn with OpenGL.  He was apparently wrong.  Nonetheless, I realized that, I can write my own user-interface library that depends only on OpenGL plus minimum set of IO functions.  Then I started writing my own user-interface library.  Because I have total control, as long as I continue development, I can use it  :-)

That has been the concept of FS-GUI library.  Basically, if you want to port this library to something else, you can port fssimplewindow library, which takes care of single-window, mouse and keyboard input.  That's sufficient for minimum functionality.

If you want to have some nicer-looking font, you may want to write your own yssystemfont library implementation.  Also ysport library for some additional functionality.  (Maybe file-dialog as well)

And, I decided to open it so that someone else who has the same problem can use.

Actually, I wanted to at least make a sample DNM viewer, but I haven't been able to do so yet.  Hopefully by the next update.

About Copyright

I keep the copyright of the files included in the package.  However, you can use this library for your own product, regardless of free or commercial, proprietary or open source, if you agree to take all responsibility on the consequence of using any contents included in the library package and I will not take any responsibility.  If you disagree, please do not use YS-Class library.  There is no string attached.  Use of this class library will NEVER obligate you to disclose your source code.

The files under import directory are downloaded from opengl.org, and are free to re-distribute.


So far, the sample application template has been tested on Windows (Visual C++ 2010 Express) and Linux (Ubuntu 11).  Of course, YSFLIGHT and Scenery Editor works on MacOSX, Linux, and Windows.  The library should work on all these platforms.  I simply haven't have time to prepare makefile for MacOSX yet.  I'll do so hopefully by the next update.

To build a sample template project, go to Visual C++ Command Prompt, and

cd (extracted directory)\fsgui3dframework\fsgui3d\template
nmake /f makefile.win

You will get an executable, if things go well.  (2013/03/21 Correction: Looks like in some cases nmake -f doesn't work.  I haven't figured when it does and does not accept "-f".)  You can run from makefile by typing

nmake /f makefile.win run

By default, this will try to create files under C:\include, C:\lib, and C:\tmp\obj , but if you want to save intermediate files in different locations, set the following three environment variables.


If you want to build in Visual Studio, probably you can dump all of the source files (just be careful not to add files for Linux or MacOSX) and should be able to build.  But, the IDE is bad.  People all over the world are wasting several hours once every two years, when Microsoft changes Visual Studio or Apple changes XCode.  I wonder how many thousands of hours wasted just for getting used to the new environment.  Huge work time is wasted once every two years.  People pay for the new version, and then lose substantial work time just for getting used to it.

Actually, not only Microsoft, but also Apple and Linux people don't understand that users don't want new interface.  Tablet interface may be an exception because multi-touch tablets are relatively new device.  But, there is no reason that the user interface of Office needs to change so often.  Why menus and dialogs of Visual Studio and XCode have to change?  I remembered every short-cut key of Word XP and Power Point XP while I was writing my Ph.D thesis.  Many of those short-cut keys didn't work in Office 2003.  Now Office 2010 forces me to click on big icons that don't make sense and taking up precious pixels.  Text labels are better.  Most of those icons don't make sense to me.  I can understand English words.  I am really tired of the nonsense icons on the failed ribbon interface.  I am thinking to use Latex again for the first time since 1996(!) because Microsoft Office is becoming less and less efficient.  Today, I tried to transfer some MP3 files to my wife's iPad.  I haven't used iTunes for a while, and I was confused by the totally new interface of new iTunes.  It took several minutes until I found the place to upload MP3s.  Why do they make the user frown?  Of course they lose customers because they are making customers unhappy.  They simply don't get it.

That's an off topoic.  In Linux and MacOSX, you can compile the template project by:

cd (extracted directory)/fsgui3dframework/fsgui3d/template
make -f makefile.unx

It should work.  You can run it by typing:

make -f makefile.unx run

In Linux, you need to install GCC, X-Window, and GLX libraries. 

In MacOSX, I have tested with XCode 3.2.6, but if you are using XCode 4.x.x, you need to also install command line tools, which you can download from Apple Developer.  I hope that's all you need to compile this.  But, Objective-C is a problem.  Apparently Apple is changing some language specification and older Objective-C code may not be compiled in the newer version GCC.  Objective-C is not well designed and Apple needs to make ad-hoc modifications to the language specification.    Objective-C is inferior to C++ in many ways, and this is one of the reasons.  It's very unfortunate MacOSX and iOS requires such an inferior language.

Default View Control

By default, you can press SHIFT key and left-button drag to scroll (or translate), right-button drag to rotate, and both left+right button drag to zoom and mooz (or unzoom).  Or, you can turn on translate button or scroll button on the view-control dialog and left-drag.  Also zoom and mooz buttons are avaialble on the view-control dialog.

Sample Program - YSFLIGHT DNM Viewer

This program is a viewer of the standard YSFLIGHT 3D model data format (.DNM).  Due to time constraints, I just upload screenshots here.  To compile, you can go down to (download location)/ysdnmview/src and make.  Hope I can add more explanations later.


[Click Here!]  (2013/03/30 R1971)

Old Versions

[2013/03/03 R1882]

Where to begin?

I wish I could include a DNM viewer as a sample program, but couldn't get it done.  I'm going to update this library soon.  Stay tuned!

Update Information

2013/03/30 R1971

  • Added example "Ysflight DNM Viewer"
  • Added View-Control dialog.
  • Fixed build.  It didn't build in a bare Windows 7 environment, but now it should.
  • Set up build for MacOSX.