Ejemplo n.º 1
0
int disk_error_handler(int errval, int ax, int bp, int si)
{

	rect R, R2;
	char tbuf[128];
	int err;

	int centerx = sR.Xmax / 2;
	int centery = sR.Ymax / 2;

	int height = 2 * FontHeight + 10;
	int width = sR.Xmax / 2;

	R.Xmin = sR.Xmax / 4;
	R.Xmax = R.Xmin + width;

	R.Ymin = centery - height / 2;
	R.Ymax = R.Ymin + height;

	PushRect(&R, &err);


	if (ax < 0)
		sprintf(tbuf, "Device error %x: %x %p", errval, ax, MK_FP(bp, si));
	else
		sprintf(tbuf, "Disk error on drive %c", 'A' + (ax & 0xff));

	PenColor(MENUBACK);
	PaintRect(&R);
	PenColor(MENUTEXT);
	BackColor(MENUBACK);
	R2 = R;
	InsetRect(&R2, 2, 2);
	FrameRect(&R2);

	TextAlign(alignCenter, alignTop);
	MoveTo(centerx, R.Ymin + 4);
	DrawString(tbuf);
	MoveTo(centerx, R.Ymin + FontHeight + 4);
	DrawString("Hit any key to continue");

	getch();
	PopRect(&err);
	hardretn(-1);
#pragma warn -rvl
}
Ejemplo n.º 2
0
inline void
EndElement(layout_element *Element)
{
    layout *Layout = Element->Layout;
    debug_state *DebugState = Layout->DebugState;

    r32 SizeHandlePixels = 4.0f;

    v2 Frame = V2(0, 0);
    if (Element->Size) {
        Frame.x = SizeHandlePixels;
        Frame.y = SizeHandlePixels;
    }
    v2 TotalDim = *Element->Dim + 2.0f * Frame;

    v2 TotalMinCorner = V2(Layout->At.x + Layout->Depth * 2.0f * Layout->LineAdvance,
                           Layout->At.y - TotalDim.y);
    v2 TotalMaxCorner = TotalMinCorner + TotalDim;

    v2 InteriorMinCorner = TotalMinCorner + Frame;
    v2 InteriorMaxCorner = InteriorMinCorner + *Element->Dim;

    rectangle2 TotalBounds = RectMinMax(TotalMinCorner, TotalMaxCorner);
    Element->Bounds = RectMinMax(InteriorMinCorner, InteriorMaxCorner);

    if (Element->Interaction.Type && IsInRectangle(Element->Bounds, Layout->MouseP)) {
        DebugState->NextHotInteraction = Element->Interaction;
    }

    if (Element->Size) {
        PushRect(DebugState->RenderGroup, RectMinMax(V2(TotalMinCorner.x, InteriorMinCorner.y),
                                                     V2(InteriorMaxCorner.x, InteriorMaxCorner.y)),
                 0.0f, V4(0, 0, 0, 1));

        PushRect(DebugState->RenderGroup, RectMinMax(V2(InteriorMaxCorner.x, InteriorMinCorner.y),
                                                     V2(TotalMaxCorner.x, InteriorMaxCorner.y)),
                 0.0f, V4(0, 0, 0, 1));
        PushRect(DebugState->RenderGroup, RectMinMax(V2(InteriorMinCorner.x, TotalMinCorner.y),
                                                     V2(InteriorMaxCorner.x, InteriorMinCorner.y)),
                 0.0f, V4(0, 0, 0, 1));
        PushRect(DebugState->RenderGroup, RectMinMax(V2(InteriorMinCorner.x, InteriorMaxCorner.y),
                                                     V2(InteriorMaxCorner.x, TotalMaxCorner.y)),
                 0.0f, V4(0, 0, 0, 1));

        debug_interaction SizeInteraction = {};
        SizeInteraction.Type = DebugInteraction_Resize;
        SizeInteraction.P = Element->Size;

        rectangle2 SizeBox = RectMinMax(V2(InteriorMaxCorner.x, TotalMinCorner.y),
                                        V2(TotalMaxCorner.x, InteriorMinCorner.y));
        PushRect(DebugState->RenderGroup, SizeBox, 0.0f,
                 InteractionIsHot(DebugState, SizeInteraction) ? V4(1, 1, 0, 1) : V4(1, 1, 1, 1));
        if (IsInRectangle(SizeBox, Layout->MouseP)) {
            DebugState->NextHotInteraction = SizeInteraction;
        }
    }

    r32 SpacingY = Layout->SpacingY;
    if (0) {
        SpacingY = 0.0f;
    }
    Layout->At.y = GetMinCorner(TotalBounds).y - SpacingY;

}
Ejemplo n.º 3
0
	void GLKernel::PushRect(float32 x, float32 y, float32 w, float32 h)
	{
		PushRect(x, y, w, h, 0, 0, 1, 1);
	}
