Lindenmayer System
A Simple L-system Image Generator Featuring Turtle Graphics
WindowsHelpers.h
Go to the documentation of this file.
1 
7 // MIT License
8 //
9 // Copyright (c) 2020 Ian Parberry
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining a copy
12 // of this software and associated documentation files (the "Software"), to
13 // deal in the Software without restriction, including without limitation the
14 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15 // sell copies of the Software, and to permit persons to whom the Software is
16 // furnished to do so, subject to the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be included in
19 // all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 // IN THE SOFTWARE.
28 
29 #pragma once
30 
31 #include "Includes.h"
32 
34 // Menu IDs
35 
36 #pragma region Menu IDs
37 
38 #define IDM_FILE_GENERATE 1
39 #define IDM_FILE_SAVE 2
40 #define IDM_FILE_QUIT 3
41 
42 //Defines for the L-system menu (IDM_LSYS_*) must be numbered consecutively.
43 //IDM_LSYS_BRANCHING must be the smallest, `IDM_LSYS_HEXGOSPER` the largest.
44 
45 #define IDM_LSYS_BRANCHING 4
46 #define IDM_LSYS_PLANT_A 5
47 #define IDM_LSYS_PLANT_B 6
48 #define IDM_LSYS_PLANT_C 7
49 #define IDM_LSYS_PLANT_D 8
50 #define IDM_LSYS_PLANT_E 9
51 #define IDM_LSYS_PLANT_F 10
52 #define IDM_LSYS_HEXGOSPER 11
53 
54 #define IDM_VIEW_RULES 12
55 #define IDM_VIEW_THICKLINES 13
56 
57 #pragma endregion Menu IDs
58 
60 // Helper functions
61 
62 #pragma region Helper functions
63 
64 //initialization functions
65 
66 void InitWindow(HINSTANCE, INT, WNDPROC);
67 ULONG_PTR InitGDIPlus();
68 
69 //rectangle functions
70 
71 void AddPointToRect(RECT&, Gdiplus::PointF);
72 Gdiplus::RectF GetClientRectF(HWND);
73 void MinDragRect(HWND, WPARAM, RECT*, int);
74 
75 //others
76 
77 HRESULT SaveBitmap(HWND, Gdiplus::Bitmap*);
78 
79 #pragma endregion Helper functions
ULONG_PTR InitGDIPlus()
Initialize GDI+.
Gdiplus::RectF GetClientRectF(HWND)
Get client rectangle as a RectF.
void AddPointToRect(RECT &, Gdiplus::PointF)
Add point to rectangle.
Useful includes.
HRESULT SaveBitmap(HWND, Gdiplus::Bitmap *)
Save bitmap to file.
void InitWindow(HINSTANCE, INT, WNDPROC)
Initialize window.
void MinDragRect(HWND, WPARAM, RECT *, int)
Enforce minimum drag rectangle.