SlideShare a Scribd company logo
Graphics and Mouse Programming
in Turbo C
Graphics in Turbo C
1
Header file for Graphics Functions
graphics.h header file is included which contain
functions to draw different shapes, display text in
different fonts, change colors, etc.
 initgraph(); Used to initialize graphics mode.
Syntax: void initgraph ( int *driver, int *mode, char *path);
Initializing Graphical mode
 graphresult(); It returns error code if occur in initializing
graphics.
Syntax: int graphresult (void);
 grapherrormsg(); It returns corresponding error message
of error code.
Syntax: char grapherrormsg (int errorcode);
 outtext(); Used to print string in graphic mode at
current position.
Syntax: void outtext (char textstring);
Displaying Text on screen
 outtextxy(); Used to print string in graphic mode at
given coordinates.
Syntax: void outtextxy (int x, int y, char textstring);
Y axis
X axis
 setcolor(); It sets the color of lines.
Syntax: void setcolor (int COLOR);
Coloring
 setbkcolor(); It sets the background color of screen.
Syntax: void setbkcolor (int COLOR);
Table of Colors
COLOR Name Value
BLACK 0
BLUE 1
GREEN 2
CYAN 3
RED 4
MAGENTA 5
BROWN 6
LIGHTGRAY 7
DARKGRAY 8
LIGHTBLUE 9
LIGHTGREEN 10
LIGHTCYAN 11
LIGHTRED 12
LIGHTMAGENTA 13
YELLOW 14
WHITE 15
COLOR Name Value
 rectangle(); It draws an empty rectangle.
Syntax: void rectangle (int x, int y, int x+width, int y+height );
Drawing empty/solid Rectangles
 bar();
It draws a filled rectangle.Syntax: void bar (int x, int y, int x+width, int y+height );
It draws a filled rectangle.
 setfillstyle(); It sets current fill pattern and fill color.
Syntax: void setfillstyle (int fillpattern, int COLOR);
Fill styling
Fill Patterns:
 setlinestyle(); It sets current style of lines.
Syntax: void setlinestyle (int linestyle, unsigned upattern, int thickness);
Line styling
Line Styles:
 cleardevice(); It erases the screen and move CP to origin.
Syntax: void cleardevice (void);
Some more functions
 closegraph();
Syntax: void closegraph (void);
It closes the graphics mode and returns
the screen to text mode.
Mouse Programming in Turbo C
2
Mouse Programming
Mouse programming in C is done by interacting
with registers and interrupts. dos.h also include
functions for Mouse Programming.
 Interrupt: Signal sent by a hardware for immediate
processing is known as interrupt.
Interacting with interrupts
 Register: Small data holding place of Processor.
 int86();
Syntax: int int86 (int interrupt, union REGS *inreg, union REGS *outreg);
This function is used to interact with
interrupts using registers.
The interrupt for Mouse is: 0x33
Union Data Type
union is a special data type in C which allows to
store different data types in the same memory
location.
Example:
union Data {
int I; float f;
} data;
 First Parameter of int86() function is 0x33 to interact with Mouse.
 Second Parameter is address of a union REGS type integer which is
used to input data for interrupt.
 Third Parameter is also address of a union REGS type integer in
which output by interrupt is stored.
 Both union REGS type variables are declared before main()
function. Like:
Using int86();
union REGS input, output;
 ax, bx, cx and dx register are used to input and output data.
 Syntax to input and out data from registers is:
Using int86();
// To send data to register
input.x.ax = 0;
int86( 0x33, &input, &output);
// Now output.x.ax is storing out from interrupt
Input Description Output
AX = 0 Get mouse
status
If AX = 0, Mouse
support isn’t
available
AX = 1
Show Mouse
Pointer
__
AX = 3 Get cursor
position
CX = X axis,
DX = Y axis
AX = 3 Which Mouse
button is pressed
BX = 0  No
BX = 1  Left
BX = 2  Right
Turbo C Graphics and Mouse Programming

More Related Content

What's hot

Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.
Nishan Barot
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arraysAseelhalees
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
Vinod Kumar
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
Nithin Kumar,VVCE, Mysuru
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
Akhilesh Maithani
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
Dipta Saha
 
