Professional Documents
Culture Documents
MICRO-PROJECT REPORT
ON
“DESIGN AN ANALOG CLOCK”
Submitted in fulfillment of the requirement for the internal assessment for
the subject computer Graphics for,
[ Mr.Rohit Bangosavi ]
1
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI
Certificate
This is to certify that Mr.. VISHAL DIGAMBAR CHAVARE
Seal of Institute
2
ACKNOWLEDGEMENT
With all respect and gratitude, I would like to thank all people who have helped me directly or indirectly
for the completion of this Project work.
I thank my seminar guide for helping me to understand the project topic conceptually in every phase of
project work.
I express my heartily gratitude towards Head of department of Computer Engineering for guiding me to
understand the work conceptually and also for providing necessary information and required resources
with his constant encouragement to complete this project work.
Last but not the least, I thank to all the Teaching & Non teaching staff members of Computer
Engineering Department for providing necessary information and required resources.
I am ending this acknowledgement with deep indebtedness to my friends who have helped m
3
ABSTRACT
The project is idea to display the clock with computer graphics.
this project just used the local time,fetching from the computer and display it on thescreen.this project
implements the wall clock with the round circular boardand three conic geometric which forms the
different(sec,min &hour)hands.Here we are going to use time function to diplay time.In this project we
aregoing to get output has the current time
4
INDEX
5
CHAPTER 1
INTRODUCTION
➢OVERVIEW :
The aim of this project is to implement an application package of Computergraphics using OpenGL.
Here we represent the concepts displaying Analog clock inOpenGL.
6
CHAPTER 2
REQUIREMENT
SOFTWARE REQUIREMENT:
The project requires access to the OpenGL graphics library functions . Someof
these library functions are contained in unique to C++ library header files such as
1) GL/glut.h
2) math.h
3) windows.h
4) time.h
3. Code Blocks
HARDWARE REQUIREMENT:
The minimum/recommended hardware configuration required for developing
theproposed software is given below :
1. PENTIUM-2 and above compatible systems.
2. 128 MB RAM.
7
CHAPTER 3
IMPLEMENTATION
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
/*void drawdecor();*/
void drawclock();
void drawclogic();
void usecolor();
void main()
{
clrscr();
int gdriver=DETECT ,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bg
i");
cleardevice();
/*Clock layout and logic called in
usecolor method*/
usecolor();
getch();
closegraph();
}
/*Draw clock steps method */
void drawclock()
{
/*SIDE BORDER*/
rectangle(0,0,600,470);
rectangle(5,5,595,465);
/*CLOCK BOX*/
setcolor(25);
rectangle(145,65,500,415);
line(175,35,145,65);
line(530,35,500,65);
line(530,385,500,415);
line(175,35,530,35);
line(530,35,530,385);
line(275,60,295,40);
line(325,60,345,40);
line(275,60,325,60);
line(295,40,345,40);
/*CLOCK TITLE*/
8
setcolor(15);
rectangle(20,150,130,280);
/*gotoxy(5,5);
printf("demla \n,pramod \n,
lavina\n");*/
setcolor(10);
outtextxy(27,195,"Designed By:");
outtextxy(27,215,"demlaip");
outtextxy(27,235,"pramod");
outtextxy(27,255,"lavina");
cout<<" ";
rectangle(25,155,125,18
0);
setcolor(YELLOW);
outtextxy(27,160,"An
alog Clock");
/*CLOCK CIRCLES*/
setbkcolor(0);
setcolor(4); /*RED*/
circle(320,240,3);
setcolor(4);
/
*setfillstyle(6,13);
*/
circle(320,240,150);
circle(320,240,165);
/*CLOCK NUMBERS*/
setcolor(14);
9
outtextxy(314,98,"12
");
outtextxy(384,114,"1
");
outtextxy(434,163,"2
");
outtextxy(454,230,"3
");
outtextxy(317,369,"6
");
outtextxy(177,230,"9
");
outtextxy(436,300,"4
");
outtextxy(195,302,"8
");
outtextxy(195,163,"1
0");
outtextxy(244,112,"1
1");
outtextxy(388,353,"5
");
outtextxy(248,353,"7
");
}
/*CALCULATION Logic
of draw clock*/
10
void drawclogic()
{
float s;
float df;
float anf=3.14;
int x,y;
int q,w;
int ta,d;
int count=0;
struct time t1;
gettime(&t1);
float
angle=4.712389+t1.ti
_sec*.1047198;
float
an=4.712389+t1.ti_min*.1047198;
while(!kbhit())
setcolor(count);
rectangle(20,20,130,90);
gettime(&t1);
gotoxy(5,5);
printf("%d: %d: %d",
cout<<" ";
rectangle(25,25,125,45)
;
setcolor(YELLOW);
11
outtextxy(27,30,"Digital Time");
gotoxy(5,5);
angle=4.712389+t1.ti_sec*.1047198
;
an=4.712389+t1.ti_min*.1047198;
anf=4.712389+t1.ti_hour*5*.104719
8 ;
if(t1.ti_min>=12&&t1.ti_min<24)
{
anf=anf+2*.1047198;
}
if(t1.ti_min>=24&&t1.ti_min<36)
{
anf=anf+(3*.1047198);
}
if(t1.ti_min>=36&&t1.ti_min<48)
{
anf=anf+(4*.1047198);
}
if(t1.ti_min>=48&&t1.ti_min<60)
{
anf=anf+(5*.1047198);
}
setlinestyle(0,0,0);
setcolor(0);
line(320,240,x,y);
line(320,240,q,w);
line(320,240,ta,d);
x=320+140*cos(angle);
12
y=240+140*sin(angle);
q=320+120*cos(an);
w=240+120*sin(an);
ta=320+80*cos(anf);
d=240+80*sin(anf);
setcolor(10);
line(320,240,x,y);
setcolor(9);
line(320,240,q,w);
setcolor(4);
OUTPUT:
13
14