GAM666 – Introduction To Game Programming You must use special libraries (aka APIs – application programming interfaces) to make something other than a.

Slides:



Advertisements
Similar presentations
Computer Graphics1 Windows NT Graphics Interface.
Advertisements

Tutorial 12: Enhancing Excel with Visual Basic for Applications
Introduction to Windows Programming. First Windows Program This program simply displays a blank window. The following code is the minimum necessary to.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Intro to Windows Programming Basic Ideas. Program Entry Point Int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
Introduction to Microsoft Windows MFC Programming: the Application/Window Approach Lecture 4.
C++ fundamentals.
Options for User Input Options for getting information from the user –Write event-driven code Con: requires a significant amount of new code to set-up.
Android Application Development 2013 PClassic Chris Murphy 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
Object Oriented Software Development
Introducing the Sudoku Example
INTRODUCTION TO VC++ As the Microsoft Windows 3.X and then 5.5 operating system was becoming popular, many programmers were interested in creating graphical.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 62 – Manipulating Data Using Methods – Day 1.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
An Introduction to Visual Basic
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Getting Started The structure of a simple wxWidgets program, Look at where and how a wxWidgets application starts and ends, how to show the main window,
Overview of Previous Lesson(s) Over View  Visual C++ provides us with 3 basic ways of creating an interactive Windows application  Using the Windows.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 27 - Phone Book Application Introducing Multimedia.
Chapter 1: Hello, MFC Windows Programming Model Department of Digital Contents Sang Il Park.
Chapter 1: Hello, MFC Your first MFC Application Department of Digital Contents Sang Il Park.
5-1 Chapter 5 The Repetition Process in VB.NET. 5-2 Learning Objectives Understand the importance of the repetition process in programming. Describe the.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Introduction to the Windows API n API - Application Programming Interface n an API is the software interface for things such as the OS n an API is the.
Classic Controls Trần Anh Tuấn A. Week 1 How to create a MFC project in VS 6.0 How to create a MFC project in VS 6.0 Introduction to Classic Controls.
Server Core is the preferred deployment configuration.
Working with option button, check box, and list box controls Visual Basic for Applications 13.
Direct3D Workshop November 17, 2005 Workshop by Geoff Cagle Presented by Players 2 Professionals.
Getting Started with OPC.NET OPC.NET Software Client Interface Client Base Server Base OPC Wrapper OPC COM Server Server Interface WCF Alternate.
Menu Messages  Besides the all-important WM_COMMAND message, window provides five other messages at various stages of menu selection:  WM_SYSCOMMAND.
Lecture 7 Menu, controls, scroll bars. Menu Menu item sends WM_COMMAND message to the application window Menu is attached to window when the window is.
GAM666 – Introduction To Game Programming ● DirectX is implemented as a collection of COM objects ● To use a DirectX program, the user must have the correct.
GUI-Based Programming ECE 417/617: Elements of Software Engineering Stan Birchfield Clemson University.
Dialog boxes Modal and modeless dialog boxes Displaying about dialog box: case WM_COMMAND : switch (LOWORD (wParam)) { case IDM_APP_ABOUT : DialogBox (hInstance,
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
GUIs Basic Concepts. GUI GUI : Graphical User Interface Window/Frame : a window on the screen Controls/Widgets : GUI components.
Chapter 7 Controls. 2 Introduction (1/4) Control –Special kind of window –Designed to convey information to the user or to acquire input –Reduce the tedium.
The WM_NCHITTEST Message  This is an internal message used by Windows for generating all the other mouse messages.  Though it almost never needs to be.
Introduction to OpenGL
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
Chapter 7 Controls. List box control 3 List Box Control(1/8) Listbox control: –Display lists of text strings called items –Optionally sort the items.
Overview of Previous Lesson(s) Over View  Windows Programming  WinMain()  Where execution of the program begins and basic program initialization is.
1 An SDL Tutorial Two primary elements: –Structure –Identifies the various components of the system, and the communication paths among them. –Components:
Our good old first Win32 programme of lecture 8 #include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
W indows Programming Lecture 08. Brief History of Win Windows is announced 1984 Work begins on Word for Windows 1.0 November 1985: Windows 1.0.
Windows Communication Foundation and Web Services
Resource scripts.
Message Handling in MFC
Microsoft Foundation Classes MFC
Windows Programming Lecture 09.
Window.
Windows Programming Model
Working with Dialogs and Controls
Windows Communication Foundation and Web Services
VISUAL BASIC.
Multi-form applications and dialogs
The program in traditional OS
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Dialogs.
COMMON CONTROLS A control is a child window that an application uses in conjunction with another window to enable user interaction. Controls are most often.
Windows Programming Lecture 12
Windows Programming Lecture 15
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/10.
Java Programming Language
Jim Fawcett CSE681 – SW Modeling & Analysis Fall 2011
GUI Socket Application
Presentation transcript:

GAM666 – Introduction To Game Programming You must use special libraries (aka APIs – application programming interfaces) to make something other than a text-based program. The C++ choices are: ● The original Windows SDK (Software Development Kit), a C library ● MFC (Microsoft Foundation Classes), a sophisticated wrapper around the Windows SDK ● ATL (Active Template Library), a light- duty wrapper around the Windows SDK ●.NET, Microsoft's new technology Windows Programming in C++

GAM666 – Introduction To Game Programming ● Games generally take over the whole screen ● Windows SDK is the simplest route to getting to the point where the screen has been taken over ●.NET not univerally installed yet ● We cover MFC/ATL/.NET in other courses Why Use the Windows SDK?

GAM666 – Introduction To Game Programming Basic Windows SDK Concepts ● Write a WinMain(), not a classical main() ● #include and probably ● Often #define WIN32_LEAN_AND_MEAN before those #includes to cut down on further #includes of rarely used header files ● Use many #define- and typedef-created data types from those header files (e.g. BOOL, HWND) ● Use MS-specific declaration modifiers (e.g. WINAPI, CALLBACK) for functions

GAM666 – Introduction To Game Programming Basic Windows SDK Concepts Some Data Types are: ● BOOL - a boolean value (TRUE or FALSE) ● HWND - “handle” to a window ● UINT - unsigned integer (32 bit) ● WPARAM - “word” parameter (32 bit, originally 16, for passing an integer value, for example) ● LPARAM - “long” parameter (32 bit, for passing an address, for example) ● LRESULT - 32 bit return code from a function ● HINSTANCE - “handle” to a running instance of a program

GAM666 – Introduction To Game Programming Messages ● MS Windows uses Messages to communicate with the windows in a program ● Every window in a windows program (which includes Controls, which are preprogrammed sub-windows like buttons and list boxes) has a Window Procedure, which is the code to handle any message that may be sent to the window ● A window is customized by writing a custom window procedure for it, and supplying that procedure's address to Windows, which will call the procedure when needed.

GAM666 – Introduction To Game Programming Messages A window procedure is passed four things: ● An HWND, identifying the window for whom the message is intended ● A UINT, identifying which message it is ● A WPARAM, containing a piece of data ● An LPARAM, containing another piece of data (typically a pointer to more data, but not necessarily) The WPARAM and LPARAM meaning and usage varies between different messages

GAM666 – Introduction To Game Programming Messages Messages can come from: ● Windows, based on user interaction or some other operating system activity ● Another window (in the same program or another) ● The program code itself, using either SendMessage() (waits until message is handled) or PostMessage() (puts the message on a queue but doesn't wait for it to be handled)

GAM666 – Introduction To Game Programming Messages ● Controls (like buttons) have a window procedure that you don't see ● Controls will send a WM_COMMAND message to the parent window when the user interacts with them, its WPARAM identifies the control and the operation ● Macros LOWORD() and HIWORD() can extract the low- and high-order 16 bits of a WPARAM or LPARAM (or you can do the bit manipulation operations yourself)

GAM666 – Introduction To Game Programming Dialogs ● A Dialog is a pop-up window that typically contains a bunch of controls ● A dialog can be laid out using a resource file (extension.rc) to describe the controls, rather than creating the controls from within the C++ code ● A header file is typically used to interlink the C++ code with the resource code by using symbolic names for IDs, since both languages understand the #define and #include syntax

GAM666 – Introduction To Game Programming Dialogs ● A dialog is supplied the address of a Dialog Procedure, which is a window procedure specifically designed to handle a dialog (return value is BOOL rather than LRESULT) ● Can get the HWND of a control on a dialog using GetDlgItem() ● Can send a message to a control on a dialog using SendDlgItemMessage() or PostDlgItemMessage() [alternative to calling GetDlgItem() then Send/PostMessage()]

GAM666 – Introduction To Game Programming Dialogs ● WM_INITDIALOG is the ID of the message sent to a dialog just after it is first created, giving you a chance to initialize its controls and do other one-time setup ● WM_COMMAND is the ID of the message sent to a window when (among other things) one of its controls (ID in low order 16 bits of WPARAM) has something to pass along ● IDCANCEL is a predefined control ID that corresponds to a user request to close the window

GAM666 – Introduction To Game Programming Dialogs ● Each kind of control has different messages that can be sent to it ● E.g. CB_GETCURSEL is the ID of the message you send to a ComboBox to get the index of the item in the combobox that is currently selected ● E.g. LB_ADDSTRING is the ID of the message you send to a ListBox to add another string (passed in the LPARAM) to the listbox

GAM666 – Introduction To Game Programming Dialogs ● Dialogs can be modal (application waits until dialog has been completed) or not (dialog and other application windows can be used at the same time) ● Modal dialogs can be created by calling DialogBox() ● Modal dialogs should be terminated by calling EndDialog()