SetColor
Syntax
- void SetColor(const Vec4& color)
- void SetColor(float r, float g, float b )
- void SetColor(float r, float g, float b, const float a)
Parameters
- color: the context drawing color to set.
- r: the red component of the context drawing color to set.
- g: the green component of the context drawing color to set.
- b: the blue component of the context drawing color to set.
- a: the alpha component of the context drawing color to set.
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();
//Draw a rectangle on the screen
context->SetColor(1.0, 0.0, 0.0);
context->DrawRect(100, 100, context->GetWidth() - 200, context->GetHeight() - 200);
context->Sync();
}
return 0;
}