23 May 2000,
Object oriented analysis
00 process model
Forward engineering
Operation
OOT Test
OOP Implementation
OOD
Planning phase
OOA Requirements
Class responsibility collaboration model (CRC)
Card
Use cases scripts and scenarios for how the class is used in the real world
OO design
Object candidates
Windows programming
DirectX is installed in directory DXSDK\lib for lib files and \Include for header files
Inside VC++ creating win32 work space win32 consol applications
Settings dialog box under projects tab load .lib files that are needed
Ddraw.lib
Dinput.lib
Dsound.lib
Winmm.lib
Run time DLLs have to be in the windows/system directory
Hungarian notation
Always include
#define win32_lean_and_mean
# include <windows.h>
# include <windowsx.h>
page 62 lists the parameters that can be included in WinMain
page 73 example to do to prepare a windows class
p73
wndclassex wndclass
winclass.cbsize = sizeof(wndclasses);
winclass.style = (see examples)
winclass.lpfnwndproc = windproc // event handler for the window (switch statement)
:
:
:
if (registerclass(&wndclass) == 0)
{
:
error processing
Reviews
P79 program 2.3
P79 figure 2.7
PostMessage( ) // send message to the queue for normal processing
SendMessage( ) // sends message directly to the window bypassing queue
Ex.
SendMessage(hwnd, wm_paint, 0, 0) // 0,0 are message parameters and dont do anything
SendMessage(hwnd, wm_user,w ,l)
Case wm_user:
{
l is in lparam
w is in wparam
}
Processing keyboard key presses
Wm_char
WParam Ί ascii char code
Lparam Ί bit code
Virtual key table is on page 154 table 3.8 has all the virtual keys
Vk_escape = 1B Ί esc key etc
Wm_keydown Ί activated anytime a key is pressed
Wparam is the key press
Lparam is the bit code
Bit code table p153
1 15 repeat code
16 23 scan code OEM specific
24 Boolean extended key code
25 28 reserved
29 flag to indicate if key is down
30 Boolean transition state 1 Ί key is pressed 2 Ί key is being released
wm_mousemove
Review
P159 table 3.9 to get button flags
P160 table 3.10 button values
Drawing
Whenever you or windows disturbs the client area of a window wm_paint is sent area to be repainted is called invalid rectangle (shipped with paint message called a validating process)
BeginPaint( )
:
:
:
endPaint( )
Advantage Ί does all needed validating
Disadvantage Ί invalided rectangle which is repainted is the same as the clipping rectangle
getdc( )
:
:
:
releasedc( )
Advantage Ί draw outside of invalidate rectangle
Disadvantage Ί need to validate every rectangle manually using validateRect( )
// invalidating the entire window
Case wm_paint:
{
Invalidaterect(hwnd,
NULL, // invalided rect
true)
hdl = beginpaint(hwnd, &ps);
:
:
endpaint(hwnd, &ps);
return (0);
} break;
Validate the window
Case wm_paint:
{
validrect(hwnd, null);
return (0);
} break;
Avoid worrying about repaint use DC
Case wm_paint:
{
hdc = getdc(hwnd);
// do graphics here
releasedc(hwnd, hdc);
return (0);
} break;
Display surface fundamentals (GDI)