Fltk, as its name expresses: The Fast Light tool kit, a lightweight GUI development library. However, this lightweight feature does not mean weak functionality. On the contrary, fltk has some special features in addition to basic GUI features, for example, cross-platform, built-in OpenGL, faster speed, smaller size, and loose protocol. Of course, there are also some shortcomings, such as insufficient support for complex interface components and insufficient resource support. However, if a tool is used well, it can take its length to its short length, and naturally it will be able to take the flowers and leaves to hurt people; P
The process of selecting fltk is still twists and turns. When I first developed the GUI under arm, the selected GUI library is MiniGUI, a domestic interface library. At that time, Unix-like platforms were also supported, and Windows support was still under development. As you need to find answers to some questions, I often search on their forums to find out that there are embedded GUI development libraries such as microwindow, Nano, and qtembedded, but I didn't pay too much attention to them at the time. Later, I started to turn to the development of the wince platform, which is two years later. Later, we finally wanted to develop cross-platform development and pay attention to the cross-platform GUI development library.
The first choice was wxWidgets, but after studying it for a while, I found that there were more and more problems that could not be solved and finally gave up. The biggest headache is the transfer of C ++ class events. wxWidgets internally uses a method similar to MFC. All classes that pass events must be inherited from a root class, in this way, the created class is bound to wxWidgets, and its reusability is greatly reduced. At the same time, wxWidgets's goal is not only GUI, but also contains too many functions and its internal structure is very complicated, although it is opensource, to modify itCodeIt is still very difficult. To sum up, wxWidgets is excluded because it does not meet my requirements.
Qt, a well-established cross-platform GUI development library, many tools, and user-friendly development. qtdesign is similar to the interface development method of Delphi, and the code has a strong Linux style, however, looking at the attached library files is a bit frustrating, large-sized, and troublesome to release. So I gave up after trying it out for a while.
During this period, I have also seen some introductions to fltk, but most of them are not highly appraised, so I did not pay attention to it. It was not until a whim that I checked http: // www.fltk.org and found that fltk seemed to be interested in me, so I began to study it in depth. After a period of practical development, I personally think that for cross-platform and concise code, fltk is no longer suitable.
The bottom layer of fltk only provides a complete set of painting points and line functions, and also includes the font display function. However, fltk still provides rough support for fonts, especially for non-English character sets, I will describe it in detail later. Based on the basic dot and line functions, fltk implements a set of interfaces, such as button, label, edit, and tab, all of which are drawn by basic dot and line functions. If you see this, you may think it is really a task of your own, and it is thankless. It is true that if you only develop on one platform, this method will not bring much benefit, but will also lead to a longer learning time. However, if you want to develop data for multiple platforms, the benefits of doing so are obvious. First, it is easy to transplant. As long as the basic point-to-line function is implemented for the target platform, code can be transplanted. This may be the most convenient and direct solution in all cross-platform GUI Libraries, currently, ftlk supports platforms such as MacOS, windows, and Linux (X-window). Development of WinCE (mainly Unicode issues) and Plam is in progress. The second is to maintain the interface consistency. Although development libraries such as QT and GTK also have this function, they all need the support of a basic library and cannot optimize the system size, for fltk, this is precisely his advantage and long term. Finally, the Code has a clear hierarchy and simple structure. Because most of the work is self-Painting Based on the underlying dot-line function, a lot of code is concise and clear.
The underlying layer is a set of classes starting with fl _, representing various GUI components, such as fl_window, fl_button, and fl_input, which are easy to use. At the same time, as we have mentioned above, all the interface components are drawn. Therefore, it is easy to generate your own components after you are familiar with this method. It is actually an interface, since others can do it, you can do it too. You can't check it.Source code. The common features of these interface classes are lightweight and all have a draw (). You only need to implement your own painting actions in draw.
When it comes to the interface, you cannot ignore the event implementation method. For fltk, the most direct method is used: While (1 ){}. This is also one reason why many people criticize the original fltk. But if you think about it, this is actually the most direct method. No matter which platform you choose, the final event solution is basically endless loops and interruptions. interruptions do have many benefits, but as long as while (1) what is the relationship between these functions. Each interface class has a handle (INT event). As long as the member function is inherited, You can process your own transactions in it. Is it easy? At the same time, due to this event method, the fltk refresh speed is fast, and the event response is fast, which is also an advantage. Currently, most development libraries use the OO method for event processing, but fltk uses the original function pointer method, which is also a different type, which may be related to the Unix background of fltk, in any case, this method still requires a certain amount of time to adapt, and the advantages and disadvantages of this method also belong to the various eyes, but I still like this method very much, who calls me more primitive #-_-
Fltk is generated in the next Environment and developed in the X-Window environment. Therefore, OpenGL must be used to support graphic acceleration. Fltk uses the fl_gl_window class to include the basic functions of OpenGL. You only need to use glbegin/glend in draw () of fl_gl_window. The basic settings are all completed, my current system requirements are simply the most suitable.
Fltk is based on lgpl and has loose user requirements: Contrary to popular belief, it can be used in every cial software-even Bill Gates cocould use it! Therefore, developers do not need to worry about the invisibility of their projects. However, if we make effective corrections to fltk, we 'd better give it back to the development team. I am everyone and everyone is me.
I spoke about a bunch of good words. Now I want to talk about the shortcomings of fltk. First, non-English fonts, especially Chinese fonts, are poorly supported or even very poor. In Windows, the output string of the textout function is used, but the output string is finished in the X-Window environment, the input method cannot be called. From this point, fltk is only suitable for the development of some closed software. For general-purpose software, fltk is not a good choice. However, it is not a solution to develop Chinese software only on Windows platforms. It is not difficult to solve the problem of Chinese display. Currently, the stable version of ftlk is 1.1.7 and the development version is 2.0. the Unicode version of XX can smoothly display Chinese characters, but unfortunately I have not compiled it. If anyone has compiled it successfully, please send me a message. 2.0 non-English support has been specially developed, but there is no release yet. This problem should be completely solved in the near future. Currently, you can either wait or use dot matrix fonts like me. The specific method is not published because it is not mature enough.
In any case, the goal of fltk is to develop embedded and closed software, so complicated interfaces are not long. If you want to make a fancy and complex interface, it is better to use other GUI Libraries, fltk is not suitable.
To sum up, the advantages and disadvantages of fltk are very prominent. You can decide on your own choice.