MyRedz -3 Light Poster

here's my question

Make a function void ScreenSaver(Screen& Shape* shps[]) 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 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.

and here's my coding.
i am unstuck on how to do random animate.
from animation.cpp i got transx,transy,transxy,transpxny.
but now i dunno how to use the ScreenSaver(Screen& Shape* shps[]) which it wants to pass shapes into which is in this case i made a house..and what to do inside the void ScreenSaver(Screen& Shape* shps[])? the escape function i declared inside the void screensaver earlier alreadi.

#include <allegro.h>
#include "House.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[]);
int main(){
Screen scr(*BLACK, XRES,YRES); //Initialize screen
//Color* backCol = scr.getBg(); //create a variable to store background color
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);
h->draw(scr);
ScreenSaver(scr& House*h[]);
///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
//scr.refresh();
//scr.wait(6000); //wait for 6 seconds
//can also use system("pause") here instead;
return 0;

} 
void ScreenSaver(Screen& House*h[])
{

int i;
while(!key[KEY_ESC]){//loop until user presses Esc key

clear_keybuf();
rest(10);
for(i=0;i<i-1;i++)
{
i++;
TransX( scr, h, h, i,3,1);
}

return (0);
}
END_OF_MAIN();

()

#include <allegro.h>
#include "House.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[]);
int main(){
Screen scr(*BLACK, XRES,YRES); //Initialize screen
//Color* backCol = scr.getBg(); //create a variable to store background color
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);
h->draw(scr);
ScreenSaver(scr& House*h[]);
///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
//scr.refresh();
//scr.wait(6000); //wait for 6 seconds
//can also use system("pause") here instead;
return 0;

} 
void ScreenSaver(Screen& House*h[])
{

int i;
while(!key[KEY_ESC]){//loop until user presses Esc key

clear_keybuf();
rest(10);
for(i=0;i<i-1;i++)
{
i++;
TransX( scr, h, h, i,3,1);
}

return (0);
}
END_OF_MAIN();

()

#include <allegro.h>
#include "House.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[]);
int main(){
Screen scr(*BLACK, XRES,YRES); //Initialize screen
//Color* backCol = scr.getBg(); //create a variable to store background color
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);
h->draw(scr);
ScreenSaver(scr& House*h[]);
///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
//scr.refresh();
//scr.wait(6000); //wait for 6 seconds
//can also use system("pause") here instead;
return 0;

} 
void ScreenSaver(Screen& House*h[])
{

int i;
while(!key[KEY_ESC]){//loop until user presses Esc key

clear_keybuf();
rest(10);
for(i=0;i<i-1;i++)
{
i++;
TransX( scr, h, h, i,3,1);
}

return (0);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.