1. |
Microwindows, also known as nano-X, is a lightweight GUI system. Because it is open-source and free, and supports Chinese, it is often used in embedded devices that need to display graphical interfaces. I will not talk about the Introduction to Microsoft Windows, and many can be found on Google. This article mainly introduces how to download a Microwindows program from the Internet, compile it, and then write your own "Hello World" program using microwindos. Note: This section only describes Microwindows running on a PC, rather than cross-compiling embedded environments. Here (www.microwindows.org) is the official website of Microwindows, which has not been updated for many years, but the application of Microwindows has not weakened. |
3. |
Modify several files:
File arch. Rules |
21 rows: Compiler = gcc Change Compiler = gcc32Because the default GCC version of Fedora 5 is 4.1.0, the syntax check is too strict, and Microwindows compilation will fail. If the default GCC version on your release is also 4. for Version X, replace it with 3. in Version X, replace the above "gcc32" with your GCC on Linux 3. the name of Version X. If not, you may have to install it on your own. Use GCC 4. X cannot be compiled, but because the Microwindows code is too old to be compatible with the new compiler, compilation may produce some errors. You can modify the source code according to the error prompt or compile the code, it is a little troublesome. I will not detail it here. |
Row 3: Link_app_into_server = N Change Link_app_into_server = y |
Modify the config file |
Row 3: Have_cmd_support = y Change Have_cmd_support = N Because my computer does not have the/usr/lib/libjpeg. A file, compilation will fail. If you have this file, You can try not to modify the above line to see if it can be compiled. This allows Microwindows to support JPEG files. |
Row 3: X11 = N Change X11 = y Modify this configuration so that Microsoft Windows uses the X11 mouse and keyboard driver |
|
4. |
Compile Microwindows: Run the make command in the microwindows-0.90/src directory for compilation:
If there is no accident, the compilation will be successful. If there is still an error, it may be that the file is missing in your Linux environment. You can modify the config file according to the error message. Run the demo program in the bin directory to check whether the compilation is successful. The mine program is a mine clearance game that comes with Microsoft Windows, which is the same as that in windows. Run the following command:
If you can see the game interface in, it indicates that you have compiled it. Congratulations !!
|
6. |
1 /************************************** ************************************* 2 * filename: Hello. c 3 * begin: 16:24:44 4 * Project: Hello nano-x world 5 * version: 1.0 6 * copyright: GPL V2.0 7 * Author: Wu Yin 8 * description: 9 *************************************** ************************************/ 10 # include <stdio. h> 11 # include "nano-X.h" 12 # include "nxcolors. H" 13 14IntMain () 15 { 16Gr_window_idRoot_wid, WID; 17Gr_gc_idGC; 18Gr_coordX, Y; 19Gr_sizeWidth, height; 20Gr_eventEvent; 21 22 x = 0; 23 y = 0; 24 width = 640; 25 Height = 480; 26 27If(Gropen () <0) 28 { 29 printf ("can't open graphics/N "); 30Return0; 31} 32 33 GC = grnewgc (); 34 // create a parent window (root window) 35 root_wid = grnewwindow (gr_root_window_id, X, Y, width, height, 36 1, gr_color_royalblue, gr_color_black ); 37 // create a subwindow 38 WID = grnewwindow (root_wid, 60, 60,200, 60, 1, gr_color_black, gr_color_white ); 39 grmapwindow (root_wid); // draw the parent window 40 grmapwindow (WID); // draw a subwindow 41 42 // text displayed in the parent window 43 grsetgcforeground (GC, gr_color_red); // foreground color (font color) 44 grsetgcbackground (GC, gr_color_green); // background color (font background color) 45 grtext (root_wid, GC, 10, 20, "hello in root_wid",-1, gr_tfbottom ); 46 47 // text displayed in the subwindow 48 grsetgcforeground (GC, gr_color_red); // foreground color (font color) 49 grsetgcbackground (GC, gr_color_green); // background color (font background color) 50 grtext (WID, GC, 10, 20, "hello in wid",-1, gr_tfbottom ); 51 52For(;;) 53 { 54 grgetnextevent (& event ); 55} 56 grclose (); 57 58Return1; 59} 60
|