void DumpObject::PutCharScreen(BYTE c)
{
    Uint32 ucs[2];
    AG_Surface *r = NULL;

    if(Sym2UCS4(c, ucs) && (c != 0x20)) {
        if(pDbgDialogSymFont != NULL) {
            AG_PushTextState();
            AG_TextFont(pDbgDialogSymFont);
            AG_TextColor(fgColor);
            AG_TextBGColor(bgColor);
            AG_TextValign(AG_TEXT_MIDDLE);
            r = AG_TextRenderUCS4((const Uint32 *)ucs);
            AG_PopTextState();
        }
    } else if(Txt2UCS4(c, ucs) && (c != 0x20)) {
        if(pDbgDialogTextFont != NULL) {
            AG_PushTextState();
            AG_TextFont(pDbgDialogTextFont);
            AG_TextColor(fgColor);
            AG_TextBGColor(bgColor);
            AG_TextValign(AG_TEXT_MIDDLE);
            r = AG_TextRenderUCS4((const Uint32 *)ucs);
            AG_PopTextState();
        }
    }
    {   // Clear Cursor position 20130122 (-_-;
        AG_Rect rect;
        rect.x = X * CHRW;
        rect.y = Y * CHRH;
        rect.w = CHRW;
        rect.h = CHRH;
        AG_FillRect(Screen, &rect, bgColor);
    }
    if(r != NULL) {
        if(Screen != NULL) {
            AG_SurfaceBlit(r, NULL, Screen, X * CHRW, Y * CHRH);
        }
        AG_SurfaceFree(r);
    }

}
Esempio n. 2
0
static void
RenderText(VG_Text *vt, char *sIn, VG_View *vv)
{
	char sSubst[VG_TEXT_MAX], *s;
	VG_Vector v1, v2, vMid;
	int x, y;
	int su;

	if (vt->vsObj != NULL) {
		AG_VariableSubst(vt->vsObj, sIn, sSubst, sizeof(sSubst));
		s = sSubst;
	} else {
		s = sIn;
	}

	AG_PushTextState();

	if (vt->fontFace[0] != '\0' &&
	   ((agGUI && vt->fontSize != (int)agDefaultFont->spec.size) ||
	    (agGUI && vt->fontFlags != agDefaultFont->flags))) {
		AG_TextFontLookup(vt->fontFace, vt->fontSize, vt->fontFlags);
	}
	AG_TextColor(VG_MapColorRGB(VGNODE(vt)->color));

	v1 = VG_Pos(vt->p1);
	v2 = VG_Pos(vt->p2);
	vMid.x = v1.x + (v2.x - v1.x)/2.0f;
	vMid.y = v1.y + (v2.y - v1.y)/2.0f;
	VG_GetViewCoords(vv, vMid, &x, &y);
	
	if ((su = AG_TextCacheGet(vv->tCache, s)) != -1) {
		VG_DrawSurface(vv, x, y,
		    VG_Degrees(VG_Atan2(v1.y-v2.y, v1.x-v2.x)),
		    su);
	}
	AG_PopTextState();
}