/*************************************** ************************************
* Filename: Hello. c
* Begin: 2010.5.25
* Project: Hello nano-x world
* Version: 1.0
* Copyright: GPL V2.0
* Author: uunubt
* Description:
**************************************** ***********************************/
# Include <stdio. h>
# Include "nano-X.h"
# Include "nxcolors. H"
Int main ()
{
Gr_window_id root_wid, WID;
Gr_gc_id GC;
Gr_coord X, Y;
Gr_size width, height;
Gr_event event;
X = 0;
Y = 0;
Length = 640;
Height = 480;
If (gropen () <0)
{
Printf ("can't open graphics/N ");
Return 0;
}
GC = grnewgc ();
// Create a parent window (root window)
Root_wid = grnewwindow (gr_root_window_id, X, Y, width, height,
1, gr_color_royalblue, gr_color_black );
// Create a subwindow
WID = grnewwindow (root_wid, 60, 60,200, 60, 1, gr_color_black, gr_color_white );
Grmapwindow (root_wid); // draw the parent window
Grmapwindow (WID); // draw a subwindow
// Text displayed in the parent window
Grsetgcforeground (GC, gr_color_red); // foreground color (font color)
Grsetgcbackground (GC, gr_color_green); // background color (font background color)
Grtext (root_wid, GC, 10, 20, "hello in root_wid",-1, gr_tfbottom );
// Text displayed in the subwindow
Grsetgcforeground (GC, gr_color_red); // foreground color (font color)
Grsetgcbackground (GC, gr_color_green); // background color (font background color)
Grtext (WID, GC, 10, 20, "hello in wid",-1, gr_tfbottom );
For (;;)
{
Grgetnextevent (& event );
}
Grclose ();
Return 1;
}