Arcade Games:
![[ LDA Games ]](ldaoldimages/header/buttons/LDAgames.gif)
![[ High Scores ]](ldaoldimages/header/buttons/HighScores.gif)
Shopping:
![[ Welcome to our Store ]](ldaoldimages/header/buttons/LDAstore_shifting.gif)
General Info:
![[ LDA News ]](ldaoldimages/header/buttons/LDANews.gif)
![[ About Us ]](ldaoldimages/header/buttons/AboutLDA.gif)
![[ Support ]](ldaoldimages/header/buttons/TechSupport.gif)
More LDA:
![[ TreadMarks.com ]](ldaoldimages/header/buttons/TreadMarks.gif)
![[ Tigers Bane ]](ldaoldimages/header/buttons/TigersBane.gif)
![[ Children's Books ]](ldaoldimages/header/buttons/ChildrensBooks.gif)
![[ Particle Fire ]](ldaoldimages/header/buttons/ParticleFire.gif)
Cool Stuff:
![[ Seumas' Programming ]](ldaoldimages/header/buttons/SeumasProgramming.gif)
![[ Wendy's Art ]](ldaoldimages/header/buttons/WendyArt.gif)
Other:
![[ Forums ]](ldaoldimages/header/buttons/Forums.gif)
Copyright © 1998-2003,
Longbow Digital Arts.
|
Fast graphics under Windows:
Lots of books have been written on this subject. The bottom line for 2D
graphics is to use CreateDIBSection() (consult your handy dandy Windows
development environment documentation) and friends for windowed or otherwise
very system-friendly fast graphics, and DirectDraw for fast full screen graphics
where you get to dictate the color mode (8-bit, 16-bit, 32-bit, etc.).
The trick to CreateDIBSection() is that to actually get your bitmap to the
screen, you have to jump through a few hoops. First you have to use CreateCompatibleDC()
to create a Device Context to blit from (think of it as just a hunk of program
that knows how to move pixels), SelectObject() your HBITMAP into it, then obtain the
DC for your destination window, and use BitBlt() to blit from the created DC to the
window's DC.
DirectDraw is pretty straight forward if all you want is a linear full screen
framebuffer to manually throw pixels at (that's all I usually use, for compatability
with as much hardware as possible). First buy a good book on DirectDraw. Then
create a DirectDraw object, switch to Exclusive mode, change the screen mode to
whatever you like, acquire the DDSurface object for the Primary surface, create an
Off-Screen System Memory surface of the same size and bit depth to be your Back
Buffer, then every frame Lock the Back Buffer surface, compose your graphics there
in system memory, Unlock the surface, and do a DirectDraw Blit from the off-screen
surface to the Primary surface. This works for a lot of things, and gives you the
advantage of being able to quickly read pixels back from your back buffer (to do
alpha-blending, additive-blending, burn effects, etc.), as reading pixels from a
Video Memory surface is SLOW, and dangerous. To get more speed in certian styles
of games, you can use Dirty Rectangle updating to only blit the changed parts of
the back buffer to the visible primary surface (DX-Ball 2 uses this technique).
New! July 17th, 1999: Check out the
BackBuffer Page for some free source code that
handles DirectDraw, CreateDIBSection, and even OpenGL windows!
Back
Comments? Questions? Know of a good programming page?
Send me email!
Copyright 1998-1999 by Seumas McNally.
No reproduction may be made without the author's written consent.
|