• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Xevion / Pac-Man / 16902905385

12 Aug 2025 08:07AM UTC coverage: 45.41% (-0.5%) from 45.95%
16902905385

Pull #1

github

web-flow
chore(deps): bump actions/checkout from 4 to 5 in the dependencies group

Bumps the dependencies group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4 to 5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #1: chore(deps): bump actions/checkout from 4 to 5 in the dependencies group

737 of 1623 relevant lines covered (45.41%)

297.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.28
/src/map/render.rs
1
//! Map rendering functionality.
2

3
use crate::texture::sprite::{AtlasTile, SpriteAtlas};
4
use crate::texture::text::TextTexture;
5
use glam::Vec2;
6
use sdl2::pixels::Color;
7
use sdl2::rect::{Point, Rect};
8
use sdl2::render::{Canvas, RenderTarget};
9

10
/// Handles rendering operations for the map.
11
pub struct MapRenderer;
12

13
impl MapRenderer {
14
    /// Renders the map to the given canvas.
15
    ///
16
    /// This function draws the static map texture to the screen at the correct
17
    /// position and scale.
18
    pub fn render_map<T: RenderTarget>(canvas: &mut Canvas<T>, atlas: &mut SpriteAtlas, map_texture: &mut AtlasTile) {
×
19
        let dest = Rect::new(
×
20
            crate::constants::BOARD_PIXEL_OFFSET.x as i32,
×
21
            crate::constants::BOARD_PIXEL_OFFSET.y as i32,
×
22
            crate::constants::BOARD_PIXEL_SIZE.x,
×
23
            crate::constants::BOARD_PIXEL_SIZE.y,
×
24
        );
×
25
        let _ = map_texture.render(canvas, atlas, dest);
×
26
    }
×
27

28
    /// Renders a debug visualization with cursor-based highlighting.
29
    ///
30
    /// This function provides interactive debugging by highlighting the nearest node
31
    /// to the cursor, showing its ID, and highlighting its connections.
32
    pub fn debug_render_with_cursor<T: RenderTarget>(
×
33
        graph: &crate::entity::graph::Graph,
×
34
        canvas: &mut Canvas<T>,
×
35
        text_renderer: &mut TextTexture,
×
36
        atlas: &mut SpriteAtlas,
×
37
        cursor_pos: Vec2,
×
38
    ) {
×
39
        // Find the nearest node to the cursor
×
40
        let nearest_node = Self::find_nearest_node(graph, cursor_pos);
×
41

×
42
        // Draw all connections in blue
×
43
        canvas.set_draw_color(Color::RGB(0, 0, 128)); // Dark blue for regular connections
×
44
        for i in 0..graph.node_count() {
×
45
            let node = graph.get_node(i).unwrap();
×
46
            let pos = node.position + crate::constants::BOARD_PIXEL_OFFSET.as_vec2();
×
47

48
            for edge in graph.adjacency_list[i].edges() {
×
49
                let end_pos = graph.get_node(edge.target).unwrap().position + crate::constants::BOARD_PIXEL_OFFSET.as_vec2();
×
50
                canvas
×
51
                    .draw_line((pos.x as i32, pos.y as i32), (end_pos.x as i32, end_pos.y as i32))
×
52
                    .unwrap();
×
53
            }
×
54
        }
55

56
        // Draw all nodes in green
57
        canvas.set_draw_color(Color::RGB(0, 128, 0)); // Dark green for regular nodes
×
58
        for i in 0..graph.node_count() {
×
59
            let node = graph.get_node(i).unwrap();
×
60
            let pos = node.position + crate::constants::BOARD_PIXEL_OFFSET.as_vec2();
×
61

×
62
            canvas
×
63
                .fill_rect(Rect::new(0, 0, 3, 3).centered_on(Point::new(pos.x as i32, pos.y as i32)))
×
64
                .unwrap();
×
65
        }
×
66

67
        // Highlight connections from the nearest node in bright blue
68
        if let Some(nearest_id) = nearest_node {
×
69
            let nearest_pos = graph.get_node(nearest_id).unwrap().position + crate::constants::BOARD_PIXEL_OFFSET.as_vec2();
×
70

×
71
            canvas.set_draw_color(Color::RGB(0, 255, 255)); // Bright cyan for highlighted connections
×
72
            for edge in graph.adjacency_list[nearest_id].edges() {
×
73
                let end_pos = graph.get_node(edge.target).unwrap().position + crate::constants::BOARD_PIXEL_OFFSET.as_vec2();
×
74
                canvas
×
75
                    .draw_line(
×
76
                        (nearest_pos.x as i32, nearest_pos.y as i32),
×
77
                        (end_pos.x as i32, end_pos.y as i32),
×
78
                    )
×
79
                    .unwrap();
×
80
            }
×
81

82
            // Highlight the nearest node in bright green
83
            canvas.set_draw_color(Color::RGB(0, 255, 0)); // Bright green for highlighted node
×
84
            canvas
×
85
                .fill_rect(Rect::new(0, 0, 5, 5).centered_on(Point::new(nearest_pos.x as i32, nearest_pos.y as i32)))
×
86
                .unwrap();
×
87

×
88
            // Draw node ID text (small, offset to top right)
×
89
            text_renderer.set_scale(0.5); // Small text
×
90
            let id_text = format!("#{nearest_id}");
×
91
            let text_pos = glam::UVec2::new(
×
92
                (nearest_pos.x + 4.0) as u32, // Offset to the right
×
93
                (nearest_pos.y - 6.0) as u32, // Offset to the top
×
94
            );
×
95
            let _ = text_renderer.render(canvas, atlas, &id_text, text_pos);
×
96
        }
×
97
    }
×
98

99
    /// Finds the nearest node to the given cursor position.
100
    pub fn find_nearest_node(graph: &crate::entity::graph::Graph, cursor_pos: Vec2) -> Option<usize> {
3✔
101
        let mut nearest_id = None;
3✔
102
        let mut nearest_distance = f32::INFINITY;
3✔
103

104
        for i in 0..graph.node_count() {
9✔
105
            let node = graph.get_node(i).unwrap();
9✔
106
            let node_pos = node.position + crate::constants::BOARD_PIXEL_OFFSET.as_vec2();
9✔
107
            let distance = cursor_pos.distance(node_pos);
9✔
108

9✔
109
            if distance < nearest_distance {
9✔
110
                nearest_distance = distance;
6✔
111
                nearest_id = Some(i);
6✔
112
            }
6✔
113
        }
114

115
        nearest_id
3✔
116
    }
3✔
117
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc