Jump to: navigation, search


7,166 bytes added, 14:08, 8 October 2012
no edit summary
I'm Michael Afidchao, and this is my favorite page on the, not really.
My e-mail: []
IRC nick: mdafidchao, KyperTrast
=GAM666 test review stuff=
* Windows Programming
** Windows Functions ([ WinMain], [ EnableWindow], [ AdjustWindowRectEx], [ SendDlgItemMessage], [ GetDlgItem], [ RegisterClass], [ DialogBox] (macro), [ DestroyWindow], [ CreateWindow], [ ShowWindow], [ UpdateWindow], [ PeekMessage], [ TranslateMessage], [ PostMessage], [ DispatchMessage], [ Setcursor], [ PostQuitMessage], [ DefWindowProc], [ WaitMessage], [ MessageBox])
** [ Window Procedures]or Scroll UP on this [ page]
* [ COM Technology]
* [ Direct3D]
** Direct3D COM Object
** Direct3D Display Device COM Object
** Direct3D Texture COM Object
* Game Programming Aspects
** Singletons and Interfaces
** Event Iteration, Messages, and Timing
** Re-Configuration, Loss and Restoration of Focus
** Design, Coordination, Graphic Representation
** Colour and Backbuffering
** Action-Key Mapping
Sample test question:
d3d->CreateDevice( ) //returns &d3dd
sprite->D3DCreateSprite() //returns &sprite
//com Direct3D object
d3dd -> Clear ()
// { single frame
d3dd -> BeginScene()
//[ drawing graphic
// ]
d3dd ->EndScene()
d3dd -> Present()
==Windows Programming==
* entry point: instead of a main function, WinMain() is used
* int WINAPI WinMain (HINSTANCE hinst, HINST hprev, LPSTR cp, int show)
** hinst - handle to the window, a pointer that indirectly points to an instance to disallow direct changes
** hprev - handle to the previous instance of the application (usually nullptr)
** cp - C-style null-terminated string from the command line,
** show - integer that identifies how to initially display the window
* windows procedure: processes the message queue created from the OS
* BOOL CALLBACK identifierName(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
** hwnd - handle to the window for which the incoming message was targeted
** msg - integer that identifies the message itself
** wp - optionally holds a value associated with message, usually an integer
** lp - holds a value associated with message, usually an address
* DialogBox(): a Windows function-like macro that creates a modal dialog box from a template resource
* DialogBox((HINSTANCE)hinst, MAKEINTRESOURCE(IDD_DLG), nullptr, procedureToReceieveMessages)
** modal - execution pauses until user completes some action
** does not return control until EndDialog() has destroyed the dialog box
* types of messages to process within switch(msg): WM_INITDIALOG, WM_COMMAND, IDCANCEL
** WM_INITDIALOG - initialize immediately before displaying dialog box
** WM_COMMAND - response to any activity within dialog box, check the LOWORD of wp: switch (LOWORD(wp))
*** IDOK - continue button
*** IDCANCEL - cancel button
* Resource Description: dialog box uses a resource, defined in a resource definition script
** resources are defined with ID numbers, dialog controls are usually prefixed with IDC_ and starts at 100/101
* ensure you use the L prefix for Unicode (2 bytes per character): L"Text"
===Key Windows Functions===
* MessageBox(HWND hwnd, LPCTSTR lpText, LPCTSTR lpCation, UINT uType): pops up a modal dialog box
* SendDlgItemMessage (HWND hwnd, int nIDDlgItem, UINT Msg, WPARAM wp, LPARAM lp): sends message msg to control nIDDlgItem in dialog box hwnd
** For comboboxes: wp holds the index of the line item in nIDDlgItem's list
** lp holds the address of the string associated with that line item
** combo box CB_ definitions:
*** CB_RESETCONTENT - send a message to the combo box to remove all items from its list
*** CB_ADDSTRING - add a line item to its list
*** CB_SETCURSEL - select the line item from the list associated with the index specified in wp
*** CB_GETCURSEL - get index of selected item
*** CB_GETLBTEXT - get description of selected resolution, wp specifies the index, lp specifies the string to be filled
*** CBN_SETFOCUS - checks whether the combo box has keyboard focus, from the wp ex. HIWORD(wp) == CBN_SETFOCUS
*** CBN_SELCHANGE - checks whether the user has clicked in the combo box list or changed the selection w/arrow keys
*** CB_ERR - this is returned after any sent dialog message to a combo box
** GetDlgItem (HWND hwnd, int nID): retrieves a handle to control nID in dialog box hwnd
** EnableWindow (HWND hwnd, BOOL enable): enables/disables the control at handle hwnd
*** use in combination w/GetDlgItem, ex. EnableWindow(GetDlgItem(hwnd, IDC_GO), TRUE)
===Key Resource Definitions===
* LTEXT - creates text control
* PUSHBUTTON - creates a push button control
* DEFPUSHBUTTON - default push button
These are the key definitions:
* #define WINAPI __stdcall //__stdcall informs the compiler that the function, not the caller, will clean the stack after execution
* #define WIN32_LEAN_AND_MEAN //remove unnecessary API components for game programming
* typedef PVOID HANDLE;
* typedef void* PVOID;
* typedef CHAR* LPSTR;
* typedef char CHAR;
* typedef int BOOL;
* #define CALLBACK __stdcall
* typedef HANDLE HWND;
* typedef unsigned int UINT;
* typedef UINT_PTR WPARAM; //word parameter
* typedef unsigned int UINT_PTR;
* typedef LONG_PTR LPARAM; //long parameter
* typedef long LONG_PTR;

Navigation menu