bugfixes, new scaling, double ym upd at 940
[picodrive.git] / platform / win32 / GenaDrive / Font.cpp
CommitLineData
cc68a136 1\r
2#include "app.h"\r
3\r
4// ----------------------------------------------------------------------------------\r
5#ifdef _XBOX\r
6\r
7#include <xfont.h>\r
8static XFONT *Font=NULL;\r
9\r
10int FontInit()\r
11{\r
12 XFONT_OpenDefaultFont(&Font); if (Font==NULL) return 1;\r
13\r
14 return 0;\r
15}\r
16\r
17void FontExit()\r
18{\r
19}\r
20\r
21int FontSetColour(unsigned int colour)\r
22{\r
23 Font->SetTextColor(colour);\r
24 return 0;\r
25}\r
26\r
27int FontText(WCHAR *text,int dx,int dy)\r
28{\r
29 if (Font==NULL || DirectBack==NULL) return 1;\r
30\r
31 Font->TextOut(DirectBack,text,~0U,dx,dy);\r
32 return 0;\r
33}\r
34\r
35#endif\r
36\r
37\r
38// ----------------------------------------------------------------------------------\r
39#ifndef _XBOX\r
40\r
41static ID3DXFont *Font=NULL;\r
42static unsigned int FontColour=0;\r
43\r
44int FontInit()\r
45{\r
46 LOGFONT lf;\r
47\r
48 memset(&lf,0,sizeof(lf));\r
49 strcpy(lf.lfFaceName,"Arial");\r
50 lf.lfHeight=24;\r
51 D3DXCreateFontIndirect(Device,&lf,&Font);\r
52\r
53 return 0;\r
54}\r
55\r
56void FontExit()\r
57{\r
58 RELEASE(Font);\r
59}\r
60\r
61int FontSetColour(unsigned int colour)\r
62{\r
63 FontColour=0xff000000|colour;\r
64 return 0;\r
65}\r
66\r
67int FontText(WCHAR *text,int dx,int dy)\r
68{\r
69 RECT rect={0,0,0,0};\r
70\r
71 if (Font==NULL || DirectBack==NULL) return 1;\r
72\r
73 Font->Begin();\r
74 rect.left=dx;\r
75 rect.top=dy;\r
76 rect.right=MainWidth;\r
77 rect.bottom=MainHeight;\r
78\r
79 Font->DrawTextW(text,-1,&rect,DT_LEFT,FontColour);\r
80 Font->End();\r
81\r
82 return 0;\r
83}\r
84\r
85#endif\r