Another article on the Internet, "Hello World" of nano-X, is depressing ......

Source: Internet
Author: User

 

/*************************************** ************************************
* 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;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.