2012-07-30 22:14:23 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2013-01-01 00:37:37 +00:00
|
|
|
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2013 - Daniel De Matteis
|
2012-07-30 22:14:23 +00:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <xtl.h>
|
2012-12-15 02:35:04 +00:00
|
|
|
#include "d3d_font.h"
|
2013-03-11 19:05:05 +00:00
|
|
|
#include "../gfx_common.h"
|
2012-07-30 22:14:23 +00:00
|
|
|
#include "../../general.h"
|
|
|
|
|
2012-12-15 06:16:02 +00:00
|
|
|
static XFONT *debug_font;
|
|
|
|
static D3DSurface *pFrontBuffer;
|
|
|
|
|
2012-12-15 02:35:04 +00:00
|
|
|
static bool xfonts_init_font(void *data, const char *font_path, unsigned font_size)
|
2012-07-30 22:14:23 +00:00
|
|
|
{
|
2012-12-15 02:35:04 +00:00
|
|
|
(void)font_path;
|
|
|
|
(void)font_size;
|
2013-11-01 16:36:31 +00:00
|
|
|
(void)data;
|
2012-12-15 02:59:31 +00:00
|
|
|
|
2012-12-15 06:16:02 +00:00
|
|
|
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());
|
2012-12-15 02:59:31 +00:00
|
|
|
|
2012-12-15 02:35:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xfonts_deinit_font(void *data)
|
|
|
|
{
|
|
|
|
(void)data;
|
2012-07-30 22:14:23 +00:00
|
|
|
}
|
|
|
|
|
2013-03-11 19:05:05 +00:00
|
|
|
static void xfonts_render_msg(void *data, const char *msg, void *parms)
|
2012-07-30 22:14:23 +00:00
|
|
|
{
|
2012-08-04 00:06:46 +00:00
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2013-03-11 19:05:05 +00:00
|
|
|
font_params_t *params = (font_params_t*)parms;
|
|
|
|
wchar_t str[PATH_MAX];
|
|
|
|
float x, y;
|
|
|
|
|
|
|
|
if (params)
|
|
|
|
{
|
|
|
|
x = params->x;
|
|
|
|
y = params->y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = g_settings.video.msg_pos_x;
|
|
|
|
y = g_settings.video.msg_pos_y;
|
|
|
|
}
|
2012-08-04 00:06:46 +00:00
|
|
|
|
2012-12-15 06:16:02 +00:00
|
|
|
d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &pFrontBuffer);
|
2012-08-03 01:24:36 +00:00
|
|
|
|
2013-04-11 15:18:23 +00:00
|
|
|
mbstowcs(str, msg, sizeof(str) / sizeof(wchar_t));
|
2012-12-15 06:16:02 +00:00
|
|
|
debug_font->TextOut(pFrontBuffer, str, (unsigned)-1, x, y);
|
2012-08-03 01:24:36 +00:00
|
|
|
|
2012-12-15 06:16:02 +00:00
|
|
|
pFrontBuffer->Release();
|
2012-07-30 22:14:23 +00:00
|
|
|
}
|
2012-12-15 02:35:04 +00:00
|
|
|
|
|
|
|
const d3d_font_renderer_t d3d_xdk1_font = {
|
|
|
|
xfonts_init_font,
|
|
|
|
xfonts_deinit_font,
|
|
|
|
xfonts_render_msg,
|
|
|
|
"XDK1 Xfonts",
|
|
|
|
};
|