home *** CD-ROM | disk | FTP | other *** search
-
- ==============================================================================
- Listing 1. Hello World
- ==============================================================================
-
-
- /*File:┐ D:\TIGAPGMS\HELLO\HELLO.CPP 04/21/1990 08:48:34
- *-----------------------------------------------------------------------
- *-----------------------------------------------------------------------*/
-
-
- #include <stdio.h>
-
- #include <typedefs.hpp>
- extern "C"
- {
- #include <tiga.h>
- #include <extend.h>
- }
-
-
- #define XSIZE (config.mode.disp_hres)
- #define YSIZE (config.mode.disp_vres)
- #define XOR 10
-
- CONFIG config;
-
- int main( int argc, char argv[ ] )
- {
-
- if( set_videomode( TIGA, INIT | CLR_SCREEN ) )
- {
- if( install_primitives( ) >= 0 )
- {
-
- //Get display size
- get_config( &config );
- set_fcolor( WHITE );
- set_bcolor( BLACK );
-
- //Center message on screen
- char* hello = " H e l l o W o r l d ";
- int tw = text_width( hello );
- text_out( (XSIZE-tw)/2, YSIZE/2, hello );
-
- //Draw 10 surrounding boxes
- set_ppop( XOR );
- for( int i = 1; i <= 10; i++ )
- {
- int w = tw + (XSIZE-tw) * i / 10;
- int h = YSIZE * i / 10;
- fill_rect( w, h, (XSIZE-w)/2, (YSIZE-h)/2 );
- }
- }
- else
- {
- printf( "ERROR: Can not load TIGA primitives.\n" );
- return 1;
- }
- set_videomode( PREVIOUS, NO_INIT );
- }
- else
- {
- printf( "ERROR: Please install TIGA and try again.\n" );
- return 2;
- }
- return 0;
- }
-
- ==============================================================================
-
-