You are on page 1of 10

Pragramme Name : Computer Engineering Academic Year : 2022-2023

Program Code : CO3I

Course Name : Computer Graphics Using C (CGR) Semester : III


Course Code : 22318

A STUDY ON

Aeroplane Crash Using Computer Graphics.

MICRO PROJECT REPORT


Submitted in Dec 2022 by the group of 5 students
Sr. Enrollment Exam Seat
Roll No Full name of Student
No No No
1 30 Chaitali Ankush Ingale 2100590077
2 34 Tanmay Sanjay Jirekar 2100590081
3 56 Mirza Ibrahim 2100590106
4 60 Rohit Narendra More 2100590110
5 61 Soham Rajendra More 2100590111

Under the Guidance


of Prof.Mansi
Manikhedkar
in
Three Years Diploma Programme in Engineering & Technology of
Maharashtra StateBoard of Technical Education, Mumbai (Autonomous)
ISO 9001: 2008 (ISO/IEC-27001:2013)
at
0059 - Shri Shivaji Vidya Prasarak Sanstha’s
Bapusaheb Shivajirao Deore Polytechnic,Vidyanagari, Deopur, Dhule-424005.
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI

Certificate
This is to certify that ,
Sr. Enrollment Exam Seat
Roll No Full name of Student
No No No
1 30 Chaitali Ankush Ingale 2100590077
2 34 Tanmay Sanjay Jirekar 2100590081
3 56 Mirza Ibrahim 2100590106
4 60 Rohit Narendra More 2100590110
5 61 Soham Rajendra More 2100590111

students of Third Semester, Diploma Programme in Engineering &

Technology at 0059 - Shri Shivaji Vidya Prasarak Sanstha’s Bapusaheb

Shivajirao Deore Polytechnic- Dhule, has completed the Micro Project

satisfactorily in Subject Computer Graphics Using C (CGR) (22318) in the

academic year 2022-2023 as prescribed in the MSBTE curriculum of I Scheme.

Place: Dhule
Date : / / 2022

Project Guide Head of the Department Principal

Seal of
Institute
Part A : Project Proposal

1.0 Introduction:

• Graphics provides one of the most natural means of communicating with a computer,
since our highly developed 2D Or 3D pattern-recognition abilities allow us to
perceive and process pictorial data rapidly.

• Computers have become a powerful medium for the rapid and economical
Production of pictures.

• Graphics provide a so natural means of communicating with the computer


that they have become widespread.

• Interactive graphics is the most important means of producing pictures since


The invention of photography and television .

• We can make pictures of not only the real world objects but also of abstract
Objects such as mathematical surfaces on 4D and of data that have no
inherent geometry

2.0 Aim of the Topic. :-

• The aim of this project is to create an interesting and creative game using tools
like OpenGL and C++ (g++ compiler). Apart from the gameplay, this project
also deals with providing a beautiful graphical interface between the user
and the system.

• In this game, the main objective is to guide the Pacman


through a world full of danger before you get eaten alive! A user also
has the ability to choose the world of his choices.

• A system is put into place to maintain the score of the user. This will enable
the user to keep track of the high scores of the player.

3.0 Course Outcome:

The theory, practical experiences and relevant soft skills associated with this course are to be taught
and implemented, so that the student demonstrates the following industry oriented COs associated with
the above mentioned competency:
a. Manipulate visual and geometric information of images.
b. Implement standard algorithms to draw various graphics objects using C program.
c. Develop programs for 2-D and 3-D Transformations.
d. Use projections to visualize objects on view plane.
e. Implement various clipping algorithms.
f. Develop programs to create curves using algorithms.

Part B : Project Report


1.0 Summary :

The aim of this project is to create an interesting and creative game using tools
like OpenGL and C++ (g++ compiler). Apart from the gameplay, this project
also deals with providing a beautiful graphical interface between the user
and the system

2.0 Course Action Address :

3.0 Actual Methodology :

A. Algorithm :
#Algorithm for the Source Code :-

Step 1 : start
Step 2: Declare variables gd=DETECT, gd,gm.
Step 3 : Read values gd ,gm ,i.
Step 4 :Display plane body.
setcolor(10)
rectangle(150+i,100,170+i,130)
ellipse(150+i,115,90,270,127,15)
ellipse(116+i,104,10,170,24,12)

Step 5 : Display plane wings.


