void blitPoints(Pt_t *points, int nPoints, struct color c){ SDL_FillRect(gui.point, NULL, SDL_MapRGB(gui.ecran->format, c.r, c.g, c.b)); for(int i=0; i<nPoints; i++){ /*#ifndef DEBUG_DO_NOT_REMOVE_POINTS if( points[i].x == 0 && points[i].y == 0) continue; #endif*/ SDL_Rect p = getPixelCoord(points[i].x, points[i].y); SDL_BlitSurface(gui.point, NULL, gui.ecran, &p ); } }
void blitRobots(Cluster_t *robots, int nRobots, struct color c){ SDL_FillRect(gui.robot, NULL, SDL_MapRGB(gui.ecran->format, c.r, c.g, c.b)); int i, maxsize = 0; for (i=0; i<nRobots; i++) { if (robots[i].size > maxsize) { maxsize = robots[i].size; } } for(i=0; i<nRobots; i++){ int size_to_blit = GUI_ROBOT_SIZE * ((float)robots[i].size / (float)maxsize); SDL_Rect p = getPixelCoord(robots[i].center.x-size_to_blit/2, robots[i].center.y+size_to_blit/2); SDL_BlitSurface(gui.robot, NULL, gui.ecran, &p ); } }
RXYWH Coordinate::getRelativeCoord(string XmlFile, string context, string GraphicsFile, REL_RULE rr){ RXYWH rv; XYWH pix = getPixelCoord(XmlFile, context, GraphicsFile); rv.y = (float)pix.y / 768.0f; rv.h = (float)pix.h / 768.0f; if (mAspectRatio >= 1.6){ rv.x = (float)pix.x / 1360.0f; rv.w = (float)pix.w / 1360.0f; if (rv.x > .565){ rv.x += .25; }else if (rv.x > .188){ rv.x += .12; } }else{ rv.x = (float)pix.x / 1024.0f; rv.w = (float)pix.w / 1024.0f; } return rv; }
void blitLidar(Pt_t positionLidar, struct color c){ SDL_Rect p = getPixelCoord(positionLidar.x-LIDAR_SIZE/2, positionLidar.y+LIDAR_SIZE/2); SDL_FillRect(gui.lidar, NULL, SDL_MapRGB(gui.ecran->format, c.r, c.g, c.b)); SDL_BlitSurface(gui.lidar, NULL, gui.ecran, &p); }