|
From: Jason H. <jas...@bt...> - 2001-11-01 01:16:49
|
Because direct draw deals with the graphics memory at such a low level = it really depends upon what display mode you are in. In 8bpp (bits per = pixel) there is one byte per pixel. 2 for 16bpp, 3 for 24 bpp, and 4 for = 32bpp. Using that information you need to figure out the memory address = of the particular pixel you want to draw to, which in turn depends upon = the width and height of the window or screen you are drawing too. The = basic formula is: graphics_mem + x*bytespp + y*width where graphics_mem is a byte pointer (unsigned char) to the first = location in the memory for the graphics area, bytespp is bytes per pixel = (1, 2, 3, or 4), and width is the number of bytes to one horizontal line = of the display (specifically the pitch). x and y are the cooridinates of = the pixel you want to draw to. i.e. graphics_mem[x*bytespp + y*pitch] =3D colour_value; I have been learning all this from Windows Game Programming for Dummies, = which is getting old now, but is a good book to learn about Direct Draw = from (IMO). If all you need is basic graphics capabilities in a window = then you should look into the Windows GDI or alternativly if you are = familiar with the BGI graphics interface then there is a version = available for use with Dev-C++ (MinGW), goto = http://www.cs.colorado.edu/~main/bgi/ for more information. If you want any more info I'll try to help, Jason. ----- Original Message -----=20 From: Christiaan Scholtz=20 To: dev...@li...=20 Sent: Wednesday, October 31, 2001 8:09 PM Subject: [Dev-C++] Drawing lines How do you put a pixel on the screen? |