Add function to calculate line direction

This commit is contained in:
2024-01-24 22:43:55 +00:00
parent 9139dae379
commit 04855478fd
2 changed files with 9 additions and 0 deletions

View File

@@ -72,6 +72,13 @@ void clear_window(const window *wnd, colour colour) {
void swap_buffers(const window *wnd) { SDL_RenderPresent(wnd->renderer); }
vec2 line_direction(const line *ln) {
return (vec2){
.x = ln->p1.x - ln->p0.x,
.y = ln->p1.y - ln->p0.y,
};
}
void draw_point(const window *wnd, point p, colour colour) {
set_colour(wnd, colour);
SDL_RenderDrawPoint(wnd->renderer, p.x, p.y);