View Single Post
Old 05-31-2006, 02:24 AM   #2 (permalink)
HopeDagger
Luigi’s Pizza
 
HopeDagger's Avatar
 
Join Date: May 2006
Location: Ontario, Canada
Posts: 119
Reputation: 10
Send a message via MSN to HopeDagger
Default

Quote:
I have a linear array [Size of image * Size of Image] to hold the height data because you cant create a 2D array with
Code:
char *map = new char [Size][Size];

'Size' being a variable
Sure you can:

Code:
char **map = new char[Size];
for(int a=0; a < Size; a++)
  map[a] = new char[Size];
This makes it significantly easier to find exact coordinates in the array.

Quote:
I'm trying to write the Brush tool to paint with right now and how would I go about finding the pixels to modify if I knew the diameter of the Brush's circle? I want the user to use the "Tool Box" to select the brush width and use a circle with that diameter to paint on my map, I can get the X,Y of the mouse simple but how do i find the points around it?
There's a few good ways to do this. Since I'm no adept at circle-drawing, I refer you to Google instead. Plenty of good material on circle drawing algorithms.
__________________
Gauntlets of Recursion (+5) - My game development journal.
HopeDagger is offline