Use vertex's individual radius for all relevant calculations
This commit is contained in:
parent
4b1947fe44
commit
fc71203220
BIN
background.bmp
BIN
background.bmp
Binary file not shown.
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 2.3 MiB |
|
@ -37,7 +37,7 @@ bool GameCore::init()
|
|||
{
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) return false;
|
||||
|
||||
display = SDL_SetVideoMode(800,600,32, SDL_HWSURFACE | SDL_DOUBLEBUF);
|
||||
display = SDL_SetVideoMode(1024,768,32, SDL_HWSURFACE | SDL_DOUBLEBUF);
|
||||
if (display == NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -82,7 +82,7 @@ void GameCore::render()
|
|||
cursor != vertices.end(); cursor++)
|
||||
{
|
||||
Vertex v = *(*cursor);
|
||||
DrawUtils::draw_circle_filled(display, v.x, v.y, NODE_RADIUS,
|
||||
DrawUtils::draw_circle_filled(display, v.x, v.y, v.r,
|
||||
0x000000);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,10 @@ void GameCore::on_lbutton_down(int x, int y)
|
|||
if (cv != NULL &&
|
||||
(MathUtils::distance(cv->x, cv->y, x, y)
|
||||
> MAX_MOVE_DISTANCE))
|
||||
{
|
||||
graph.select_vertex(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
graph.do_vertex(x, y, NODE_RADIUS);
|
||||
}
|
||||
|
|
|
@ -72,3 +72,11 @@ void Graph::add_vertex(int x, int y, int r)
|
|||
edges.push_back(e);
|
||||
current_vertex = v;
|
||||
}
|
||||
|
||||
|
||||
Vertex::Vertex(int x, int y, int r)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->r = r;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user