Ejemplo n.º 4
0
internal void
DrawProfileIn(debug_state *DebugState, rectangle2 ProfileRect, v2 MouseP) {
    PushRect(DebugState->RenderGroup, ProfileRect, 0.0f, V4(0, 0, 0, 0.25f));

    r32 BarSpacing = 4.0f;
    r32 LaneHeight = 0.0f;
    u32 LaneCount = DebugState->FrameBarLaneCount;

    u32 MaxFrame = DebugState->FrameCount;
    if (MaxFrame > 10) {
        MaxFrame = 10;
    }

    if (LaneCount > 0 && MaxFrame > 0) {
        r32 PixelsPerFramePlusSpacing = GetDim(ProfileRect).y / (r32)MaxFrame;
        r32 PixelsPerFrame = PixelsPerFramePlusSpacing - BarSpacing;
        LaneHeight = PixelsPerFrame / (r32)LaneCount;
    }

    r32 BarHeight = LaneHeight * LaneCount;
    r32 BarsPlusSpacing = BarHeight + BarSpacing;
    r32 ChartLeft = ProfileRect.Min.x;
    r32 ChartHeight = BarSpacing * (r32)MaxFrame;
    r32 ChartWidth = GetDim(ProfileRect).x;
    r32 ChartTop = ProfileRect.Max.y;
    r32 Scale = ChartWidth * DebugState->FrameBarScale;

    v3 Colors[] = {
        {1, 0, 0},
        {0, 1, 0},
        {0, 0, 1},
        {1, 1, 0},
        {0, 1, 1},
        {1, 0, 1},
        {1, 0.5f, 0},
        {1, 0, 0.5f},
        {0.5f, 1, 0},
        {0, 1, 0.5f},
        {0.5f, 0, 1},
        {0, 0.5f, 1},
    };

#if 1
    for (u32 FrameIndex = 0; FrameIndex < MaxFrame; ++FrameIndex) {
        debug_frame *Frame = DebugState->Frames + DebugState->FrameCount - (FrameIndex + 1);
        r32 StackX = ChartLeft;
        r32 StackY = ChartTop - BarsPlusSpacing * (r32)FrameIndex;
        r32 PrevTimestampSeconds = 0.0f;
        for (u32 RegionIndex = 0; RegionIndex < Frame->RegionCount; ++RegionIndex) {
            debug_frame_region *Region = Frame->Regions + RegionIndex;

            // v3 Color = Colors[RegionIndex % ArrayCount(Colors)];
            v3 Color = Colors[Region->ColorIndex % ArrayCount(Colors)];
            r32 ThisMinX = StackX + Scale * Region->MinT;
            r32 ThisMaxX = StackX + Scale * Region->MaxT;

            rectangle2 RegionRect = RectMinMax(V2(ThisMinX, StackY - LaneHeight * (Region->LaneIndex + 1)),
                                               V2(ThisMaxX, StackY - LaneHeight * Region->LaneIndex));

            PushRect(DebugState->RenderGroup, RegionRect, 0.0f, V4(Color, 1));

            if (IsInRectangle(RegionRect, MouseP)) {
                debug_record *Record = Region->Record;
                char buf[512];
                snprintf(buf, 512, "%s: %10llucy [%s(%d)]\n",
                         Record->BlockName,
                         Region->CycleCount,
                         Record->FileName,
                         Record->LineNumber);
                DEBUGTextOutAt(MouseP + V2(0.0f, 10.0f), buf);

                // HotRecord = Record;
            }
        }
    }
#endif
#if 0
    PushRect(RenderGroup, V3(ChartLeft + 0.5f * ChartWidth, ChartMinY + ChartHeight, 0.0f),
             V2(ChartWidth, 1.0f), V4(1, 1, 1, 1));
#endif
}