Skip to content

Commit 6012097

Browse files
committed
Implement more stuff to draw Matlibs
1 parent 2fefa0e commit 6012097

File tree

15 files changed

+330
-8
lines changed

15 files changed

+330
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#pragma once
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "AGUIPicture.h"
2+
3+
//-----------------------------------------------------------------------------
4+
// Enables memory debugging.
5+
// Note: Should be the last include!
6+
//-----------------------------------------------------------------------------
7+
#include <TKernel/TMemoryDebugOn.h>
8+
9+
TOSHI_NAMESPACE_USING
10+
11+
IMPLEMENT_DYNAMIC(AGUIPicture, TObject)
12+
13+
AGUIPicture::AGUIPicture()
14+
{
15+
16+
}

OpenJPOG/Source/GUI/AGUIPicture.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pragma once
2+
#include "TKernel/TObject.h"
3+
4+
class AGUIPicture : public Toshi::TObject
5+
{
6+
DECLARE_DYNAMIC(AGUIPicture, Toshi::TObject);
7+
8+
public:
9+
10+
AGUIPicture();
11+
12+
protected:
13+
static const int split_tile_count = 6;
14+
static const int split_texture_count = 6;
15+
static const int *split_texture_size[2];
16+
static void* split_rules[6];
17+
};

OpenJPOG/Source/GUI/AGUISystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ TBOOL AGUISystem::OnCreate()
2525
m_pGUIInterface->Create();
2626
m_pDisplayContext = new PGUITRDisplayContext();
2727
m_pDisplayContext->Create(g_oTheApp.GetRootTask()->GetRenderInterface(), m_pTextureFactory, m_pFontFactory);
28-
return TBOOL();
28+
m_pScreen = new TGUIScreen();
29+
return true;
2930
}
3031

3132
// $JPOG: FUNCTION 0067c1f0

OpenJPOG/Source/GUI/AGUISystem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "TKernel/TManagedPointer.h"
55
#include "TRender/TNullResource.h"
66
#include "TGui/TGUIInterface.h"
7+
#include "TGUI/TGUIScreen.h"
78
#include "PGuiRenderer/PGUITRDisplayContext.h"
89

910
class AGUISystem : public Toshi::TTask
@@ -26,6 +27,7 @@ class AGUISystem : public Toshi::TTask
2627

2728
private:
2829
Toshi::TGUIInterface *m_pGUIInterface; // 0x24
30+
Toshi::TGUIScreen *m_pScreen; // 0x28
2931
PGUITRDisplayContext *m_pDisplayContext; // 0xA4
3032
PGUITRTextureFactory *m_pTextureFactory; // 0xA8
3133
PGUITRFontFactory *m_pFontFactory; // 0xAC

Toshi/Include/TGui/TGUIScreen.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ TOSHI_NAMESPACE_BEGIN
66
class TGUIINTERFACE_EXPORTS TGUIScreen : public TGUIWidget
77
{
88
DECLARE_DYNAMIC(TGUIScreen)
9+
10+
public:
11+
TGUIScreen();
912
};
1013

1114
TOSHI_NAMESPACE_END
Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,79 @@
11
#pragma once
22
#include "Defines.h"
3+
#include "TKernel/TObject.h"
4+
#include "TKernel/TPCString.h"
35

46
TOSHI_NAMESPACE_BEGIN
57

