Open main menu

CDOT Wiki β

Changes

User:Mdafidchao

7,166 bytes added, 15:08, 8 October 2012
no edit summary
I'm Michael Afidchao, and this is my favorite page on the Citadel...no, not really.
 
My e-mail: [mailto:mdafidchao@learn.senecac.on.ca mdafidchao@learn.senecac.on.ca]
IRC nick: mdafidchao, KyperTrast
 
=GAM666 test review stuff=
* Windows Programming
** Windows Functions ([http://msdn.microsoft.com/en-us/library/windows/desktop/ms633559%28v=vs.85%29.aspx WinMain], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms646291%28v=vs.85%29.aspx EnableWindow], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms632667%28v=vs.85%29.aspx AdjustWindowRectEx], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms645515%28v=vs.85%29.aspx SendDlgItemMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms645481%28v=vs.85%29.aspx GetDlgItem], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms633586%28v=vs.85%29.aspx RegisterClass], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms645452%28v=vs.85%29.aspx DialogBox] (macro), [http://msdn.microsoft.com/en-us/library/windows/desktop/ms632682%28v=vs.85%29.aspx DestroyWindow], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms632679%28v=vs.85%29.aspx CreateWindow], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx ShowWindow], [http://msdn.microsoft.com/en-us/library/windows/desktop/dd145167%28v=vs.85%29.aspx UpdateWindow], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms644943%28v=vs.85%29.aspx PeekMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms644955%28v=vs.85%29.aspx TranslateMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944%28v=vs.85%29.aspx PostMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms644934%28v=vs.85%29.aspx DispatchMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms648393%28v=vs.85%29.aspx Setcursor], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms644945%28v=vs.85%29.aspx PostQuitMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms633572%28v=vs.85%29.aspx DefWindowProc], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms644956%28v=vs.85%29.aspx WaitMessage], [http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx MessageBox])
** [http://msdn.microsoft.com/en-us/library/windows/desktop/ms633570%28v=vs.85%29.aspx Window Procedures]or Scroll UP on this [https://scs.senecac.on.ca/~gam666/pages/content/displ.html#dis page]
* [https://scs.senecac.on.ca/~gam666/pages/content/direc.html#com COM Technology]
* [https://scs.senecac.on.ca/~gam666/pages/content/direc.html#dir 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
sprite->Begin()
sprite->Drew
sprite->End
// ]
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
* COMBOBOX
* DEFPUSHBUTTON - default push button
 
===Defines/Typedefs===
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 HANDLE HINSTANCE;
* 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;
1
edit