Wang Tiling
A Simple Wang Tiling Generator
CMain.h
Go to the documentation of this file.
1
3
4// MIT License
5//
6// Copyright (c) 2020 Ian Parberry
7//
8// Permission is hereby granted, free of charge, to any person obtaining a copy
9// of this software and associated documentation files (the "Software"), to
10// deal in the Software without restriction, including without limitation the
11// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12// sell copies of the Software, and to permit persons to whom the Software is
13// furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included in
16// all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24// IN THE SOFTWARE.
25
26#ifndef __CMAIN_H__
27#define __CMAIN_H__
28
29#include "Includes.h"
30#include "WindowsHelpers.h"
31#include "WangTiler.h"
32
38
39class CMain{
40 private:
41 HWND m_hWnd = nullptr;
42 HMENU m_hTilesetMenu = nullptr;
43
44 ULONG_PTR m_gdiplusToken = 0;
45
46 Gdiplus::Bitmap* m_pBitmap = nullptr;
47
49 Gdiplus::Bitmap** m_pTile = nullptr;
50 UINT m_nNumTiles = 0;
51
52 void CreateMenus();
53
54 public:
55 CMain(const HWND hwnd);
56 ~CMain();
57
58 HRESULT LoadTileSet(const UINT idm, const UINT n);
59 void Generate();
60 void Draw();
61
62 void OnPaint();
63 Gdiplus::Bitmap* GetBitmap();
64}; //CMain
65
66
67#endif //__CMAIN_H__
Useful includes.
Interface for CWangTiler.
Interface for some helpful Windows-specific functions.
The main class.
Definition: CMain.h:39
HRESULT LoadTileSet(const UINT idm, const UINT n)
Load tileset.
Definition: CMain.cpp:182
CWangTiler * m_pWangTiler
Pointer to the Wang tiler.
Definition: CMain.h:48
void CreateMenus()
Create menus.
Definition: CMain.cpp:159
UINT m_nNumTiles
Number of tiles in tileset.
Definition: CMain.h:50
Gdiplus::Bitmap ** m_pTile
The tile pointer array.
Definition: CMain.h:49
~CMain()
Destructor.
Definition: CMain.cpp:55
void Draw()
Draw the Wang tiling.
Definition: CMain.cpp:117
void Generate()
Generate a Wang tiling.
Definition: CMain.cpp:247
CMain(const HWND hwnd)
Constructor.
Definition: CMain.cpp:39
ULONG_PTR m_gdiplusToken
GDI+ token.
Definition: CMain.h:44
Gdiplus::Bitmap * GetBitmap()
Get pointer to bitmap.
Definition: CMain.cpp:255
HMENU m_hTilesetMenu
Handle to the Generate menu.
Definition: CMain.h:42
Gdiplus::Bitmap * m_pBitmap
Pointer to a bitmap image.
Definition: CMain.h:46
void OnPaint()
Paint the client area of the window.
Definition: CMain.cpp:77
HWND m_hWnd
Window handle.
Definition: CMain.h:41
Wang tiler.
Definition: WangTiler.h:37