Jump to content
  • Advertisement
Sign in to follow this  
code_nerd

Writing an array of hexagons to a "Virtual Frame Buffer"?[GDI+]

This topic is 4680 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi folks, i have an array of hexagons, arranged to a battlemap like in most 2-D wargames, which i paint directly to my form. now i created a second hexgrid, that looks like the first, but has each hexagon colored differently (i++ on blue). Evertime a user clicks on my painted HexGrid, i store the coordinates with my MouseEvent method. Now i want to check which color would be on that coordinates, if the user had clicked in my "invisible" colored HexGrid instead in the real one that is painted on the form. With that i would know which hexagon has been clicked, and thats what it's all about. Now to my problem: How can i store my "virtual" colored hexgrid and check the cords from the real one against it? I read that i should store my colored grid in a "virtual frame buffer", but i can't find any code/infos on that topic. I want to check this "virtual" map against my mouse coordinates i get from MouseEvent everytime i click on my "real" hexgrid on my form (this is for detecting on which hexagon the user has clicked, but i need to che). Since i don't want to actually draw my colored hexagongrid, i read that in this case i need to write it to a "Virtual Frame Buffer", but i can't find any information how to do that with C# and GDI+. Anybody some infos/code for me? Thanks for your time. This is my hexagon array:
Point[] points = new Point[10];
			points[0] = leftMid;
			points[1] = topLeft;

			points[2] = topLeft;
			points[3] = topRight;
			
			points[4] = topRight;
			points[5] = rightMid;
			
			points[6] = rightMid;
			points[7] = bottomRight;
			
			points[8] = bottomRight;
			points[9] = bottomLeft;

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!