0% found this document useful (0 votes)
293 views10 pages

C++ Starfield Screensaver Guide

This document summarizes a student project to create a star field screensaver in C++. The project will display moving stars on the screen to simulate a star field. It will use graphics functions like putpixel() and circle() to plot individual stars and render a moon. The screensaver will include different star field patterns and animations over multiple frames to produce a relaxing visual effect. The source code provided implements loops and graphics calls to generate and display the star field animation on screen.

Uploaded by

Abhishek Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views10 pages

C++ Starfield Screensaver Guide

This document summarizes a student project to create a star field screensaver in C++. The project will display moving stars on the screen to simulate a star field. It will use graphics functions like putpixel() and circle() to plot individual stars and render a moon. The screensaver will include different star field patterns and animations over multiple frames to produce a relaxing visual effect. The source code provided implements loops and graphics calls to generate and display the star field animation on screen.

Uploaded by

Abhishek Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Name : ABHISHEK KUMAR

Regd. No. : 11104802

Section : D1R02A09

Submitted to : Mansi Rana

Name of project :
“Simulate Star field Screensaver”

Duration :
1.5 to 2 months

Hardware Requirement :
512MB RAM or more than , dual core processor 1.6 GHz or more than, graphics up to
512MB or more than, HDD space 2MB, visual display device like monitor.

Software Requirement :
Windows XP or latest version of windows, Turbo C++ compiler, DirectX.

Project Description :
This project is related to animation or graphics. This is used in computer for relax the mind
of user or hide the information from other person when user not works on that system from
long time.

In this I also managed all types of things in good pattern. I want to create many frames and
each and every frame has some picture and all frames are come after one another and show
like an animated screen saver.

For this purpose I use C++ compiler and graphics.h header file.

In this project ,I want to display many moving stars. I also want to show some night scenes.
In this project I also show moon with many stars.
For these things, I use many graphics related functions. Like:

For plotting stars I use putpixel()

For moon use circle()

Or many other types of function for different purposes like line(), sefillstyle(), floodfill() etc.

I also use loops in this project.

Project Scope :
To set the screen saver in computer, to set as wallpaper in computer, for used in animated
movie, cartoon or etc. used in movies. Used in games.

Source code :
#include<iostream.h>

#include<conio.h>

#include<graphics.h>

#include<dos.h>

void main()

clrscr();

int gd=DETECT,gm,x=0,y=0,i,j,xx,yy,k;

initgraph(&gd,&gm,"..//bgi");

putpixel(10,20,WHITE);

xx=getmaxx();

yy=getmaxy();

for(k=0;k<=xx;k++)

for(i=0;i<=xx;i=i+10)

{
if(x==0)

for(j=60;j<=yy;j=j+28)

putpixel(i,j,WHITE);

x++;

else if(x==1)

for(j=10;j<yy;j=j+37)

putpixel(i,j,WHITE);

x++;

else if(x==2)

for(j=50;j<yy;j=j+49)

putpixel(i,j,WHITE);

x++;

else if(x==3)

for(j=20;j<yy;j=j+50)

putpixel(i,j,WHITE);

x++;

else if(x==4)

{
for(j=40;j<yy;j=j+61)

putpixel(i,j,WHITE);

x++;

else if(x==5)

for(j=30;j<yy;j=j+72)

putpixel(i,j,WHITE);

x++;

else

for(j=0;j<yy;j=j+83)

putpixel(i,j,WHITE);

x=0;

if(y==0)

circle(0+k,50,40);

setfillstyle(1,WHITE);

floodfill(0+k-39,50,WHITE);

floodfill(0+k+39,50,WHITE);

delay(200);

else if(y==1)
{

setcolor(RED);

ellipse(50+k-405,300,90,270,20,10);

line(50+k-405,290,300+k-405,260);

ellipse(300+k-405,300,20,90,100,40);

ellipse(395+k-405,300,270,90,10,13);

line(50+k-405,310,300+k-405,330);

ellipse(300+k-405,300,270,340,105,30);

ellipse(300+k-405,274,270,340,100,30);

line(50+k-405,300,300+k-405,305);

line(320+k-405,260,230+k-405,180);

line(255+k-405,265,180+k-405,190);

line(230+k-405,180,180+k-405,190);

line(320+k-405,310,230+k-405,400);

line(255+k-405,315,180+k-405,400);

line(230+k-405,400,180+k-405,400);

line(40+k-405,290,25+k-405,230);

line(25+k-405,230,50+k-405,230);

line(50+k-405,230,110+k-405,283);

setfillstyle(1,BLACK);

floodfill(48+k-405,300,RED);

floodfill(395+k-405,300,RED);

floodfill(298+k-405,300,RED);

floodfill(300+k-405,255,RED);

floodfill(290+k-405,330,RED);
floodfill(100+k-405,283,RED);

setcolor(WHITE);

delay(50);

else

break;

if(k==xx&&y==0)

y=y+1;

k=0;

if(k==xx&&y==1)

y=y+1;

k=0;

if(k==xx&&y==2)

k=0;

y=0;

if(k==xx)

{
k=0;

cleardevice();

getch();

Snap-Shot :

You might also like