/* * Hello2 * ------ * A version of the "Hello world" program which centers the * text in a window. * * The newwindow function creates a window, and setredraw associates * a redraw call-back function with the window. The show function * then causes the window to appear on screen. * * The call-back draw_window is passed the window and the * window's rectangle as parameters. It calls drawtext to * draw the words "Hello world" centered horizontally and vertically * inside that rectangle. */ #include void draw_window(window w, rect r) { drawtext(r, Center + VCenter, "Hello world"); } void main(void) { window w; w = newwindow("Hello World Window", rect(50,50,200,150), StandardWindow); setredraw(w, draw_window); show(w); mainloop(); }