









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION ZEAL EDUCATION SOCIETY’S
Academic year: 2021-
Program: Computer Engineering Program code: CO - 1 Course: Computer Graphics Course code: 22318
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
This is to certify that Mr. /Ms. Rohan kumar Bhoi Roll No: - 04 of 3rd^ Semester of Diploma in Computer Engineering of Institute, Zeal Polytechnic (Code: 0988) has completed the Micro Project satisfactorily in Subject - CGR 22318 for the academic year 2021 - 2022 as prescribed in the curriculum. Place: Pune Enrollment No: 2009880295 Date: ------------------------- Exam. Seat No: 143814 Subject Teacher Head of the Department Principal
iNDeX SR. NO. CONTENT PAGE NO. 1 PROJECT ABSTRACT^5 2 MAIN CONTENT 6 3 CONCLUSION 13 4 WEEKLY PROJECT REPORT 14 5 EVALUATION SHEET^15
Are you thinking to create a game? If yes, then you may need to move and control an object using arrow keys. For example, if you are going to create pacman game. In that case you have to control the pacman with the help of arrow keys. In this tutorial I will tell you the easiest way to do this. I have written this tutorial hoping that you already have knowledge of c/c++ graphics. If you don’t have any idea about graphics then it will be very difficult for you to understand this tutorial. Here we will use concept of ASCII codes. Below I have written a simple program in graphics using Dev C++ & turbo c++. In this program a circle is moved and controlled using arrow keys. So just take a look at the code.
Introduction Of Header Files: - #include <stdio.h> stdio.h is a header file which has the necessary information to include the input/output related functions in our program. Example printf, scanf etc. If we want to use printf or scanf function in our program, we should include the stdio. #include <graphics.h> The graphics.h header file provides access to a simple graphics library that makes it possible to draw lines, rectangles, ovals, arcs, polygons, images, and strings on a graphical window. The second step is initializing the graphics drivers on the computer using initgraph method of graphics. #include <process.h> process.h is a header file which includes macros and declarations. These are especially used during work with thread and processes. There is no standard for process.h functions. They depend on compiler which we use.
#include <dos.h> dos.h is a header file of c language. This library has functions that are used for handling interrupts, producing sound, date and time functions, etc. It is Borland specific and works in compilers like Turbo C Compiler. #include <conio.h> conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output. It stands for console input output header file. It is used for following g functions: clrscr, getch, delline, getche, kbhit, gotoxy, wherex, wherey, textcolor, textbackground.
Code for upward movement of the object Initially the circle is moving upward, suppose upward arrow key is pressed then 72 (ASCII value of upward arrow key) is stored in ch and values of x and y become 0 and -3 respectively. Now value of j decreased by three and i remains as it is, this makes the circle to move by one coordinate in y direction. This process is repeated again and again till any other arrow key is pressed. Code for Left movement of the object Initially the circle is moving left, suppose left arrow key is pressed then 75 (ASCII value of left arrow key) is stored in ch and values of x and y become -3 and 0 respectively. Now value of i decreased by three and j remains as it is, this makes the circle to move by one coordinate in x direction. This process is repeated again and again till any other arrow key is pressed. ( Ch = 72 ) 72 is the ASCII value of the Upward Arrow Key (Ch = 75) 75 is the ASCII value of the left Arrow Key
Code for Right movement of the object Initially the circle is moving Right, suppose Right arrow key is pressed then 77 (ASCII value of left arrow key) is stored in ch and values of x and y become 3 and 0 respectively. Now value of i increased by three and j remains as it is, this makes the circle to move by one coordinate in x direction. This process is repeated again and again till any other arrow key is pressed. Code for Downward movement of the object Initially the circle is moving Downward, suppose Down arrow key is pressed then 80 (ASCII value of downward arrow key) is stored in ch and values of x and y become 0 and 3 respectively. Now value of j increased by three and i remains as it is, this makes the circle to move by one coordinate in y direction. This process is repeated again and again till any other arrow key is pressed. (Ch = 77) 77 is the ASCII value of the Right Arrow Key (Ch = 80) 80 is the ASCII value of the Right Arrow Key
In this project we write a code to move the ball by using the arrow keys in C Programing. We used some function of kbhit () to get the ch of arrow keys & escape key. After the coding we Run the code in Turbo C++ & saw the output of the coding. And finally, our code will runed successfully without any error.
SR. NO. WEEK ACTIVITY PERFORMED SIGN OF GUIDE DATE (^1 1) st Discussion and finalization of topic (^2 4) th Preparation and submission of Abstract (^3 5) th Literature Review 4 6 th Collection of Data 5 7 th Collection of Data 6 8 th Discussion and outline of Content 7 9 th Formulation of Content 8 10 th Editing and proof Reading of Content 9 11 th Compilation of Report And Presentation 10 12 th Seminar 11 13 th Viva 12 14 th Final submission of Micro Project Sign of the student Sign of the faculty