Wang Tiling
A Simple Wang Tiling Generator
Macros | Functions
WindowsHelpers.h File Reference

Interface for some helpful Windows-specific functions. More...

#include "Includes.h"

Go to the source code of this file.

Macros

#define IDM_FILE_GENERATE   1
 Menu id for Generate. More...
 
#define IDM_FILE_SAVE   2
 Menu id for Save. More...
 
#define IDM_FILE_QUIT   3
 Menu id for Quit. More...
 
#define IDM_TILESET_DEFAULT   4
 Menu id for default tileset. More...
 
#define IDM_TILESET_FLOWER   5
 Menu id for flower tileset. More...
 
#define IDM_TILESET_MUD   6
 Menu id for dirt tileset. More...
 
#define IDM_TILESET_GRASS   7
 Menu id for grass tileset. More...
 
#define IDM_HELP_HELP   8
 Menu id for display help. More...
 
#define IDM_HELP_ABOUT   9
 Menu id for display About info. More...
 

Functions

void InitWindow (HINSTANCE, INT, WNDPROC)
 Initialize window. More...
 
ULONG_PTR InitGDIPlus ()
 Initialize GDI+. More...
 
HRESULT SaveBitmap (HWND, Gdiplus::Bitmap *)
 Save bitmap to file. More...
 
void CreateFileMenu (HMENU hParent)
 Create File menu. More...
 
HMENU CreateTilesetMenu (HMENU hParent)
 Create Tileset menu. More...
 
void CreateHelpMenu (HMENU hParent)
 Create Help menu. More...
 

Detailed Description

These platform-dependent functions are hidden away so that the faint-of-heart don't have to see them if they're offended by them.

Definition in file WindowsHelpers.h.

Macro Definition Documentation

◆ IDM_FILE_GENERATE

#define IDM_FILE_GENERATE   1

Definition at line 39 of file WindowsHelpers.h.

◆ IDM_FILE_QUIT

#define IDM_FILE_QUIT   3

Definition at line 41 of file WindowsHelpers.h.

◆ IDM_FILE_SAVE

#define IDM_FILE_SAVE   2

Definition at line 40 of file WindowsHelpers.h.

◆ IDM_HELP_ABOUT

#define IDM_HELP_ABOUT   9

Definition at line 49 of file WindowsHelpers.h.

◆ IDM_HELP_HELP

#define IDM_HELP_HELP   8

Definition at line 48 of file WindowsHelpers.h.

◆ IDM_TILESET_DEFAULT

#define IDM_TILESET_DEFAULT   4

Definition at line 43 of file WindowsHelpers.h.

◆ IDM_TILESET_FLOWER

#define IDM_TILESET_FLOWER   5

Definition at line 44 of file WindowsHelpers.h.

◆ IDM_TILESET_GRASS

#define IDM_TILESET_GRASS   7

Definition at line 46 of file WindowsHelpers.h.

◆ IDM_TILESET_MUD

#define IDM_TILESET_MUD   6

Definition at line 45 of file WindowsHelpers.h.

Function Documentation

◆ CreateFileMenu()

void CreateFileMenu ( HMENU  hParent)

Create the File menu.

Parameters
hParentHandle to the parent menu.

Definition at line 187 of file WindowsHelpers.cpp.

◆ CreateHelpMenu()

void CreateHelpMenu ( HMENU  hParent)

Create the Help menu.

Parameters
hParentHandle to the parent menu.

Definition at line 216 of file WindowsHelpers.cpp.

◆ CreateTilesetMenu()

HMENU CreateTilesetMenu ( HMENU  hParent)

Create the Tileset menu.

Parameters
hParentHandle to the parent menu.
Returns
Handle to the Tileset menu.

Definition at line 201 of file WindowsHelpers.cpp.

◆ InitGDIPlus()

ULONG_PTR InitGDIPlus ( )

Initialize GDI+ and get a GDI+ token.

Returns
A GDI+ token.

Definition at line 88 of file WindowsHelpers.cpp.

◆ InitWindow()

void InitWindow ( HINSTANCE  hInst,
INT  nShow,
WNDPROC  WndProc 
)

Create and initialize a window.

Parameters
hInstInstance handle.
nShow1 to show window, 0 to hide.
WndProcWindow procedure.

Definition at line 46 of file WindowsHelpers.cpp.

◆ SaveBitmap()

HRESULT SaveBitmap ( HWND  hwnd,
Gdiplus::Bitmap *  pBitmap 
)

Display a Save dialog box for png files and save a bitmap to the file name that the user selects. Only files with a .png extension are allowed. The default file name is "ImageN.png", where N is the number of images saved so far in the current instance of this program. This prevents any collisions with files already saved by this instance. If there is a collision with a file from a previous instance, then the user is prompted to overwrite or rename it in the normal fashion.

Parameters
hwndWindow handle.
pBitmapPointer to a bitmap.
Returns
S_OK for success, E_FAIL for failure.

Definition at line 141 of file WindowsHelpers.cpp.