(Xbox 1) Font cleanups

This commit is contained in:
twinaphex 2012-12-15 07:16:02 +01:00
parent 799a9c35fb
commit 875b6b6f2e
3 changed files with 14 additions and 14 deletions

View File

@ -18,6 +18,9 @@
#include "d3d_font.h"
#include "../../general.h"
static XFONT *debug_font;
static D3DSurface *pFrontBuffer;
static bool xfonts_init_font(void *data, const char *font_path, unsigned font_size)
{
(void)font_path;
@ -25,11 +28,11 @@ static bool xfonts_init_font(void *data, const char *font_path, unsigned font_si
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
XFONT_OpenDefaultFont(&d3d->debug_font);
d3d->debug_font->SetBkMode(XFONT_TRANSPARENT);
d3d->debug_font->SetBkColor(D3DCOLOR_ARGB(100,0,0,0));
d3d->debug_font->SetTextHeight(14);
d3d->debug_font->SetTextAntialiasLevel(d3d->debug_font->GetTextAntialiasLevel());
XFONT_OpenDefaultFont(&debug_font);
debug_font->SetBkMode(XFONT_TRANSPARENT);
debug_font->SetBkColor(D3DCOLOR_ARGB(100,0,0,0));
debug_font->SetTextHeight(14);
debug_font->SetTextAntialiasLevel(debug_font->GetTextAntialiasLevel());
return true;
}
@ -43,13 +46,13 @@ static void xfonts_render_msg_place(void *data, float x, float y, float scale, u
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &d3d->pFrontBuffer);
d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &pFrontBuffer);
wchar_t str[256];
convert_char_to_wchar(str, msg, sizeof(str));
d3d->debug_font->TextOut(d3d->pFrontBuffer, str, (unsigned)-1, x, y);
debug_font->TextOut(pFrontBuffer, str, (unsigned)-1, x, y);
d3d->pFrontBuffer->Release();
pFrontBuffer->Release();
}
static void xfonts_render_msg(void *data, const char *msg)

View File

@ -37,7 +37,6 @@
#include "../xdk/xdk_resources.h"
#if defined(_XBOX1)
wchar_t strw_buffer[128];
unsigned font_x, font_y;
#elif defined(_XBOX360)
const DWORD g_MapLinearToSrgbGpuFormat[] =
@ -805,10 +804,12 @@ static bool xdk_d3d_frame(void *data, const void *frame,
char buf[128];
snprintf(buf, sizeof(buf), "%.2f MB free / %.2f MB total", stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
if (d3d->font_ctx)
d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height, 0, 0, buf);
gfx_get_fps(fps_txt, sizeof(fps_txt), true);
d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height + 30, 0, 0, fps_txt);
if (d3d->font_ctx)
d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height + 30, 0, 0, fps_txt);
}
if (msg

View File

@ -75,10 +75,6 @@ typedef struct xdk_d3d_video
IDirect3DVertexDeclaration9* v_decl;
#endif
const d3d_font_renderer_t *font_ctx;
#if defined(_XBOX1)
XFONT *debug_font;
D3DSurface *pBackBuffer, *pFrontBuffer;
#endif
D3DFORMAT internal_fmt;
D3DFORMAT texture_fmt;
unsigned base_size;