(self, display)
| 1145 | self.map_image.scale_map(scale_factor) |
| 1146 | |
| 1147 | def render(self, display): |
| 1148 | if self.actors_with_transforms is None: |
| 1149 | return |
| 1150 | self.result_surface.fill(COLOR_BLACK) |
| 1151 | vehicles, traffic_lights, speed_limits, walkers = self._split_actors() |
| 1152 | |
| 1153 | scale_factor = self.module_input.wheel_offset |
| 1154 | self.scaled_size = int(self.map_image.width * scale_factor) |
| 1155 | if self.scaled_size != self.prev_scaled_size: |
| 1156 | self._compute_scale(scale_factor) |
| 1157 | |
| 1158 | # Render Actors |
| 1159 | |
| 1160 | self.actors_surface.fill(COLOR_BLACK) |
| 1161 | self.render_actors( |
| 1162 | self.actors_surface, |
| 1163 | vehicles, |
| 1164 | traffic_lights, |
| 1165 | speed_limits, |
| 1166 | walkers) |
| 1167 | |
| 1168 | # Render Ids |
| 1169 | self.module_hud.render_vehicles_ids(self.vehicle_id_surface, vehicles, |
| 1170 | self.map_image.world_to_pixel, self.hero_actor, self.hero_transform) |
| 1171 | |
| 1172 | # Blit surfaces |
| 1173 | surfaces = ((self.map_image.surface, (0, 0)), |
| 1174 | (self.actors_surface, (0, 0)), |
| 1175 | (self.vehicle_id_surface, (0, 0)), |
| 1176 | ) |
| 1177 | |
| 1178 | angle = 0.0 if self.hero_actor is None else self.hero_transform.rotation.yaw + 90.0 |
| 1179 | self.traffic_light_surfaces.rotozoom(-angle, self.map_image.scale) |
| 1180 | |
| 1181 | center_offset = (0, 0) |
| 1182 | if self.hero_actor is not None: |
| 1183 | |
| 1184 | hero_location_screen = self.map_image.world_to_pixel(self.hero_transform.location) |
| 1185 | hero_front = self.hero_transform.get_forward_vector() |
| 1186 | translation_offset = ( |
| 1187 | hero_location_screen[0] - |
| 1188 | self.hero_surface.get_width() / |
| 1189 | 2 + |
| 1190 | hero_front.x * |
| 1191 | PIXELS_AHEAD_VEHICLE, |
| 1192 | (hero_location_screen[1] - |
| 1193 | self.hero_surface.get_height() / |
| 1194 | 2 + |
| 1195 | hero_front.y * |
| 1196 | PIXELS_AHEAD_VEHICLE)) |
| 1197 | |
| 1198 | # Apply clipping rect |
| 1199 | clipping_rect = pygame.Rect(translation_offset[0], |
| 1200 | translation_offset[1], |
| 1201 | self.hero_surface.get_width(), |
| 1202 | self.hero_surface.get_height()) |
| 1203 | self.clip_surfaces(clipping_rect) |
| 1204 |
nothing calls this directly
no test coverage detected