From dba5833011697f7c320a0c7be3ae816ef6bbf131 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 11 Oct 2023 21:38:42 -0700 Subject: [PATCH] J2DPane match --- configure.py | 2 +- include/JSystem/J2DGraph/J2DPane.h | 2 +- include/JSystem/JSupport/JSUList.h | 2 ++ src/JSystem/J2DGraph/J2DPane.cpp | 12 +++++++----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 67ed1cf26..e75a9ad43 100644 --- a/configure.py +++ b/configure.py @@ -839,7 +839,7 @@ config.libs = [ Object(Matching, "JSystem/J2DGraph/J2DGrafContext.cpp"), Object(Matching, "JSystem/J2DGraph/J2DOrthoGraph.cpp"), Object(NonMatching, "JSystem/J2DGraph/J2DPrint.cpp"), - Object(NonMatching, "JSystem/J2DGraph/J2DPane.cpp"), + Object(Matching, "JSystem/J2DGraph/J2DPane.cpp"), Object(NonMatching, "JSystem/J2DGraph/J2DScreen.cpp"), Object(NonMatching, "JSystem/J2DGraph/J2DWindow.cpp"), Object(NonMatching, "JSystem/J2DGraph/J2DPicture.cpp"), diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index c6dbd2810..ba1a3fc7a 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -41,7 +41,7 @@ public: void initiate(); void makePaneStream(J2DPane* other, JSURandomInputStream* stream); bool insertChild(J2DPane* before, J2DPane* child); - void draw(f32 a1, f32 a2, const J2DGrafContext* ctx, bool a4); + void draw(f32 x, f32 y, const J2DGrafContext* ctx, bool clip); void clip(const JGeometry::TBox2& bounds); void setBasePosition(J2DBasePosition position); diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h index 6adb0bc74..bcc4f8374 100644 --- a/include/JSystem/JSupport/JSUList.h +++ b/include/JSystem/JSupport/JSUList.h @@ -201,6 +201,8 @@ public: bool operator!=(JSUTree* other) { return this->mTree != other; } + operator bool() const { return this->mTree != NULL; } + JSUTreeIterator operator++(int) { JSUTreeIterator prev = *this; this->mTree = this->mTree->getNextChild(); diff --git a/src/JSystem/J2DGraph/J2DPane.cpp b/src/JSystem/J2DGraph/J2DPane.cpp index 2acde8d2c..4dfdb177c 100644 --- a/src/JSystem/J2DGraph/J2DPane.cpp +++ b/src/JSystem/J2DGraph/J2DPane.cpp @@ -162,11 +162,13 @@ void J2DPane::draw(float x, float y, const J2DGrafContext* pCtx, bool clip) { mDrawBounds = mBounds; if (pParentPane != NULL) { - mScreenBounds.addPos(pParentPane->mScreenBounds.i.x, pParentPane->mScreenBounds.i.y); + JGeometry::TBox2 screenBounds = pParentPane->mScreenBounds; + mScreenBounds.addPos(screenBounds.i.x, screenBounds.i.y); MTXConcat(pParentPane->mDrawMtx, mMtx, mDrawMtx); if (clip) { - mDrawBounds.addPos(pParentPane->mScreenBounds.i.x, pParentPane->mScreenBounds.i.y); + JGeometry::TBox2 screenBounds = pParentPane->mScreenBounds; + mDrawBounds.addPos(screenBounds.i.x, screenBounds.i.y); mDrawBounds.intersect(pParentPane->mDrawBounds); } @@ -181,7 +183,7 @@ void J2DPane::draw(float x, float y, const J2DGrafContext* pCtx, bool clip) { mDrawAlpha = mAlpha; } - JGeometry::TBox2 clipBounds( 0.0f, 0.0f, 0.0f, 0.0f ); + JGeometry::TBox2 clipBounds(0.0f, 0.0f, 0.0f, 0.0f); if (clip) ((J2DOrthoGraph*)pCtx)->scissorBounds(&clipBounds, &mDrawBounds); @@ -194,7 +196,7 @@ void J2DPane::draw(float x, float y, const J2DGrafContext* pCtx, bool clip) { GXSetCullMode((GXCullMode)mCullMode); drawSelf(x, y, &ctx.mPosMtx); - for (JSUTreeIterator iter = mPaneTree.getFirstChild(); iter.getObject(); ++iter) + for (JSUTreeIterator iter = mPaneTree.getFirstChild(); iter; ++iter) iter->draw(0.0f, 0.0f, pCtx, clip); } } @@ -243,7 +245,7 @@ void J2DPane::makeMatrix(f32 x, f32 y) { if (mRotation != 0.0f) { MTXTrans(stack1, -mBasePosition.x, -mBasePosition.y, 0.0f); f32 rot = mRotationAxis == ROTATE_Z ? -mRotation : mRotation; - MTXRotRad(stack2, mRotationAxis, rot * 0.017445329f); + MTXRotRad(stack2, mRotationAxis, rot * 0.017453292f); MTXTrans(stack3, mBasePosition.x + x, mBasePosition.y + y, 0.0f); MTXConcat(stack2, stack1, mMtx); MTXConcat(stack3, mMtx, mMtx);