MCPcopy Create free account
hub / github.com/doldecomp/mkdd / draw

Method draw

libs/JSystem/J2DGraph/J2DTextBoxEx.cpp:142–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void J2DTextBoxEx::draw(f32 x, f32 y)
143{
144 Mtx newMtx;
145
146 if (isVisible()) {
147 JUTFont* font = nullptr;
148 if (mMaterial && mMaterial->getTevBlock()) {
149 font = mMaterial->getTevBlock()->getFont();
150 }
151
152 J2DPrint print(font, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlack, mWhite);
153 print.setFontSize(mFontSize.x, mFontSize.y);
154 mColorAlpha = mAlpha;
155
156 if (mMaterial) {
157 mMaterial->setGX();
158 makeMatrix(x, y, 0.0f, 0.0f);
159
160 GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0);
161 GXSetCurrentMtx(GX_PNMTX0);
162
163 if (!mMaterial->isVisible()) {
164 return;
165 }
166
167 GXClearVtxDesc();
168 GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
169 GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
170 GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
171
172 if (mStringPtr) {
173 u8 alpha = 255;
174 if (mMaterial->getMaterialAlphaCalc() == 1) {
175 alpha = mColorAlpha;
176 }
177
178 print.print(0.0f, 0.0f, alpha, "%s", mStringPtr);
179 }
180
181 for (int i = 0; i < GX_MAX_TEVSWAP; i++) {
182 GXSetTevSwapModeTable((GXTevSwapSel)i, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
183 }
184
185 GXSetNumIndStages(0);
186
187 for (int i = 0; i < GX_MAX_TEVSTAGE; i++) {
188 GXSetTevDirect((GXTevStageID)i);
189 }
190
191 PSMTXIdentity(newMtx);
192 GXLoadPosMtxImm(newMtx, GX_PNMTX0);
193 }
194 }
195}
196
197void J2DTextBoxEx::draw(f32 x, f32 y, f32 p3, J2DTextBoxHBinding hb)
198{

Callers

nothing calls this directly

Calls 8

printReturnMethod · 0.80
getTevBlockMethod · 0.45
getFontMethod · 0.45
setFontSizeMethod · 0.45
setGXMethod · 0.45
isVisibleMethod · 0.45
getMaterialAlphaCalcMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected