0

I'm working on a tool that generates a grid of hexagons that the user can click on to cycle through certain states (Enemy, ally etc). So far, I've been able to generate the hexes as Polygons.

I'm fairly new to Windows programming and the Win32 API. I know how to create a regular button, but what would be the best way to deal with what I need?

The options that come to mind are:

  1. Make the hex's pseudo-buttons. As in store the states of the hex objects and just draw the text on each hex as the user clicks on them.
  2. Make actual hexagon shaped buttons using CreateWindow. I've found some examples of how to create different shaped buttons, but haven't tried myself.
  3. Create image files to cycle through.

What is the correct way to go to do this? By correct I mean best practice.

inzombiak
  • 171
  • 2
  • 14

1 Answers1

0

If you are already drawing the hexagons (it sounds like you are) then making hexagon shaped buttons doesn't really do much for you. You can do the hit testing yourself to determine which pseudo-button was clicked. This avoids having Windows manage many small objects that you already have complete data about. And drawing the text on these buttons will be at least as fast as needing Windows to do it.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15