Graphics

namespace tnt

Functions

TNT_API void drawLine (Window const &win, Vector const &start, Vector const &finish, SDL_Color const color=SDL_Color{255, 255, 255}, unsigned const thickness=1)

Draw a line on the given window with the specified color from start to finish that is thickness pixels thick.

Parameters
  • win: The window where the line will be drawed.

  • start: The starting point of the line.

  • finish: The other tip of the line.

  • color: The color that will be used to draw the line. Default to white.

  • thickness: Parameter specifying how thick the line will be. Default to 1.

TNT_API void drawHorizontalLine (Window const &win, float const x1, float const x2, float const y, SDL_Color const color=SDL_Color{255, 255, 255}, unsigned const thickness=1)

Draw a horizontal line on the given window with the specified color from ( x1, y) to ( x2, y) that is thickness pixels thick.

Parameters
  • win: The window where the line will be drawed.

  • x1: The starting x position of the line.

  • x2: The x position of the other tip of the line.

  • y: The y position of each point on the line.

  • color: The color that will be used to draw the line. Default to white.

  • thickness: Parameter specifying how thick the line will be. Default to 1.

TNT_API void drawVerticalLine (Window const &win, float const x, float const y1, float const y2, SDL_Color const color=SDL_Color{255, 255, 255}, unsigned const thickness=1)

Draw a vertical line on the given window with the specified color from ( x, y1) to ( x, y2) that is thickness pixels thick.

Parameters
  • win: The window where the line will be drawed.

  • x: The x position of each point on the line.

  • y1: The starting y position of the line.

  • y2: The y position of the other tip of the line.

  • color: The color that will be used to draw the line. Default to white.

  • thickness: Parameter specifying how thick the line will be. Default to 1.

TNT_API void drawLines (Window const &win, std::span< tnt::Vector > points, SDL_Color const color=SDL_Color{255, 255, 255})

Draw lines defined by points with the given color on win.

Parameters
  • win: The window where the lines will be drawed.

  • points: The points that define the lines borders. points.size() should be even.

  • color: The color that will be used to draw the lines.