DATABASE MANAGEMENT SYSTEM LAB.pdf
DATABASE MANAGEMENT SYSTEM LAB.pdfDATABASE MANAGEMENT SYSTEM LAB.pdf
DATABASE MANAGEMENT SYSTEM LAB.pdf
Prof. Dr. K. Adisesha
 
Chapter 1 : Balagurusamy_ Programming ANsI in C
Chapter 1  :  Balagurusamy_ Programming ANsI in C Chapter 1  :  Balagurusamy_ Programming ANsI in C
Chapter 1 : Balagurusamy_ Programming ANsI in C
BUBT
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
javaTpoint s
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
SHAKOOR AB
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
Timbal Mayank
 
Exception Handling
Exception HandlingException Handling
Exception Handling
Sunil OS
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket Programming
Vipin Yadav
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
Kandarp Tiwari
 
Java - Sockets
Java - SocketsJava - Sockets
Java - Sockets
Riccardo Cardin
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
AkhilaaReddy
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
topu93
 

What's hot (20)

Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
DATABASE MANAGEMENT SYSTEM LAB.pdf
DATABASE MANAGEMENT SYSTEM LAB.pdfDATABASE MANAGEMENT SYSTEM LAB.pdf
DATABASE MANAGEMENT SYSTEM LAB.pdf
 
Chapter 1 : Balagurusamy_ Programming ANsI in C
Chapter 1  :  Balagurusamy_ Programming ANsI in C Chapter 1  :  Balagurusamy_ Programming ANsI in C
Chapter 1 : Balagurusamy_ Programming ANsI in C
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket Programming
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Java - Sockets
Java - SocketsJava - Sockets
Java - Sockets
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Computer Graphics - clipping
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
Cpp reference card
Cpp reference cardCpp reference card
Cpp reference card
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 

Similar to Turbo C Graphics and Mouse Programming

OpenGL 4.4 Reference Card
OpenGL 4.4 Reference CardOpenGL 4.4 Reference Card
OpenGL 4.4 Reference Card
The Khronos Group Inc.
 
Opengl4 quick reference card
Opengl4 quick reference cardOpengl4 quick reference card
Opengl4 quick reference cardAdrien Wattez
 
Hooking signals and dumping the callstack
Hooking signals and dumping the callstackHooking signals and dumping the callstack
Hooking signals and dumping the callstack
Thierry Gayet
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
kparthjadhav
 
C Programming Language
C Programming LanguageC Programming Language
C Programming Language
RTS Tech
 
OpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference GuideOpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference Guide
The Khronos Group Inc.
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
Haripritha
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
PVS-Studio
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
Andrey Karpov
 
Managing I/O in c++
Managing I/O in c++Managing I/O in c++
Managing I/O in c++
Pranali Chaudhari
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
shafiq sangi
 
Embedded C - Lecture 2
Embedded C - Lecture 2Embedded C - Lecture 2
Embedded C - Lecture 2
Mohamed Abdallah
 
c.ppt
c.pptc.ppt
C programming session 01
C programming session 01C programming session 01
C programming session 01Dushmanta Nath
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in cgkgaur1987
 

Similar to Turbo C Graphics and Mouse Programming (20)

OpenGL ES 3.1 Reference Card
OpenGL ES 3.1 Reference CardOpenGL ES 3.1 Reference Card
OpenGL ES 3.1 Reference Card
 
OpenGL 4.4 Reference Card
OpenGL 4.4 Reference CardOpenGL 4.4 Reference Card
OpenGL 4.4 Reference Card
 
Opengl4 quick reference card
Opengl4 quick reference cardOpengl4 quick reference card
Opengl4 quick reference card
 
Hooking signals and dumping the callstack
Hooking signals and dumping the callstackHooking signals and dumping the callstack
Hooking signals and dumping the callstack
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
C Programming Language
C Programming LanguageC Programming Language
C Programming Language
 
OpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference GuideOpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference Guide
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Advanced+pointers
Advanced+pointersAdvanced+pointers
Advanced+pointers
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Managing I/O in c++
Managing I/O in c++Managing I/O in c++
Managing I/O in c++
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
Embedded C - Lecture 2
Embedded C - Lecture 2Embedded C - Lecture 2
Embedded C - Lecture 2
 
