Files
tp/include/JSystem/J2DGraph/J2DGrafContext.h
T

71 lines
2.2 KiB
C++
Raw Normal View History

2021-03-28 22:49:05 +02:00
#ifndef J2DGRAFCONTEXT_H
#define J2DGRAFCONTEXT_H
2021-01-25 06:57:35 -08:00
2021-08-28 07:25:03 -07:00
#include "JSystem/JGeometry.h"
2021-09-26 12:11:21 +02:00
#include "JSystem/JUtility/TColor.h"
2024-01-19 16:22:19 -08:00
#include "dolphin/mtx.h"
2021-01-25 06:57:35 -08:00
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-j2d
*
*/
class J2DGrafContext {
public:
2023-07-15 13:01:28 -07:00
struct Blend {
/* 0x0 */ u8 mType;
/* 0x1 */ u8 mSrcFactor;
/* 0x2 */ u8 mDstFactor;
};
2025-11-30 14:23:42 -08:00
J2DGrafContext(f32 x, f32 y, f32 width, f32 height);
void scissor(JGeometry::TBox2<f32> const& bounds);
2024-01-21 11:15:22 +02:00
void scissor(f32 x, f32 y, f32 width, f32 height) {
scissor(JGeometry::TBox2<f32>(x, y, x + width, y + height));
}
2021-12-06 12:57:45 +01:00
void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); }
2025-11-30 14:23:42 -08:00
void setColor(JUtility::TColor colorTL, JUtility::TColor colorTR,
JUtility::TColor colorBR, JUtility::TColor colorBL);
2025-11-30 14:23:42 -08:00
void setLineWidth(u8);
void fillBox(JGeometry::TBox2<f32> const& box);
void drawFrame(JGeometry::TBox2<f32> const& box);
void line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end);
void lineTo(JGeometry::TVec2<f32> pos);
2021-12-06 12:57:45 +01:00
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)); }
2021-12-06 12:57:45 +01:00
void moveTo(JGeometry::TVec2<f32> pos) { mPrevPos = pos; }
2025-11-30 14:23:42 -08:00
virtual ~J2DGrafContext() {}
virtual void place(JGeometry::TBox2<f32> const& bounds);
virtual void place(f32 x, f32 y, f32 width, f32 height) {
2021-12-06 12:57:45 +01:00
JGeometry::TBox2<f32> box(x, y, x + width, y + height);
this->place(box);
}
2025-11-30 14:23:42 -08:00
virtual void setPort();
virtual void setup2D();
virtual void setScissor();
virtual s32 getGrafType() const { return 0; }
virtual void setLookat() {}
2026-01-11 19:00:04 -08:00
JGeometry::TBox2<f32>* getBounds() { return &mBounds; }
2021-12-11 23:39:53 +01:00
public:
/* 0x04 */ JGeometry::TBox2<f32> mBounds;
/* 0x14 */ JGeometry::TBox2<f32> mScissorBounds;
2021-12-06 22:02:10 +01:00
/* 0x24 */ JUtility::TColor mColorTL;
/* 0x28 */ JUtility::TColor mColorTR;
/* 0x2C */ JUtility::TColor mColorBR;
/* 0x30 */ JUtility::TColor mColorBL;
/* 0x34 */ u8 mLineWidth;
2021-12-06 12:57:45 +01:00
/* 0x38 */ JGeometry::TVec2<f32> mPrevPos;
/* 0x40 */ Mtx44 mMtx44;
/* 0x80 */ Mtx mPosMtx;
2023-07-15 13:01:28 -07:00
/* 0xB0 */ Blend field_0xb0;
/* 0xB3 */ Blend mLinePart;
/* 0xB6 */ Blend mBoxPart;
2021-08-28 07:25:03 -07:00
};
2021-03-28 22:49:05 +02:00
#endif /* J2DGRAFCONTEXT_H */