6-
class TGUIINTERFACE_EXPORTS TGUITextureSection
8+
class TGUIINTERFACE_EXPORTS TGUITextureSection : public TObject
79
{
10+
DECLARE_DYNAMIC(TGUITextureSection)
11+
public:
12+
enum Flags
13+
{
14+
TEXTURESECTIONFLAG_WRAP = BITFIELD(0),
15+
TEXTURESECTIONFLAG_MIRRORX = BITFIELD(1),
16+
TEXTURESECTIONFLAG_MIRRORY = BITFIELD(2)
17+
};
18+
19+
public:
20+
TGUITextureSection();
21+
22+
public:
23+
// ll = lower left | ur = upper right
24+
virtual void GetBBox(TUSHORT &a_usX, TUSHORT &a_usY, TUSHORT &a_usWidth, TUSHORT &a_usHeight, TINT) const;
25+
virtual void GetBBox(TUSHORT &a_usX, TUSHORT &a_usY, TUSHORT &a_usWidth, TUSHORT &a_usHeight, TFLOAT) const;
26+
27+
public:
28+
// $TGUIInterface: FUNCTION 10009f90
29+
TSHORT GetTexture() const
30+
{
31+
return m_uTexture;
32+
}
33+
// $TGUIInterface: FUNCTION 10009f80
34+
const TPCString &GetName() const
35+
{
36+
return m_sName;
37+
}
38+
// $TGUIInterface: FUNCTION 10009f50
39+
TUSHORT GetWidth() const
40+
{
41+
return m_usWidth;
42+
}
43+
// $TGUIInterface: FUNCTION 10009f40
44+
TUSHORT GetHeight() const
45+
{
46+
return m_usHeight;
47+
}
48+
// $TGUIInterface: FUNCTION 10009f30
49+
TBOOL GetRotation() const
50+
{
51+
return m_eFlags & (TEXTURESECTIONFLAG_WRAP | TEXTURESECTIONFLAG_MIRRORX);
52+
}
53+
// $TGUIInterface: FUNCTION 10009f20
54+
TBOOL GetWrap() const
55+
{
56+
return (m_eFlags & TEXTURESECTIONFLAG_WRAP) != 0;
57+
}
58+
// $TGUIInterface: FUNCTION 10009f00
59+
TBOOL GetMirrorX() const
60+
{
61+
return (m_eFlags & TEXTURESECTIONFLAG_MIRRORX) != 0;
62+
}
63+
// $TGUIInterface: FUNCTION 10009ee0
64+
TBOOL GetMirrorY() const
65+
{
66+
return (m_eFlags & TEXTURESECTIONFLAG_MIRRORY) != 0;
67+
}
68+
69+
private:
70+
TSHORT m_uTexture; // 0x10
71+
TPCString m_sName; // 0x14
72+
TUSHORT m_usX; // 0x18
73+
TUSHORT m_usY; // 0x1A
74+
TUSHORT m_usWidth; // 0x1C
75+
TUSHORT m_usHeight; // 0x1E
76+
Flags m_eFlags; // 0x20
877
};
978

1079
TOSHI_NAMESPACE_END

Toshi/Include/TRender/TRenderInterface.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#include "TModel.h"
1515
#include "TMaterialLibrary.h"
1616

17+
#ifdef FindResource
18+
#undef FindResource
19+
#endif
20+
1721
TOSHI_NAMESPACE_BEGIN
1822

1923
class TRENDERINTERFACE_EXPORTS TRenderInterface
@@ -107,6 +111,7 @@ class TRENDERINTERFACE_EXPORTS TRenderInterface
107111

108112
public:
109113
TResource *CreateResource(const TClass *a_pClass, TPCCHAR a_szResName, TResource *a_pResource);
114+
TResource *FindResource(TPCCHAR a_szResName, TResource *a_pResource);
110115

111116
const TRenderAdapter::Mode::Device *FindDevice(const DisplayParams *a_pDisplayParams);
112117

@@ -133,7 +138,7 @@ class TRENDERINTERFACE_EXPORTS TRenderInterface
133138
// $TRenderInterface: FUNCTION 1000f210
134139
TBOOL IsDisplayCreated() { return m_bIsDiplayCreated; }
135140
// $TRenderInterface: FUNCTION 1000f230
136-
TBOOL IsInScene() { return m_bInScene; }
141+
TBOOL IsInScene() { return m_bInScene; }
137142
// $TRenderInterface: FUNCTION 1000f280
138143
TNodeList<TRenderAdapter> *GetAdapterList() { return &m_pAdapterList; };
139144

