//**************************************************************** // セッター //**************************************************************** void Unitenemy::SetDirection(Direction getdirection){ Vec2i speed = Vec2i(CHIPSIZE_X, CHIPSIZE_Y); direction = getdirection; if (env.isPushKey(GLFW_KEY_SPACE)){ #if(1) switch (direction) { case Direction::NORTH : unitlist->pos.y() += 1; pos.y() += speed.y(); break; case Direction::SOUTH: unitlist->pos.y() -= 1; pos.y() -= speed.y(); break; case Direction::WEST : unitlist->pos.x() += 1; pos.x() -= speed.x(); break; case Direction::EAST : unitlist->pos.x() -= 1; pos.x() += speed.x(); break; } #else if if (env.isPushKey('W')){ pos.y() -= 1; } if (env.isPushKey('S')){ pos.y() += 1; } if (env.isPushKey('A')){ pos.x() -= 1; } if (env.isPushKey('D')){ pos.x() += 1; } #endif } }
bool GeometryUtils::project(const Mat4d& projectionMultViewMatrix, const Vec2i& viewportPosition, const Vec2ui& viewportSize, const Vec3d& point, Vec3d* out) { CVF_ASSERT(out); Vec4d v = projectionMultViewMatrix * Vec4d(point, 1.0); if (v.w() == 0.0f) { return false; } v.x() /= v.w(); v.y() /= v.w(); v.z() /= v.w(); // map to range 0-1 out->x() = v.x()*0.5 + 0.5; out->y() = v.y()*0.5 + 0.5; out->z() = v.z()*0.5 + 0.5; // map to viewport out->x() = out->x() * viewportSize.x() + viewportPosition.x(); out->y() = out->y() * viewportSize.y() + viewportPosition.y(); return true; }
Vec2i Vec2i::clamp(const Vec2i &vec, int a, int b) { Vec2i C; C.x() = clampi(vec.x(), a,b); C.y() = clampi(vec.y(), a,b); return C; }
bool TiledImageBlockAccessor::readBlockA16(Vec2i vSampleOrigin, Int32 iTextureSize, UInt16 *pTarget, Int32 iTargetSizeBytes) { #if 0 UInt32 destIdx = 0; UInt8 *pDst = (UInt8 *) pTarget; Int32 xMin = vSampleOrigin.x(); Int32 xMax = vSampleOrigin.x() + iTextureSize; Int32 yMin = vSampleOrigin.y(); Int32 yMax = vSampleOrigin.y() + iTextureSize; for(UInt32 y = yMin; y < yMax; y++) { for(UInt32 x = xMin; x < xMax; x++) { for(UInt32 i = 0; i < 2; i++) { pDst[destIdx] = 0; destIdx++; } } destIdx += (iTextureSize - (xMax - xMin)) * 2; } #endif return true; }
void Win32Wrapper::MyGetCursorPos(Vec2i& lpPoint) { POINT resultPoint; GetCursorPos(&resultPoint); lpPoint.x() = resultPoint.x; lpPoint.y() = resultPoint.y; }
bool CollisionMap::Check(Vec2i boss_pos_) { if (collison_map[boss_pos_.x()][boss_pos_.y()] == 1) { return true; } return false; }
void Camera::CenterOnSector(Sector* sector) { Vec2i sectorOffsetFromRoomOrigin = Vec2i(sector->X(), sector->Y()); - sector->GetRoom()->OriginSector(); Vec2f sectorOriginInRoomSpace = Vec2f((float)sectorOffsetFromRoomOrigin.X() * kSectorTileWidth, (float)sectorOffsetFromRoomOrigin.Y() * kSectorTileHeight); m_quad.SetLowerLeft(sectorOriginInRoomSpace); }
void Map::selected(Vec2i selected_pos){ drawBox(selected_pos.x() * static_cast<float>(BLOCKSIZE::WIDTH), -selected_pos.y() * static_cast<float>(BLOCKSIZE::HEIGHT), static_cast<float>(BLOCKSIZE::WIDTH), static_cast<float>(BLOCKSIZE::HEIGHT), 10, Color::yellow); }
void Sprite::Draw() { if (current.X() == -1) {return;} //this method has been called before the sprite was updated for the first time. Ignore the mistake int ax = sheets[animations[current.X()].first.X().X()]->getAdjust().X(); int ay = sheets[animations[current.X()].first.X().X()]->getAdjust().Y(); Vec2i apos;//the position adjusted by any offset this sheet might have. apos.setX( (int)pos.X() + ax); apos.setY( (int)pos.Y() + ay); sheets[animations[current.X()].first.X().X()]->Blit(currentCell, (int)apos.X(), (int)apos.Y()); }
bool TiledImageBlockAccessor::read2HBlocksA16(Int32 iLow, Int32 iHeigh, Vec2i vSampleOrigin, Int32 iTextureSize, Int16 *pTarget, Int32 iTargetSizeBytes) { Vec2i vNewSampleOrigin(vSampleOrigin.x() - _vSampleDescs[iLow].x0, vSampleOrigin.y() - _vSampleDescs[iLow].y0); _vImages[iLow]->readBlockA16(vNewSampleOrigin, iTextureSize, pTarget, iTargetSizeBytes); _vI16Buffer.resize(iTextureSize * iTextureSize); vNewSampleOrigin.setValues(0, vSampleOrigin.y() - _vSampleDescs[iLow ].y0); _vImages[iHeigh]->readBlockA16(vNewSampleOrigin, iTextureSize, &(_vI16Buffer[0]), iTargetSizeBytes); UInt32 destIdx = 0; UInt32 srcIdx = 0; Int32 xMin = vSampleOrigin.x(); Int32 xMax = vSampleOrigin.x() + iTextureSize; Int32 yMin = vSampleOrigin.y(); Int32 yMax = vSampleOrigin.y() + iTextureSize; for(Int32 y = yMin; y < yMax; y++) { srcIdx = (y - yMin) * iTextureSize; for(Int32 x = xMin; x < xMax; x++) { if(x >= _vSampleDescs[iHeigh].x0) { pTarget[destIdx] = _vI16Buffer[srcIdx]; ++srcIdx; } ++destIdx; } } return true; }
//-------------------------------------------------------------------------------------------------- /// Set up camera/viewport and render //-------------------------------------------------------------------------------------------------- void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix) { if (size.x() <= 0 || size.y() <= 0) { return; } if (m_axis.isNull()) { createAxisGeometry(software); } if (m_cubeGeos.size() == 0) { createCubeGeos(); // Create the shader for the cube geometry ShaderProgramGenerator gen("CubeGeoShader", ShaderSourceProvider::instance()); gen.configureStandardHeadlightColor(); m_cubeGeoShader = gen.generate(); m_cubeGeoShader->linkProgram(oglContext); } // Position the camera far enough away to make the axis and the text fit within the viewport Mat4d axisMatrix = viewMatrix; axisMatrix.setTranslation(Vec3d(0, 0, -2.0)); // Setup camera Camera cam; cam.setProjectionAsPerspective(40.0, 0.05, 100.0); cam.setViewMatrix(axisMatrix); cam.setViewport(position.x(), position.y(), size.x(), size.y()); // Setup viewport cam.viewport()->applyOpenGL(oglContext, Viewport::CLEAR_DEPTH); cam.applyOpenGL(); // Do the actual rendering // ----------------------------------------------- MatrixState matrixState(cam); if (software) { renderAxisImmediateMode(oglContext, matrixState); } else { renderAxis(oglContext, matrixState); } renderCubeGeos(oglContext, software, matrixState); renderAxisLabels(oglContext, software, matrixState); }
bool InterModule::getRange(int& a, int& b) { Vec2i range; RangeDialog rd(NULL, a,b); if (rd.exec() == QDialog::Accepted) { range = rd.getRange(); a = range.x(); b = range.y(); return true; } else return false; }
MapScreen::MapScreen(ThyKniteGame *g) : m_game(g) { //m_mapRenderer = std::make_shared<DebugMapRenderer>(RandomWalkerGenerator().generate(60, 60)); map(RandomWalkerGenerator().generate(60, 60)); m_mapRenderer = std::make_shared<TileMapRenderer>(map(), Assets::instance->tilesetSheet->getFrame(2) ); Vec2i fw = findFirstWalkable(); std::cout << fw << std::endl; Vec2f player_pos( fw.x() * 16, fw.y() * 16 ); m_player.reset(new PlayerPawnMap(player_pos, map())); }
void WallComponent::setTiles(bool enable) { Level& level = _obj->scene()->level(); Vec2 tileSize = level.tileMap().tileSize().template cast<float>(); Vec2i first = ((_obj->geom().pos.array() / tileSize.array()).matrix() + Vec2(.5, .5)) .template cast<int>(); int height = _obj->geom().box.sizes().y() / tileSize.y() + .5; _state->game()->log("setTiles(", enable, "): ", first.transpose(), ", ", height); Tile tile = enable? 774: 655; for(unsigned i = 0; i < height; ++i) { level.setTile(first.x(), first.y() + i, 0, tile); if(tile == 774) tile = 838; } }
bool AiInterface::getNearestSightedResource(const ResourceType *rt, const Vec2i &pos, Vec2i &resultPos){ float tmpDist; float nearestDist= infinity; bool anyResource= false; const Map *map= world->getMap(); for(int i=0; i<map->getW(); ++i){ for(int j=0; j<map->getH(); ++j){ Vec2i surfPos= Map::toSurfCoords(Vec2i(i, j)); //if explored cell if(map->getSurfaceCell(surfPos)->isExplored(teamIndex)){ Resource *r= map->getSurfaceCell(surfPos)->getResource(); //if resource cell if(r!=NULL && r->getType()==rt){ tmpDist= pos.dist(Vec2i(i, j)); if(tmpDist<nearestDist){ anyResource= true; nearestDist= tmpDist; resultPos= Vec2i(i, j); } } } } } return anyResource; }
bool Snapshot::CheckIfBeingAttacked(Vec2i &pos, Field &field) { fprintf(logs, "In check if being attacked....\n"); if (aiInterface == NULL) fprintf(logs, " aiInterface is NULL\n"); fflush(logs); int count= aiInterface->onSightUnitCount(); const Unit *unit; int radius = baseRadius; for(int i=0; i<count; ++i){ unit= aiInterface->getOnSightUnit(i); if(!aiInterface->isAlly(unit) && unit->isAlive()){ pos= unit->getPos(); field= unit->getCurrField(); if(pos.dist(aiInterface->getHomeLocation())<radius) { aiInterface->printLog(4, "Being attacked at pos "+intToStr(pos.x)+","+intToStr(pos.y)+"\n"); fprintf(logs," Being attacked at pos %d %d \n" , pos.x ,pos.y); fflush(logs); beingAttacked = 1; return true; } } } aiInterface->printLog(4, "Not Being attacked \n"); fprintf(logs," Not Being attacked \n"); fflush(logs); beingAttacked = 0; return false; }
Vec2 TheGame::GetMouseMovementSinceLastChecked() { Vec2i centerCursorPos = Vec2i((int)(SCREEN_WIDTH/2.f), (int)(SCREEN_HEIGHT/2.f)); Vec2i cursorPos; myWinWrapper.MyGetCursorPos( cursorPos ); myWinWrapper.MySetCursorPos(centerCursorPos.x(), centerCursorPos.y()); Vec2i mouseDeltaInts(cursorPos.x() - centerCursorPos.x(), cursorPos.y() - centerCursorPos.y()); Vec2 mouseDeltas((float)mouseDeltaInts.x(), (float)mouseDeltaInts.y()); return mouseDeltas; }
int LineSegment2x<int>::point_distance(const Vec2i &point) { int L = pow2(q.x - p.x) + pow2(q.y - p.y); int r = ((point.x - p.x)*(q.x - p.x) + (point.y - p.y)*(q.y - p.y)) / L; if (r <= 0 || r >= 1) { return min(point.distance(p), point.distance(q)); } int s = ((p.y - point.y)*(q.x - p.x) - (p.x - point.x)*(q.y - p.y)) / L; s *= (int)(sqrt((float)L) + 0.5f); if (s < 0) s = -s; return s; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool OverlayScalarMapperLegend::pick(int oglXCoord, int oglYCoord, const Vec2i& position, const Vec2ui& size) { Recti oglRect(position, size.x(), size.y()); OverlayColorLegendLayoutInfo layoutInViewPortCoords(oglRect.min(), Vec2ui(oglRect.width(), oglRect.height())); layoutInfo(&layoutInViewPortCoords); Vec2i legendBarOrigin = oglRect.min(); legendBarOrigin.x() += static_cast<uint>(layoutInViewPortCoords.legendRect.min().x()); legendBarOrigin.y() += static_cast<uint>(layoutInViewPortCoords.legendRect.min().y()); Recti legendBarRect = Recti(legendBarOrigin, static_cast<uint>(layoutInViewPortCoords.legendRect.width()), static_cast<uint>(layoutInViewPortCoords.legendRect.height())); if ((oglXCoord > legendBarRect.min().x()) && (oglXCoord < legendBarRect.max().x()) && (oglYCoord > legendBarRect.min().y()) && (oglYCoord < legendBarRect.max().y())) { return true; } return false; }
AviExporter::AviExporter(const String& fileName, Vec2i size, int fps) : m_file (fileName, File::Create), m_size (size), m_frame (size, ImageFormat::R8_G8_B8), m_fps (fps) { FW_ASSERT(size.min() > 0 && fps > 0); m_lineBytes = (m_size.x * 3 + 3) & -4; m_frameBytes = m_lineBytes * m_size.y; m_numFrames = 0; writeHeader(); }
//-------------------------------------------------------------------------------------------------- /// Set up camera/viewport and render //-------------------------------------------------------------------------------------------------- void OverlayScalarMapperLegend::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software) { if (size.x() <= 0 || size.y() <= 0) { return; } Camera camera; camera.setViewport(position.x(), position.y(), size.x(), size.y()); camera.setProjectionAsPixelExact2D(); camera.setViewMatrix(Mat4d::IDENTITY); camera.applyOpenGL(); camera.viewport()->applyOpenGL(oglContext, Viewport::CLEAR_DEPTH); // Get layout information // Todo: Cache this between renderings. Update only when needed. OverlayColorLegendLayoutInfo layout(position, size); layoutInfo(&layout); // Set up text drawer TextDrawer textDrawer(m_font.p()); setupTextDrawer(&textDrawer, &layout); // Do the actual rendering if (software) { renderLegendImmediateMode(oglContext, &layout); textDrawer.renderSoftware(oglContext, camera); } else { const MatrixState matrixState(camera); renderLegend(oglContext, &layout, matrixState); textDrawer.render(oglContext, camera); } CVF_CHECK_OGL(oglContext); }
bool GDALBlockAccessor::readBlockA16(Vec2i vSampleOrigin, Int32 iTextureSize, UInt16 *pTarget, Int32 iTargetSizeBytes) { #ifdef OSG_WITH_GDAL OSG_ASSERT(false); UInt32 destIdx = 0; UInt8 *pDst = reinterpret_cast<UInt8 *>(pTarget); Int32 xMin = vSampleOrigin.x(); Int32 xMax = vSampleOrigin.x() + iTextureSize; Int32 yMin = vSampleOrigin.y(); Int32 yMax = vSampleOrigin.y() + iTextureSize; for(Int32 y = yMin; y < yMax; y++) { for(Int32 x = xMin; x < xMax; x++) { for(UInt32 i = 0; i < 2; i++) { pDst[destIdx] = 0; destIdx++; } } destIdx += (iTextureSize - (xMax - xMin)) * 2; } #endif return false; }
void WindowsWindow::MoveMouse(const Vec2i &coords) { SignalError("Not implemented"); Console::WriteLine("Moving mouse to " + coords.CommaSeparatedString()); POINT currentMousePos; GetCursorPos(¤tMousePos); POINT screenPoint; screenPoint.x = coords.x; screenPoint.y = coords.y; ClientToScreen(_windowHandle, &screenPoint); mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, screenPoint.x, screenPoint.y, 0, NULL); }
Vec2i ChessUtils::computePieceBoardPosition(Vec3 scenePosition) { Vec2i boardPosition; boardPosition.x() = scenePosition.x() / BOARD_SQUARE_SIZE; boardPosition.y() = scenePosition.y() / BOARD_SQUARE_SIZE; if (scenePosition.x() < 0) { --boardPosition.x(); } else { ++boardPosition.x(); } if (scenePosition.y() < 0) { --boardPosition.y(); } else { ++boardPosition.y(); } return boardPosition; }
void Unitenemy::SetDrawPos(Vec2i getpos){ pos.x() = getpos.x() * CHIPSIZE_X; pos.y() = getpos.y() * CHIPSIZE_Y; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void Rendering::calculateOverlayItemLayout(OverlayItemRectMap* itemRectMap, OverlayItem::LayoutCorner corner, OverlayItem::LayoutDirection direction) { const int border = 3; const Vec2i vpSize = Vec2i(static_cast<int>(m_camera->viewport()->width()), static_cast<int>(m_camera->viewport()->height())); const Vec2i vpPos = Vec2i(m_camera->viewport()->x(), m_camera->viewport()->y()); Vec2i cursor(0,0); switch (corner) { case OverlayItem::TOP_LEFT: cursor.set(border, vpSize.y() - border); break; case OverlayItem::TOP_RIGHT: cursor.set(vpSize.x() - border, vpSize.y() - border); break; case OverlayItem::BOTTOM_LEFT: cursor.set(border, border); break; case OverlayItem::BOTTOM_RIGHT: cursor.set(vpSize.x() - border, border); break; default: cursor.set(border,border); } cursor += vpPos; // Adjust based on other already placed items OverlayItemRectMap::iterator it; for (it = itemRectMap->begin(); it != itemRectMap->end(); ++it) { Recti rect = it->second; if (rect.contains(cursor) && (direction == OverlayItem::VERTICAL)) { if (corner == OverlayItem::BOTTOM_LEFT || corner == OverlayItem::BOTTOM_RIGHT) { cursor.y() += rect.height() + border; } else { cursor.y() -= rect.height() + border; } } } size_t numOverlayItems = m_overlayItems.size(); size_t i; for (i = 0; i < numOverlayItems; i++) { OverlayItemLayout item = m_overlayItems.at(i); if ((item.corner == corner) && (item.direction == direction)) { CVF_ASSERT(item.overlayItem.notNull()); // Find this position and size Vec2i position = cursor; Vec2ui size = item.overlayItem->sizeHint(); if ((corner == OverlayItem::TOP_RIGHT) || (corner == OverlayItem::BOTTOM_RIGHT)) { position.x() -= size.x(); } if ((corner == OverlayItem::TOP_LEFT) || (corner == OverlayItem::TOP_RIGHT)) { position.y() -= size.y(); } // Store the position in the map Recti rect(position.x(), position.y(), static_cast<int>(size.x()), static_cast<int>(size.y())); (*itemRectMap)[item.overlayItem.p()] = rect; // Find next position, moving the cursor if (direction == OverlayItem::HORIZONTAL) { if ((corner == OverlayItem::TOP_LEFT) || (corner == OverlayItem::BOTTOM_LEFT)) { cursor.x() += (size.x() + border); } else { cursor.x() -= (size.x() + border); } } else if (direction == OverlayItem::VERTICAL) { if ((corner == OverlayItem::BOTTOM_LEFT) || (corner == OverlayItem::BOTTOM_RIGHT)) { cursor.y() += (size.y() + border); } else { cursor.y() -= (size.y() + border); } } else { CVF_FAIL_MSG("Unhandled OverlayItem::LayoutDirection"); } } } }
void Astar::parentDraw(Vec2i goal_pos){ if (goal_pos == enemy_pos){ drawFillBox(goal_pos.x() * 50, goal_pos.y() * 50, 50, 50, Color::blue); return; } switch (mapchip.map[goal_pos.y()][goal_pos.x()].parent) { case UP: parentDraw(Vec2i(goal_pos.x(), goal_pos.y() + 1)); break; case DOWN: parentDraw(Vec2i(goal_pos.x(), goal_pos.y() - 1)); break; case LEFT: parentDraw(Vec2i(goal_pos.x() - 1, goal_pos.y())); break; case RIGHT: parentDraw(Vec2i(goal_pos.x() + 1, goal_pos.y())); break; } }
TextureSampler::TextureSampler(const Texture& tex) : m_size (0), m_data (NULL) { const Image* image = tex.getImage(); FW_ASSERT(image); m_size = image->getSize(); FW_ASSERT(m_size.min() > 0); // Layout levels. Vec2i size = m_size; int numBytes = 0; do { Level& level = m_levels.add(); level.size = size; level.numBytes = size.x * size.y * ((m_levels.getSize() == 1) ? sizeof(Color) : sizeof(Range)); numBytes += level.numBytes; size.x = (size.x + 1) >> 1; size.y = (size.y + 1) >> 1; } while (size.max() > 1); // Allocate data. { m_data = new U8[numBytes]; U8* ptr = m_data; for (int i = 0; i < m_levels.getSize(); i++) { Level& level = m_levels[i]; level.colors = (i == 0) ? (Color*)ptr : NULL; level.ranges = (i == 0) ? NULL : (Range*)ptr; ptr += level.numBytes; } } // Convert base level. image->read(ImageFormat::R8_G8_B8_A8, m_levels[0].colors, m_size.x * sizeof(Color)); // Generate mipmaps. for (int i = 1; i < m_levels.getSize(); i++) { const Level& level = m_levels[i]; const Level& prev = m_levels[i - 1]; Range* dst = level.ranges; for (int y = 0; y < level.size.y * 2; y += 2) { const Color* srcColor = prev.colors + prev.size.x * y; const Range* srcRange = prev.ranges + prev.size.x * y; int yinc = (y == prev.size.y - 1) ? -prev.size.x * y : prev.size.x; Sample s00, s10, s01, s11; for (int x = 0; x < level.size.x * 2; x += 2) { int xinc = (x == prev.size.x - 1) ? -x : 1; if (prev.colors) { decode(s00, srcColor[0]); decode(s10, srcColor[xinc]); decode(s01, srcColor[yinc]); decode(s11, srcColor[xinc + yinc]); srcColor += 2; } else { decode(s00, srcRange[0]); decode(s10, srcRange[xinc]); decode(s01, srcRange[yinc]); decode(s11, srcRange[xinc + yinc]); srcRange += 2; } lerpMinMax(s00, s10, 0.5f); lerpMinMax(s01, s11, 0.5f); lerpMinMax(s00, s01, 0.5f); encode(*dst++, s00); } } } }
void Cluster::updateAndDrawCluster(Surface &surface, Vec2i imagePosOffset, int scale){ gl::color(0.0f, 0.0f, 0.0f); gl::drawSolidCircle( (getPos()->xy())*scale+imagePosOffset, 4.0f); vector<GroupRef>::iterator it; for(it = groups.begin(); it < groups.end(); it++){ gl::color(1.0f, 1.0f, 1.0f); gl::drawSolidCircle( (getPos()->xy()+(*it)->getPosOffset()->xy())*scale+imagePosOffset, 4.0f); vector<LightRef> *lights = (*it)->getLights(); vector<LightRef>::iterator it2; for(it2 = lights->begin(); it2 < lights->end(); it2++){ vector<LightChannelRef> *channels = (*it2)->getChannels(); vector<LightChannelRef>::iterator it3; for(it3 = channels->begin(); it3 < channels->end(); it3++){ //add all the offsets, to get the end pos of each channel Vec2i pos = getPos()->xy() + (*it)->getPosOffset()->xy() + (*it2)->getPosOffset()->xy() + (*it3)->getPosOffset()->xy(); // get the color of the pixel at pos ColorA8u pixel = surface.getPixel(pos.xy()); // console() << "pixelvalue= " <<(int) surface.getPixel(Vec2i(10,10)).r << endl; try { switch (*(*it3)->getSource()) { case 'R': (*it3)->setValue(pixel.r); gl::color(1.0f, 0.0f, 0.0f); break; case 'G': (*it3)->setValue(pixel.g); gl::color(0.0f, 1.0f, 0.0f); break; case 'B': (*it3)->setValue(pixel.b); gl::color(0.0f, 0.0f, 1.0f); break; case 'A': (*it3)->setValue(0); gl::color(1.0f, 1.0f, 1.0f); break; default: break; } } catch (InvalidValueException &e) { console() << e.getMessage() << "Could not update Channel" << endl; } //draw each channel // when resize syphone image draw circles on the rigth position gl::drawSolidCircle((pos.xy()*scale)+imagePosOffset, 4.0f); gl::color(1.0f, 1.0f, 1.0f); } } } }
int Astar::nowCost(Vec2i start_pos, Vec2i goal_pos){ return std::abs(goal_pos.x() - start_pos.x()) + std::abs(goal_pos.y() - start_pos.y()); }