implementing a computer game using directx - union university

9
Brad Bell - Union University Implementing a Computer Game Using

Upload: others

Post on 09-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Brad Bell - Union University

Implementing a Computer Game Using

What is DirectX?

An Application Programming Interface(API) that provides low level access to multimedia hardware in a device independent manner

Hardware Abstraction Layer (HAL)

Hardware Emulation Layer (HEL)

DirectX Components

What do you need to develop a DirectX application?

DirectX Software Developer’s Kit (SDK) http://www.microsoft.com/directx/

Win32 compiler

Language?

A little creativity!

What I am using to develop “Die, Rock, Die.”

Microsoft DirectX SDK v. 5.2

Microsoft Visual C++ 5.0 Professional Edition

Windows 98

Corel Draw Suite 7.0

Sound Forge XP 4.0

Microsoft Force-Feedback Pro Digital Joystick

LPDIRECTDRAW lpdd = NULL; // DD object extern HWND hWnd; // The window handle LPDIRECTDRAWSURFACE lpddsprimary = NULL; // DD primary surface LPDIRECTDRAWSURFACE lpddsback = NULL; // DD back surface DDSURFACEDESC ddsd; // DD surface description

struct

if (DirectDrawCreate(NULL,&lpdd,NULL) != DD_OK) // Create the DirectDraw return(0); // Object

if (lpdd->SetCooperativeLevel(hWnd, // Set cooperation level | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)!=DD_OK) return(0);

if (lpdd->SetDisplayMode(width,height,bpp)!=DD_OK) // Set the display mode return(0);

Direct Draw Initialization

ddsd.dwSize = sizeof(ddsd); // Set the dwSize field

ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; // Specify the DD

// surface capabilities ddsd.dwBackBufferCount = 1; // How many backbuffers?

lpdd->CreateSurface(&ddsd,&lpddsprimary,NULL); // Create the primary surface

ddscaps.dwCaps = DDSCAPS_BACKBUFFER; // Looking at backbuffer

lpddsprimary->GetAttachedSurface(&ddscaps,&lpddsback); // Query for the backbuffer

while(lpddsprimary->Flip(NULL, DDFLIP_WAIT) != DD_OK); // Flip the surfaces

Direct Draw Initialization (cont’d.)

Inside DirectX Bradley Bargen and Peter Donnelly Microsoft Press: 1998

Windows Game Programming Andre LaMothe IDG Books: 1998

Win32 Programming API Bible Richard Simon The Waite Group: 1996

Angelic Coders www.angelic-coders.com

Sprite Library - Ari Feldman

References

Sound Library - Union University