/*FILE HEADER**************************************************************
 *
 *  File name		: $Id$
 *  RCS Revision Number	: $Revision: 1.1 $
 *  Last Modified	: $Date: 94/10/28 09:23:29 $
 *  CSCI name		: Real-Time Graphics System - Applications Interface
 *  CSC name		: All functions
 *  Notes:
 *      This file contains code used to debug and test the SVME-770 RTGS.
 *      This code is provided as an example of how to call the RTGS functions
 *      from a host application.
 *  History		:
 *      Created 94/01/17 by Jeff Sanderson
 *
 *END FILE HEADER*********************************************************/

#include "dy4std.h"
#include "es.h"
#include "css.h"

#include "rtgs_ai.h"
#include "video.h"
#include "colours.h"

#include "test.h"


void test_cmdlist( void );
/*-----------------------------------------------------------------------*/

void test_cmdlist( void )
{
    int    i, x, y;
    int    inc_x, inc_y;

    init( "Command list test" );

    Printf("Creating command list\n");
    Open_command_list( 0 );
    Clear_screen( BLACK, 0, 0 );

    inc_x = 0x20;
    inc_y = 0x20;
    i = 0;
    for( y = 0 ; y < RES_Y ; y += inc_y )
    {
        i++;
	for( x = 0 ; x < RES_X ; x +=  inc_x )
	{
            if( i++ & 1 )
            {
		Set_foreground_colour( RED );
            }
            else
            {
		Set_foreground_colour( BLUE );
            }
	    Draw_filled_rectangle( x, y, ( x + inc_x ), ( y + inc_y ));
	}
    }
    Close_command_list( );

    Printf("The screen should be a white grid\n");
    Key_wait();

    Printf("Running command list\n");
    Printf("Screen should be 2 colour checker board pattern\n");

    Run_command_list( 0 );

    Key_wait();

    Printf("Deleting command list\n");

    Delete_command_list( 0 );

    Key_wait();

    Printf("About to run deleted command list\n");
    Printf("this should give a command list not defined error\n\n");
    Key_wait();

    Run_command_list( 0 );
    Key_wait();
}

