- Messages
- 162
- Country
Have mercy on me, explain to me why in this code:
both OuterCircle() and Pipper() work nicely instead Crosses() refuses to draw 2 simple lines even if called in sequence:
Code:
void Gunsight::OuterCircle(void) {
nvgBeginPath(ctx);
nvgEllipse(ctx, 0, 0, size.w, size.h);
nvgStrokeColor(ctx, nvgRGBAf(255, 255, 255, alpha));
nvgStrokeWidth(ctx, thickness);
nvgStroke(ctx);
nvgClosePath(ctx);
}
//////////////////////////////
void Gunsight::Pipper(void) {
// pipper
nvgBeginPath(ctx);
nvgEllipse(ctx, -10, -10, 10, 10);
nvgStrokeColor(ctx, nvgRGBAf(255, 255, 255, alpha));
nvgStrokeWidth(ctx, thickness);
nvgStroke(ctx);
nvgClosePath(ctx);
}
///////////////////////////////
void Gunsight::Crosses(void) {
nvgBeginPath(ctx);
nvgMoveTo(ctx, center.x, center.y - size.h/2.0);
nvgLineTo(ctx, center.x, center.y - size.h/4.0);
nvgMoveTo(ctx, center.x - size.w/2.0, center.y);
nvgLineTo(ctx, center.x - size.w/4.0, center.y);
nvgStrokeColor(ctx, nvgRGBAf(255, 255, 255, alpha));
nvgStrokeWidth(ctx, thickness);
nvgStroke(ctx);
nvgClosePath(ctx);
}
both OuterCircle() and Pipper() work nicely instead Crosses() refuses to draw 2 simple lines even if called in sequence:
Code:
nvgBeginFrame(myGunsight->ctx, p_draw_data->winWidth, p_draw_data->winHeight, pxRatio);
{
// go to center
nvgTranslate(myGunsight->ctx, myGunsight->center.x, myGunsight->center.y);
// Outer circle
myGunsight->OuterCircle();
// pipper
myGunsight->Pipper();
// fails
myGunsight->Crosses();
}
nvgEndFrame(myGunsight->ctx);