Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions src/rshapes.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,50 @@ void SetShapesTexture(Texture2D texture, Rectangle source)
// Draw a pixel
void DrawPixel(int posX, int posY, Color color)
{
rlBegin(RL_LINES);
rlColor4ub(color.r, color.g, color.b, color.a);
rlVertex2f(posX, posY);
rlVertex2f(posX + 1, posY + 1);
rlEnd();
DrawPixelV((Vector2){ posX, posY }, color);
}

// Draw a pixel (Vector version)
void DrawPixelV(Vector2 position, Color color)
{
rlBegin(RL_LINES);
#if defined(SUPPORT_QUADS_DRAW_MODE)
rlSetTexture(texShapes.id);

rlBegin(RL_QUADS);

rlNormal3f(0.0f, 0.0f, 1.0f);
rlColor4ub(color.r, color.g, color.b, color.a);

rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height);
rlVertex2f(position.x, position.y);

rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height);
rlVertex2f(position.x, position.y + 1);

rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height);
rlVertex2f(position.x + 1, position.y + 1);

rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height);
rlVertex2f(position.x + 1, position.y);

rlEnd();

rlSetTexture(0);
#else
rlBegin(RL_TRIANGLES);

rlColor4ub(color.r, color.g, color.b, color.a);

rlVertex2f(position.x, position.y);
rlVertex2f(position.x + 1.0f, position.y + 1.0f);
rlVertex2f(position.x, position.y + 1);
rlVertex2f(position.x + 1, position.y);

rlVertex2f(position.x + 1, position.y);
rlVertex2f(position.x, position.y + 1);
rlVertex2f(position.x + 1, position.y + 1);

rlEnd();
#endif
}

// Draw a line
Expand Down