summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/J2DGraph/J2DGrafContext.h22
-rw-r--r--include/JSystem/J2DGraph/J2DOrthoGraph.h12
-rw-r--r--include/JSystem/JGeometry.h28
-rw-r--r--include/dolphin/gx/GX.h14
4 files changed, 54 insertions, 22 deletions
diff --git a/include/JSystem/J2DGraph/J2DGrafContext.h b/include/JSystem/J2DGraph/J2DGrafContext.h
index dd85bce171..3e6af36ad0 100644
--- a/include/JSystem/J2DGraph/J2DGrafContext.h
+++ b/include/JSystem/J2DGraph/J2DGrafContext.h
@@ -10,6 +10,7 @@ class J2DGrafContext {
public:
/* 802E8B08 */ J2DGrafContext(f32, f32, f32, f32);
/* 802E90C0 */ void scissor(JGeometry::TBox2<f32> const&);
+ void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); }
/* 802E9118 */ void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor,
JUtility::TColor);
/* 802E9234 */ void setLineWidth(u8);
@@ -17,17 +18,24 @@ public:
/* 802E9368 */ void drawFrame(JGeometry::TBox2<f32> const&);
/* 802E9488 */ void line(JGeometry::TVec2<f32>, JGeometry::TVec2<f32>);
/* 802E9564 */ void lineTo(JGeometry::TVec2<f32>);
+ void lineTo(f32 x, f32 y) { this->lineTo(JGeometry::TVec2<f32>(x, y)); }
+ void moveTo(f32 x, f32 y) { this->moveTo(JGeometry::TVec2<f32>(x, y)); }
- /* 802E95D4 */ virtual ~J2DGrafContext();
+ void moveTo(JGeometry::TVec2<f32> pos) { mPrevPos = pos; }
+
+ /* 802E95D4 */ virtual ~J2DGrafContext() {}
/* 802E90E4 */ virtual void place(JGeometry::TBox2<f32> const&);
- /* 802E961C */ virtual void place(f32, f32, f32, f32);
+ /* 802E961C */ virtual void place(f32 x, f32 y, f32 width, f32 height) {
+ JGeometry::TBox2<f32> box(x, y, x + width, y + height);
+ this->place(box);
+ }
/* 802E8BB4 */ virtual void setPort();
/* 802E8C44 */ virtual void setup2D();
/* 802E8E20 */ virtual void setScissor();
- /* 802E9664 */ virtual bool getGrafType() const;
- /* 802E966C */ virtual void setLookat();
+ /* 802E9664 */ virtual s32 getGrafType() const { return 0; }
+ /* 802E966C */ virtual void setLookat() {}
-private:
+protected:
/* 0x04 */ JGeometry::TBox2<f32> mBounds;
/* 0x14 */ JGeometry::TBox2<f32> mScissorBounds;
/* 0x24 */ JUtility::TColor field_0x24;
@@ -35,8 +43,8 @@ private:
/* 0x2C */ JUtility::TColor field_0x2c;
/* 0x30 */ JUtility::TColor field_0x30;
/* 0x34 */ u8 mLineWidth;
- /* 0x38 */ JGeometry::TVec2<f32> field_0x14;
- /* 0x40 */ u8 field_0x40[0x40];
+ /* 0x38 */ JGeometry::TVec2<f32> mPrevPos;
+ /* 0x40 */ Mtx44 mMtx44;
/* 0x80 */ Mtx mPosMtx;
/* 0xB0 */ u8 field_0xb0;
/* 0xB1 */ u8 field_0xb1;
diff --git a/include/JSystem/J2DGraph/J2DOrthoGraph.h b/include/JSystem/J2DGraph/J2DOrthoGraph.h
index 4973087f93..8259b27c94 100644
--- a/include/JSystem/J2DGraph/J2DOrthoGraph.h
+++ b/include/JSystem/J2DGraph/J2DOrthoGraph.h
@@ -11,10 +11,12 @@ public:
/* 802E980C */ void setOrtho(JGeometry::TBox2<f32> const&, f32, f32);
/* 802E987C */ void scissorBounds(JGeometry::TBox2<f32>*, JGeometry::TBox2<f32> const*);
- /* 8000B118 */ virtual ~J2DOrthoGraph();
+ /* 8000B118 */ virtual ~J2DOrthoGraph() {}
/* 802E97B4 */ virtual void setPort();
- /* 802E9C88 */ virtual bool getGrafType() const;
+ /* 802E9C88 */ virtual s32 getGrafType() const { return 1; }
/* 802E9840 */ virtual void setLookat();
+ f32 getWidthPower() const { return mBounds.getWidth() / mOrtho.getWidth(); }
+ f32 getHeightPower() const { return mBounds.getHeight() / mOrtho.getHeight(); }
private:
/* 0xBC */ JGeometry::TBox2<f32> mOrtho;
@@ -22,4 +24,10 @@ private:
/* 0xD0 */ f32 mFar;
};
+void J2DFillBox(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor color);
+void J2DFillBox(JGeometry::TBox2<f32> const& param_0, JUtility::TColor param_1);
+void J2DDrawFrame(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor param_4,
+ u8 param_5);
+void J2DDrawFrame(JGeometry::TBox2<f32> const& param_0, JUtility::TColor param_1, u8 param_2);
+
#endif /* J2DORTHOGRAPH_H */
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h
index 2bb4e5f852..0da0a2718b 100644
--- a/include/JSystem/JGeometry.h
+++ b/include/JSystem/JGeometry.h
@@ -51,9 +51,9 @@ struct TVec2 {
}
void setMin(const TVec2<f32>& min) {
- if (min.x <= x)
+ if (x >= min.x)
x = min.x;
- if (min.y <= y)
+ if (y >= min.y)
y = min.y;
}
@@ -70,7 +70,7 @@ struct TVec2 {
}
bool isAbove(const TVec2<T>& other) const {
- return (other.x <= x) && (other.y <= y) ? true : false;
+ return (x >= other.x) && (y >= other.y) ? true : false;
}
T x;
@@ -90,14 +90,6 @@ template<> struct TBox<TVec2<f32> > {
f32 getWidth() const { return f.x - i.x; }
f32 getHeight() const { return f.y - i.y; }
- inline void operator= (const TBox<TVec2<f32> >& rhs) {
- // ???
- *(u32*)&i.x = *(u32*)&rhs.i.x;
- *(u32*)&i.y = *(u32*)&rhs.i.y;
- *(u32*)&f.x = *(u32*)&rhs.f.x;
- *(u32*)&f.y = *(u32*)&rhs.f.y;
- }
-
bool isValid() const { return f.isAbove(i); }
void addPos(const TVec2<f32>& pos) {
@@ -117,9 +109,19 @@ template<> struct TBox<TVec2<f32> > {
template <typename T>
struct TBox2 : TBox<TVec2<T> > {
TBox2() {}
+ TBox2(const TVec2<f32>& i, const TVec2<f32> f) { set(i, f); }
TBox2(f32 x0, f32 y0, f32 x1, f32 y1) { set(x0, y0, x1, y1); }
- inline const TBox2& operator=(const TBox2& rhs) { *(TBox<TVec2<T> >*)this = rhs; }
+ void absolute() {
+ if (!this->isValid()) {
+ TBox2<T> box(*this);
+ this->i.setMin(box.i);
+ this->i.setMin(box.f);
+ this->f.setMax(box.i);
+ this->f.setMax(box.f);
+ }
+ }
+
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32> f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
@@ -129,4 +131,4 @@ struct TBox2 : TBox<TVec2<T> > {
} // namespace JGeometry
-#endif \ No newline at end of file
+#endif
diff --git a/include/dolphin/gx/GX.h b/include/dolphin/gx/GX.h
index a816a20848..e98033adfa 100644
--- a/include/dolphin/gx/GX.h
+++ b/include/dolphin/gx/GX.h
@@ -909,6 +909,20 @@ void GXSetIndTexMtx(GXIndTexMtxID, Mtx23, s8);
void GXSetIndTexCoordScale(GXIndTexStageID, GXIndTexScale, GXIndTexScale);
void GXSetIndTexOrder(GXIndTexStageID, GXTexCoordID, GXTexMapID);
void GXEnableTexOffsets(GXTexCoordID, GXBool, GXBool);
+
+#define GFX_FIFO(T) (*(volatile T*)0xCC008000)
+
+inline void GXPosition3f32(f32 x, f32 y, f32 z) {
+ GFX_FIFO(f32) = x;
+ GFX_FIFO(f32) = y;
+ GFX_FIFO(f32) = z;
+}
+
+inline void GXColor1u32(u32 c) {
+ GFX_FIFO(u32) = c;
+}
+
+inline void GXEnd() {}
};
#endif