Using Windows resources with GDI
Graphics Device Interface (GDI) allows us to do interesting things using bitmaps, icons cursors, and so on. GDI is used as a rendering alternative if we are not implementing any other rendering alternatives such as OpenGL or DirectX.
Getting ready
For this recipe, you will need a Windows machine with a working copy of Visual Studio.
How to do it…
In this recipe, we will find out how easy it is to load resources using the Windows GDI:
Open Visual Studio.
Create a new C++ project.
Select a Win32 Windows application.
Right-click on Resource files and add a new cursor from the Add Resource subsection.
A
resource.h
file will automatically be created for you.Add a source file called
Source.cpp
and add the following code to it:#define WIN32_LEAN_AND_MEAN #include <windows.h> // Include all the windows headers. #include <windowsx.h> // Include useful macros. #include "resource.h" #define WINDOW_CLASS_NAME L"WINCLASS1" void GameLoop() { //One frame...