Midterm Format

5 problems

1) VB Programming Problem (25 Points)
2) VB DirectX Programming Problem (25 Points)
3) What does this code produce? (20 Points)
4) Find the errors in given code (15 points)
5) Five short answer questions (15 points)
 

Sample Questions (for types 1, 2, and 5)

VB programming (25 points)
1.  Write a function that breaks up a numeric date in the format mmddyyyy and converts it to the written equivalent, pops up a message box with the converted date and also returns the string.

For example, 01022001 would be converted to January 2, 2001 and would be displayed in a message box and also returned as a string.
 

VB programming (25 points)
2.Write a function that takes in a letter grade of A, B, C, D or F and returns the numerical equivalent.  A = 4.0, B = 3.0, C = 2.0, D = 1.0 and F = 0.0.  You are NOT to write a whole program.  You are to write only the code for the function.
 

VB DirectX Programming (25 points)
SEE CLASS 5 notes p. 54 and Direct Draw Docs p.41 for solution:
1. Write a module, with an Initialize sub, that sets up a simple flipping chain with 1 backbuffer and gets the attached back buffer.  Note you don't have to do any drawing with blt- just ready the primary and the back buffer for future use.

Some of the objects and constants you may need are as follows.  To minimize time writing, you may use the abbreviations where provided to represent the constants or objects (not to be used as variable names).

Object/Constant        Abbreviation
DirectDraw7              DD
DirectDrawSurface7       DDS

DDSURFACEDESC2           DDSD
DDSD_CAPS                DDSD_C
DDSD_BACKBUFFERCOUNT     DDSD_B
DDSCAPS_PRIMARYSURFACE   DDSCAPS_PRIMARY
DDSCAPS_FLIP
DDSCAPS_COMPLEX
DDSCAPS_BACKBUFFER

Some surface description statements you'll need are:

<your surface description>.lFlags = DDSD_C Or DDSD_B
<your surface description>.ddsCaps.lCaps = [fill in the rest]
 

After you've created the primary flipping surface, make sure you set the reference for the back buffer.

Some Short Answer Questions (3 points each)

1. What is a clipper? (One sentence answer only)

2. What is a palette as used in Direct Draw/display terminology? (One sentence answer only)

3. When you use a direct draw page flipping structure, you always call the Flip method on the primary surface.  True __  False __

4. Using the pixel checking method of drawing sprites with transparent areas requires you to lock surface memory.  True__ False __

5. In Direct Draw/display terminology, pitch is also known as stride. True ___ False __

6. DirectX provides source and destination color key transparency functionality True __ False ___

7.  When hardware does not support a graphics feature, Direct Draw will try to provide it through the __________________________________  (HEL) .