[][src]Module vxdraw::debtri

Methods and types to control debug triangles

A debug triangle is a triangle that ignores all global transformations and is always shown on the screen (except when a triangle's coordinates are outside the screen). Debug triangles are meant to be used to quickly find out if a state has been reached (for instance, change the color of a debug triangle if collision is detected, or rotate a debug triangle while loading).

Debug triangles always ignore all layers, and are always shown on top of the entire scene.

See debtri::Debtri for all operations supported on debug triangles.

use vxdraw::{prelude::*, void_logger, Color, Deg, Matrix4, ShowWindow, VxDraw};
fn main() {
    #[cfg(feature = "doctest-headless")]
    let mut vx = VxDraw::new(void_logger(), ShowWindow::Headless1k);
    #[cfg(not(feature = "doctest-headless"))]
    let mut vx = VxDraw::new(void_logger(), ShowWindow::Enable);

    let tri = vx.debtri().add(vxdraw::debtri::DebugTriangle::default());

    // Turn the triangle white
    vx.debtri().set_color(&tri, Color::Rgba(255, 255, 255, 255));

    // Rotate the triangle 90 degrees (counter clockwise)
    vx.debtri().set_rotation(&tri, Deg(90.0));

    // Draw the frame with the identity matrix transformation (meaning no transformations)
    vx.draw_frame();

    // Sleep here so the window does not instantly disappear
    #[cfg(not(feature = "doctest-headless"))]
    std::thread::sleep(std::time::Duration::new(3, 0));
}

Structs

Debtri

Debug triangles accessor object returned by VxDraw::debtri

DebugTriangle

Information used when creating/updating a debug triangle

Handle

Handle to a debug triangle