Toshi/Plugins/Include/PGUIRenderer/PGUITRDisplayContext.h

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
#include "TKernel/TManagedPointer.h"
55
#include "TGui/TGUIDisplayContext.h"
66
#include "TRender/TRenderInterface.h"
7-
#include "PGUIRenderer/PGUITRFontFactory.h"
7+
#include "TRender/TResource.h"
88

99
class PGUITRTextureFactory;
10+
class PGUITRFontFactory;
1011

1112
class PGUIRENDERER_EXPORTS PGUITRDisplayContext : Toshi::TGUIDisplayContext
1213
{
1314
public:
15+
16+
PGUITRDisplayContext();
17+
1418
void Create();
1519
void Create(Toshi::TManagedPtr<Toshi::TRenderInterface> a_MPRenderer);
1620
void Create(Toshi::TManagedPtr<Toshi::TRenderInterface> a_MPRenderer, PGUITRTextureFactory *a_pTextureFactory, PGUITRFontFactory *a_pFontFactory);
@@ -40,15 +44,53 @@ class PGUIRENDERER_EXPORTS PGUITRDisplayContext : Toshi::TGUIDisplayContext
4044
virtual void Imp_DrawFilledRectangle(int a_iX, int a_iY, int a_iWidth, int a_iHeight, const Toshi::TGUIColour &m_rColour);
4145
virtual void Imp_DrawOutlineRectangle(int a_iX, int a_iY, int a_iWidth, int a_iHeight, const Toshi::TGUIColour &m_rColour);
4246

47+
public:
48+
// $PGUIRenderer: FUNCTION 10005a10
49+
virtual TFLOAT GetBackDepth()
50+
{
51+
return -15.0f;
52+
}
53+
// $PGUIRenderer: FUNCTION 10005a00
54+
virtual TFLOAT GetFrontDepth()
55+
{
56+
return -6551.5f;
57+
}
58+
// $PGUIRenderer: FUNCTION 100059f0
59+
virtual TFLOAT GetDepthIncrement()
60+
{
61+
return -1.0f;
62+
}
63+
64+
protected:
65+
void RenderTexture(const Toshi::TGUITextureSection *a_pTextureSection, const Toshi::TGUIColour &a_rColour, int param_4, int param_5, int param_6, int param_7, int param_8);
66+
4367
public:
4468
// $PGUIRenderer: FUNCTION 10005c20
4569
Toshi::TRenderInterface *GetRenderInterface() const
4670
{
47-
return m_MPRenderer;
71+
return m_pRenderer;
72+
}
73+
// $PGUIRenderer: FUNCTION 10005bd0
74+
PGUITRTextureFactory *GetTextureFactory()
75+
{
76+
return m_pTextureFactory;
77+
}
78+
// $PGUIRenderer: FUNCTION 10005bf0
79+
TFLOAT GetScaleX() const
80+
{
81+
return m_fScaleX;
82+
}
83+
// $PGUIRenderer: FUNCTION 10005be0
84+
TFLOAT GetScaleY() const
85+
{
86+
return m_fScaleY;
4887
}
4988

5089
private:
51-
Toshi::TManagedPtr<Toshi::TRenderInterface> m_MPRenderer; // 0x210
52-
PGUITRTextureFactory *m_pTextureFactory; // 0x214
53-
PGUITRFontFactory *m_pFontFactory; // 0x218
90+
Toshi::TRenderInterface *m_pRenderer; // 0x210
91+
PGUITRTextureFactory *m_pTextureFactory; // 0x214
92+
PGUITRFontFactory *m_pFontFactory; // 0x218
93+
Toshi::TResource *m_pGUIRoot; // 0x220
94+
TFLOAT m_fScaleX; // 0x224
95+
TFLOAT m_fScaleY; // 0x228
5496
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#pragma once
22
#include "Defines.h"
3+
#include "PGuiRenderer/PGUITRDisplayContext.h"
34

45
class PGUIRENDERER_EXPORTS PGUITRFontFactory
56
{
7+
public:
8+
void Create(PGUITRDisplayContext *a_pDisplayContext);
69
};

0 commit comments

Comments
 (0)