-
Notifications
You must be signed in to change notification settings - Fork 0
/
gfxstrio.cpp
146 lines (103 loc) · 2.21 KB
/
gfxstrio.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Filename: gfxstrIO.cpp
//
// Developed by Oliver Belaifa in 1997
//
#include<stdlib.h>
#include<gfxstrio.h>
#include<string.h>
extern "C"
{
void DrawGfxCharacter32BitASM(char *pcString, int iBackBufferPos,
void *pBackBuffer, int iXmax);
}
void CGfxStrIO::WriteStr(char *pcString)
{
int iStringLength = strlen(pcString);
if (m_iPosY != m_iYmax - 1)
{
if (m_iXmax + m_iPosX < iStringLength)
{
iStringLength = m_iXmax + m_iPosX;
}
int iI;
for (iI = 0; iI < iStringLength; iI++)
{
DrawGfxCharacter32BitASM(&pcString[iI],
(m_iPosY*m_iCharacterYSize*m_iBackBufferXmax +
m_iPosX*m_iCharacterXSize)*m_iBytesPerPixel,
m_pBackBuffer, m_iBackBufferXmax);
m_iPosX++;
}
m_iPosX = 0;
m_iPosY++;
}
}
void CGfxStrIO::WriteStr(char *pcString, char *pcBackBuffer)
{
int iStringLength = strlen(pcString);
if (m_iPosY != m_iYmax - 1)
{
if (m_iXmax + m_iPosX < iStringLength)
{
iStringLength = m_iXmax + m_iPosX;
}
int iI;
for (iI = 0; iI < iStringLength; iI++)
{
DrawGfxCharacter32BitASM(&pcString[iI],
(m_iPosY*m_iCharacterYSize*m_iBackBufferXmax +
m_iPosX*m_iCharacterXSize)*m_iBytesPerPixel,
pcBackBuffer, m_iBackBufferXmax);
m_iPosX++;
}
m_iPosX = 0;
m_iPosY++;
}
}
void CGfxStrIO::SetPos(int iX, int iY)
{
if ((iX < m_iXmax) && (iY < m_iYmax))
{
m_iPosX = iX;
m_iPosY = iY;
}
}
void CGfxStrIO::ResetPos()
{
m_iPosX = 0;
m_iPosY = 0;
}
void CGfxStrIO::TakeBackBuffer(void *pBackBuffer)
{
m_pBackBuffer = pBackBuffer;
}
void CGfxStrIO::Init(int iXmax, int iYmax)
// iXmax,iYmax : BackBufferResolution
{
m_iBackBufferXmax = iXmax;
m_iBackBufferYmax = iYmax;
m_iPosX = 0;
m_iPosY = 0;
m_iXmax = m_iBackBufferXmax/m_iCharacterXSize;
m_iYmax = m_iBackBufferYmax/m_iCharacterYSize;
m_iBytesPerPixel = 4;
}
void CGfxStrIO::Free()
{
}
CGfxStrIO::CGfxStrIO()
{
m_iXmax = 0;
m_iYmax = 0;
m_iPosX = 0;
m_iPosY = 0;
m_iBackBufferXmax = 0;
m_iBackBufferYmax = 0;
m_pBackBuffer = NULL;
m_iBytesPerPixel = 0;
m_iCharacterXSize = 8;
m_iCharacterYSize = 8;
}
CGfxStrIO::~CGfxStrIO()
{
}