hi i am stuck at this question it asks me to do something like random animation and escape key..
here's the question
Make a function void ScreenSaver(Screen& Shape* shps[], Shape* masks[]) in which you take an array of shape pointers and their masks, and randomly animate all these shapes. You are required to pass only the shapes you made before (car) and animate them, you need not worry about shapes colliding or overdrawing each other. The screen saver should keep going until the user presses the escape key.
here's my original coding..
Code:
 #include <allegro.h>
#include "House.h"
#include "Animation.h"
#include "ExampleColors.h"
#include "HelperFunctions.h"

//----Set Screen Resolution
ust XRES = 1024; 
ust YRES = 600;
//----Set house center-------
Point* houseCenter = new Point(900,450);

//---Make 2 homes-------------
House* h = new House(houseCenter, new Point(150,150), WHITE, BLUE, 30,30,15,15);
//--------------------------

int main(){
	Screen scr(*BLACK, XRES,YRES);  //Initialize screen
	Color* backCol = scr.getBg(); //create a variable to store background color

	h->draw(scr);
	scr.refresh();
	scr.wait(6000); 
///TransX( scr, h, h, -100,3,1);//moving house in x direction for -100 value
//TransXY( scr, h, h, -100,3,1)///moving house in x and y direction
//TransY( scr, h, h, -100,3,1)//moving house in y direction
//TransPXNY( scr, h, h, -100,3,1)//move house in +x and-y direction//wait for 6 seconds
	//can also use system("pause") here instead;
    return 0;
    
}   

END_OF_MAIN();
this coding works perfectly but i dont understand how to do the escape sequence and random animation.
the shapes is suppose to move randomly i guess whether it is x direction,y direction or both.
so the coding for escape output from keyboard is something
like this
Code:
int main()
{
  allegro_init();//Allegro initialization
  install_keyboard();//Set up for keyboard input

  //Set the graphics mode to a 320x240-pixel window.
  set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320,240,0,0);
 
  while(!key[KEY_ESC]){//loop until user presses Esc key
    rest(10);//Give up the cpu for ten milliseconds.
  }//end while loop

  return 0;//Return 0 to indicate a successful run.
}//end main function
then why do i got error when i want to implement escape in this
is the code when doing it like this and not working..?i know c++ but making game in allegro is different to me..
Code:
#include <allegro.h>
#include "House.h"
#include "Animation.h"
#include "ExampleColors.h"
#include "HelperFunctions.h"

//----Set Screen Resolution
ust XRES = 1024; 
ust YRES = 600;
//----Set house center-------
Point* houseCenter = new Point(900,450);

//---Make 2 homes-------------
House* h = new House(houseCenter, new Point(150,150), WHITE, BLUE, 30,30,15,15);
//--------------------------
void ScreenSaver(Screen& Shape* shps[], Shape* masks[]);
int main(){

	Screen scr(*BLACK, XRES,YRES);  //Initialize screen
	Color* backCol = scr.getBg();//create a variable to store background color
	
	
//uffer = create_bitmap(XRES, YRES); 

	h->draw(scr);
		
	ScreenSaver(scr& House* h[]) 

scr.refresh();
	scr.wait(6000); //wait for 6 seconds
	
	//can also use system("pause") here instead;
    return 0;
    
}   
void ScreenSaver(Screen scr& House* h[]) 
{


	allegro_init();
    install_keyboard();
   set_gfx_mode( GFX_AUTODETECT_WINDOWED, XRES, YRES, 0, 0);
    
	set_window_title("ECE1211 Project");
	while(!key[KEY_ESC]){//loop until user presses Esc key

    clear_keybuf();//clear old stuff from the buffer
	
	TransX(scr,h,h,-100,1,1);
    rest(10);//Give up the cpu for ten milliseconds.
  }//end while loop

  
}//end void function

	

END_OF_MAIN();