home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
c
/
cmanual.lha
/
CManual
/
Graphics.lzh
/
Graphics
/
Example4.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-01-30
|
4KB
|
121 lines
/* Example4 */
/* This program will open a normal window which is connected to the */
/* Workbench Screen. We will then print a text string whith help of */
/* Intuition's IntuiText structure. The text will be in underlined */
/* italic characters. */
/* If your program is using Intuition you should include intuition.h: */
#include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase;
/* Declare a pointer to a Window structure: */
struct Window *my_window;
/* Declare and initialize your NewWindow structure: */
struct NewWindow my_new_window=
{
40, /* LeftEdge x position of the window. */
20, /* TopEdge y positio of the window. */
400, /* Width 400 pixels wide. */
150, /* Height 150 lines high. */
0, /* DetailPen Text should be drawn with colour reg. 0 */
1, /* BlockPen Blocks should be drawn with colour reg. 1 */
NULL, /* IDCMPFlags No IDCMP flags. */
SMART_REFRESH| /* Flags Intuition should refresh the window. */
WINDOWDRAG| /* Drag gadget. */
WINDOWDEPTH| /* Depth arrange Gadgets. */
ACTIVATE, /* The window should be Active when opened. */
NULL, /* FirstGadget No Custom Gadgets. */
NULL, /* CheckMark Use Intuition's default CheckMark (v). */
"STYLE!", /* Title Title of the window. */
NULL, /* Screen Connected to the Workbench Screen. */
NULL, /* BitMap No Custom BitMap. */
0, /* MinWidth We do not need to care about these */
0, /* MinHeight since we have not supplied the window */
0, /* MaxWidth with a Sizing Gadget. */
0, /* MaxHeight */
WBENCHSCREEN /* Type Connected to the Workbench Screen. */
};
struct TextAttr my_font=
{
"topaz.font", /* Topaz font. */
TOPAZ_EIGHTY, /* 80/40 characters (high-/low-res). */
FSF_ITALIC | FSF_UNDERLINED, /* Underlined italic characters. */
FPF_ROMFONT /* Exist in ROM. */
};
UBYTE my_text[]="Nice style! Italic and Underlined!";
struct IntuiText my_intui_text=
{
1, /* FrontPen, colour register 1. */
2, /* BackPen, colour register 2. */
JAM2, /* DrawMode, draw the characters with colour 1, on a colour */
/* 2 background. (White text on a black background) */
10, 20, /* LeftEdge, TopEdge. */
&my_font, /* ITextFont, use my_font. */
my_text, /* IText, the text that will be printed. */
/* (Remember my_text = &my_text[0].) */
NULL /* NextText, no other IntuiText structures are connected. */
};
main()
{
/* Open the Intuition Library: */
IntuitionBase = (struct IntuitionBase *)
OpenLibrary( "intuition.library", 0 );
if( IntuitionBase == NULL )
exit(); /* Could NOT open the Intuition Library! */
/* We will now try to open the window: */
my_window = (struct Window *) OpenWindow( &my_new_window );
/* Have we opened the window succesfully? */
if(my_window == NULL)
{
/* Could NOT open the Window! */
/* Close the Intuition Library since we have opened it: */
CloseLibrary( IntuitionBase );
exit();
}
/* Tell Intuition to print the text: */
PrintIText( my_window->RPort, &my_intui_text, 0, 0 );
/* We have opened the window, and everything seems to be OK. */
/* Wait for 30 seconds: */
Delay( 50 * 30);
/* We should always close the windows we have opened before we leave: */
CloseWindow( my_window );
/* Close the Intuition Library since we have opened it: */
CloseLibrary( IntuitionBase );
/* THE END */
}