DrawLine
Syntax
- void DrawLine(int x0, int y0, int x1, int y1, bool drawlastpixel=false)
Parameters
- x0: Horizontal starting position.
- y0: Vertical starting position.
- x1: Horizontal end position.
- y1: Vertical end position.
- drawlastpixel: If true fill in the last pixel, otherwise it is skipped.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
while (true)
{
if (window->Closed() || window->KeyHit(Key::Escape)) break;
context->SetColor(0.0, 0.0, 1.0);
context->Clear();
context->SetColor(1.0, 1.0, 1.0);
context->DrawLine(0, 0, 200, 200);
context->Sync();
}
return 0;
}