From b425531dd970b24ad7689c7d981b467efee9e091 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 31 Jul 2012 00:14:23 +0200 Subject: [PATCH] (Xbox 1) Add Xbox 1 font files --- gfx/fonts/xdk1_xfonts.c | 52 +++++++++++++++++++++++++++++++++++++++++ gfx/fonts/xdk1_xfonts.h | 32 +++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 gfx/fonts/xdk1_xfonts.c create mode 100644 gfx/fonts/xdk1_xfonts.h diff --git a/gfx/fonts/xdk1_xfonts.c b/gfx/fonts/xdk1_xfonts.c new file mode 100644 index 0000000000..93c08f54f9 --- /dev/null +++ b/gfx/fonts/xdk1_xfonts.c @@ -0,0 +1,52 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include "xdk1_xfonts.h" +#include "../../general.h" + +HRESULT xfonts_init_font(XFONT *font) +{ + XFONT_OpenDefaultFont(font); + font->SetBkMode(XFONT_TRANSPARENT); + font->SetBkColor(D3DCOLOR_ARGB(100,0,0,0)); + font->SetTextHeight(14); + font->SetTextAntialiasLevel(font->GetTextAntialiasLevel()); + + return S_OK; +} + +void xfonts_deinit_font(void) +{ +} + +void xfonts_render_msg_pre(LPDIRECT3DDEVICE d3d) +{ + d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &d3d->pFrontBuffer); + d3d->d3d_render_device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &d3d->pBackBuffer); +} + +void xfonts_render_msg_place(LPDIRECT3DDEVICE d3d, float x, float y, float scale, const wchar_t *msg, ...) +{ + d3d->debug_font->TextOut(d3d->pFrontBuffer, msg, (unsigned)-1, x, y); + d3d->debug_font->TextOut(d3d->pBackBuffer, msg, (unsigned)-1, x, y); +} + +void xfonts_render_msg_post(LPDIRECT3DDEVICE d3d) +{ + d3d->pFrontBuffer->Release(); + d3d->pBackBuffer->Release(); +} diff --git a/gfx/fonts/xdk1_xfonts.h b/gfx/fonts/xdk1_xfonts.h new file mode 100644 index 0000000000..62cdc70ec0 --- /dev/null +++ b/gfx/fonts/xdk1_xfonts.h @@ -0,0 +1,32 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef RARCH_XDK1_FONTS_H +#define RARCH_XDK1_FONTS_H + +#ifdef _XBOX1 +#define XFONT_TRUETYPE +#endif + +#include + +HRESULT xfonts_init_font(XFONT *font); +void xfonts_deinit_font(void); +void xfonts_render_msg_pre(LPDIRECT3DDEVICE d3d); +void xfonts_render_msg_place(LPDIRECT3DDEVICE d3d, float x, float y, float scale, const wchar_t *msg, ...); +void xfonts_render_msg_post(LPDIRECT3DDEVICE d3d); + +#endif