Wang Tiling
A Simple Wang Tiling Generator
|
The main class. More...
#include <CMain.h>
Public Member Functions | |
CMain (const HWND hwnd) | |
Constructor. More... | |
~CMain () | |
Destructor. More... | |
HRESULT | LoadTileSet (const UINT idm, const UINT n) |
Load tileset. More... | |
void | Generate () |
Generate a Wang tiling. More... | |
void | Draw () |
Draw the Wang tiling. More... | |
void | OnPaint () |
Paint the client area of the window. More... | |
Gdiplus::Bitmap * | GetBitmap () |
Get pointer to bitmap. More... | |
Private Member Functions | |
void | CreateMenus () |
Create menus. More... | |
Private Attributes | |
HWND | m_hWnd = nullptr |
Window handle. More... | |
HMENU | m_hTilesetMenu = nullptr |
Handle to the Generate menu. More... | |
ULONG_PTR | m_gdiplusToken = 0 |
GDI+ token. More... | |
Gdiplus::Bitmap * | m_pBitmap = nullptr |
Pointer to a bitmap image. More... | |
CWangTiler * | m_pWangTiler |
Pointer to the Wang tiler. More... | |
Gdiplus::Bitmap ** | m_pTile = nullptr |
The tile pointer array. More... | |
UINT | m_nNumTiles = 0 |
Number of tiles in tileset. More... | |
The interface between I/O from Windows (input from the drop-down menus, output to the client area of the window), the Wang tiler, and the GDI+ graphics interface.
CMain::CMain | ( | const HWND | hwnd | ) |
CMain::~CMain | ( | ) |
|
private |
void CMain::Draw | ( | ) |
Gdiplus::Bitmap * CMain::GetBitmap | ( | ) |
HRESULT CMain::LoadTileSet | ( | const UINT | idm, |
const UINT | n | ||
) |
Load a tileset into m_pTile
and set the checkmarks on the Tileset
menu. Assumes that m_hTilesetMenu
contains a handle to the Tileset
menu and that the tile images are in separate numbered png files in a hard-coded subfolder of the tiles
folder.
idm | A menu identifier for the required tileset. |
n | Number of tiles in the tileset. |
void CMain::OnPaint | ( | ) |
|
private |