c.ppt
c.pptc.ppt
c.ppt
 
7512635.ppt
7512635.ppt7512635.ppt
7512635.ppt
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 

Recently uploaded

Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 

Recently uploaded (20)

Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 

Turbo C Graphics and Mouse Programming

  • 1. Graphics and Mouse Programming in Turbo C
  • 3. Header file for Graphics Functions graphics.h header file is included which contain functions to draw different shapes, display text in different fonts, change colors, etc.
  • 4.  initgraph(); Used to initialize graphics mode. Syntax: void initgraph ( int *driver, int *mode, char *path); Initializing Graphical mode  graphresult(); It returns error code if occur in initializing graphics. Syntax: int graphresult (void);  grapherrormsg(); It returns corresponding error message of error code. Syntax: char grapherrormsg (int errorcode);
  • 5.  outtext(); Used to print string in graphic mode at current position. Syntax: void outtext (char textstring); Displaying Text on screen  outtextxy(); Used to print string in graphic mode at given coordinates. Syntax: void outtextxy (int x, int y, char textstring);
  • 6.
  • 8.  setcolor(); It sets the color of lines. Syntax: void setcolor (int COLOR); Coloring  setbkcolor(); It sets the background color of screen. Syntax: void setbkcolor (int COLOR);
  • 9. Table of Colors COLOR Name Value BLACK 0 BLUE 1 GREEN 2 CYAN 3 RED 4 MAGENTA 5 BROWN 6 LIGHTGRAY 7 DARKGRAY 8 LIGHTBLUE 9 LIGHTGREEN 10 LIGHTCYAN 11 LIGHTRED 12 LIGHTMAGENTA 13 YELLOW 14 WHITE 15 COLOR Name Value
  • 10.  rectangle(); It draws an empty rectangle. Syntax: void rectangle (int x, int y, int x+width, int y+height ); Drawing empty/solid Rectangles  bar(); It draws a filled rectangle.Syntax: void bar (int x, int y, int x+width, int y+height ); It draws a filled rectangle.
  • 11.  setfillstyle(); It sets current fill pattern and fill color. Syntax: void setfillstyle (int fillpattern, int COLOR); Fill styling Fill Patterns:
  • 12.  setlinestyle(); It sets current style of lines. Syntax: void setlinestyle (int linestyle, unsigned upattern, int thickness); Line styling Line Styles:
  • 13.  cleardevice(); It erases the screen and move CP to origin. Syntax: void cleardevice (void); Some more functions  closegraph(); Syntax: void closegraph (void); It closes the graphics mode and returns the screen to text mode.
  • 14. Mouse Programming in Turbo C 2
  • 15. Mouse Programming Mouse programming in C is done by interacting with registers and interrupts. dos.h also include functions for Mouse Programming.
  • 16.  Interrupt: Signal sent by a hardware for immediate processing is known as interrupt. Interacting with interrupts  Register: Small data holding place of Processor.  int86(); Syntax: int int86 (int interrupt, union REGS *inreg, union REGS *outreg); This function is used to interact with interrupts using registers. The interrupt for Mouse is: 0x33
  • 17. Union Data Type union is a special data type in C which allows to store different data types in the same memory location. Example: union Data { int I; float f; } data;
  • 18.  First Parameter of int86() function is 0x33 to interact with Mouse.  Second Parameter is address of a union REGS type integer which is used to input data for interrupt.  Third Parameter is also address of a union REGS type integer in which output by interrupt is stored.  Both union REGS type variables are declared before main() function. Like: Using int86(); union REGS input, output;
  • 19.  ax, bx, cx and dx register are used to input and output data.  Syntax to input and out data from registers is: Using int86(); // To send data to register input.x.ax = 0; int86( 0x33, &input, &output); // Now output.x.ax is storing out from interrupt
  • 20. Input Description Output AX = 0 Get mouse status If AX = 0, Mouse support isn’t available AX = 1 Show Mouse Pointer __ AX = 3 Get cursor position CX = X axis, DX = Y axis AX = 3 Which Mouse button is pressed BX = 0  No BX = 1  Left BX = 2  Right