home *** CD-ROM | disk | FTP | other *** search
- /* wrld2.cpp */
-
- #include <stdio.h>
- #include <stdlib.h>
-
- #include <typedefs.hpp>
-
- extern "C"
- {
- #include <tiga.h>
- #include <extend.h>
- }
-
- #define gspMain( n, s ) \
- cp_ret( USER_CP( gspWorld | 0 ), 2, _WORD(n), _STRING(s) )
-
- int gspWorld;
-
- int main( int argc, char argv[ ] )
- {
-
- if( set_videomode( TIGA, INIT | CLR_SCREEN ) )
- {
- if( install_primitives( ) >= 0 )
- {
- gspWorld = install_rlm( "gspWrld2.rlm" );
- if( gspWorld < 0 )
- {
- printf("ERROR: could not load gspWrld2.rlm\n");
- printf("Error code = %d\n", gspWorld );
- exit( 7 );
- }
- int ret = gspMain( 10, " H e l l o W o r l d " );
- printf( "Returned value = %d\n", ret );
- }
- 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;
- }
-
- /* gspWrld2.c */
-
-
- #include <gsptypes.h>
- #include <gspglobs.h>
- #include <gsptiga.h>
-
- #define XSIZE (config.mode.disp_hres)
- #define YSIZE (config.mode.disp_vres)
- #define XOR 10
-
- short gspMain( n, s )
- short n;
- char* s;
- {
- int tw;
- int w, h, i;
- /* Get display size */
- set_fcolor( WHITE );
- set_bcolor( BLACK );
-
- /* Center message on screen */
- tw = text_width( s );
- text_out( (XSIZE-tw)/2, YSIZE/2, s );
-
- /* Draw n surrounding boxes */
- set_ppop( XOR );
- for( i = 1; i <= n; i++ )
- {
- w = tw + (XSIZE-tw) * i / n;
- h = YSIZE * i / n;
- fill_rect( w, h, (XSIZE-w)/2, (YSIZE-h)/2 );
- }
- return (XSIZE+tw)/2;
- }
-
-
-
-
-
-
-
-
-