setcolor(14)
line(120+i,120,70+i,166)
line(90+i,120,60+i,160)
ellipse(77+i,160,180,250,16,8)
line(120+i,93,89+i,62)
line(96+i,101,76+i,62)
line(76+i,63,89+i,62)
Step 6 :Display plane tail.
setcolor(11)
line(30+i,80,50+i,110)
line(10+i,85,30+i,120)
line(10+i,85,30+i,80)
setcolor(14)
rectangle(170+i,110,175+i,120)
Step 7 : if(i%2==0)
{
setcolor(11);
ellipse (178+i,96,0,360,3,18);
}
else
{
setcolor(11);
ellipse(178+i,136,0,360,3,18);
}
Step 8 :stop.

B. Flow Chart :
# Flow Chart for the Source Code :-

C. Source Code :
#include "header.h"

SDL_Rect cor={24,25};
int quit=no;

SDL_Surface *load_image( char filename[] )


{
//Temporary storage for the image that's loaded
SDL_Surface* loadedImage = NULL;

//The optimized image that will be used


SDL_Surface* optimizedImage = NULL;
//Load the image
char file[]="sprites/";
strcat(file,filename);

loadedImage = IMG_Load( file);


//If nothing went wrong in loading the image
if( loadedImage != NULL )
{
//Create an optimized image
optimizedImage = SDL_DisplayFormat( loadedImage );

//Free the old image


SDL_FreeSurface( loadedImage );
}
//Return the optimized image
return optimizedImage;
}

int main(int argc, char *argv[])


{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface* screen;
screen=SDL_SetVideoMode(500,350,32,SDL_SWSURFACE);
SDL_Surface* bg=load_image("dark.jpg");
int key_press;
SDL_WM_SetIcon(IMG_Load("pacman_16X16.png"), NULL);
SDL_WM_SetCaption("Pacman","pacman_16X16.png");

SDL_Event event;
extern int quit;

SDL_BlitSurface(bg,NULL,screen,NULL);
// build_map(screen);
gameplay(screen);

return 0;
}

void pacman_sprites(SDL_Rect location,int direction,SDL_Surface* screen,char comp[20]


[12])
{
SDL_Rect char_up,char_down,char_left,char_right,char_neutral,char_dead;
//definition of sprites
char_up.x=0; char_up.y=20; char_up.w=20; char_up.h=20;
char_down.x=20; char_down.y=20; char_down.w=20; char_down.h=20;
char_left.x=20; char_left.y=0; char_left.w=20; char_left.h=20;
char_right.x=40; char_right.y=0; char_right.w=20; char_right.h=20;
char_neutral.x=0; char_neutral.y=0; char_neutral.w=20; char_neutral.h=20;
char_dead.x=40; char_dead.y=20; char_dead.w=20; char_dead.h=20;
// end def of sprites
SDL_Surface *one,*two;
one=load_image("pacman.gif");
two=load_image("pacman_follow.gif");

if (legibility(comp,&direction)==yes)
{
moveit(direction); // it just changes the co-ordinates.....doesnt animate sprites
switch(direction)
{
case SDLK_UP:
SDL_BlitSurface(one,&char_up,screen,&location);
SDL_Flip(screen);
break;
case SDLK_DOWN:
SDL_BlitSurface(one,&char_down,screen,&location);
SDL_Flip(screen);
break;
case SDLK_RIGHT:
SDL_BlitSurface(one,&char_right,screen,&location);
SDL_Flip(screen);
break;
case SDLK_LEFT:
SDL_BlitSurface(one,&char_left,screen,&location);
SDL_Flip(screen);
break;
}

SDL_Delay(75);
SDL_BlitSurface(one,&char_neutral,screen,&location);
SDL_Flip(screen);

SDL_Delay(75);
SDL_BlitSurface(two,NULL,screen,&location);
SDL_Flip(screen);
}
else
{
//SDL_Delay(1000);
SDL_BlitSurface(one,&char_neutral,screen,&location);
SDL_Flip(screen);
}

SDL_FreeSurface(one);
SDL_FreeSurface(two);

void gameplay(SDL_Surface* screen)


{

extern int quit;


char comp[20][12];
extern SDL_Rect cor;
SDL_Event event;
int key_press;

createmap(screen,comp);

while (quit==no)
{
while(SDL_PollEvent(&event))
{

if(event.type==SDL_QUIT) quit=yes;
if (event.type==SDL_KEYDOWN) key_press=event.key.keysym.sym;
}

pacman_sprites(cor,key_press,screen,comp);

}
}

4.0 Micro Project Output :


5.0 Actual resources used :

 Visual Studios for coding.


 G++ compiler.
 Google for Reference.

6.0 Skills developed :

 We developed the skill of Research.


 We developed the skill of Coding.
 We developed the skills of Debugging.
 We learn how to solve a problem.

7.0 Application of Micro project :

 To Create a controllable game in future.

You might also like