17.3 THE SCREEN IN GRAPHICS MODE

When we want to display graphics on the screen, we have to set the screen in graphics mode. The origin in the graphics mode is in the top left corner of the screen. In our programs, we will be using VGAHI mode 2. It supports 640 pixels in the x-direction and 480 pixels in the y-direction. The x and y coordinates start from 0 and end at 639 and 479, respectively. This is shown in Figure 17.1.

 

images

 

Figure 17.1 Graphics screen

 

Please note that the origin is at the top left corner, x-axis extends towards right and y-axis extends downwards.

Let us write a simple program and study these principles.

Problem: Write ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.