-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
738033a
commit cd0d52d
Showing
12 changed files
with
127 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "TRender/TResource.h" | ||
#include <catch2/catch_test_macros.hpp> | ||
|
||
TOSHI_NAMESPACE_USING | ||
|
||
TEST_CASE("SetName", "[TResource]") | ||
{ | ||
TResource res; | ||
res.SetName(TNULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
#include "TKernel/TObject.h" | ||
#include "TKernel/TNodeTree.h" | ||
|
||
#define MAXNAMELEN 15 | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TOSHI_EXPORT TResource : public TObject, public TNodeTree<TResource>::TNode | ||
{ | ||
DECLARE_DYNAMIC(TResource) | ||
|
||
enum TResourceState | ||
{ | ||
TResourceState_Valid = BITFIELD(0), | ||
TResourceState_Created = BITFIELD(1), | ||
TResourceState_Dying = BITFIELD(2), | ||
TResourceState_External = BITFIELD(3), | ||
TResourceState_Dead = BITFIELD(4), | ||
TResourceState_SceneObject = BITFIELD(5), | ||
}; | ||
|
||
public: | ||
|
||
TResource() | ||
{ | ||
|
||
} | ||
|
||
void SetParent(TResource *a_pParent); | ||
void SetName(TPCCHAR a_strName); | ||
TBOOL IsDying() { return HASFLAG(m_iState & TResourceState_Dying); } | ||
|
||
TUINT GetUId() const { return m_uiUId; } | ||
|
||
private: | ||
TCHAR m_szName[MAXNAMELEN]; // 0x1C | ||
TINT8 m_iState; // 0x2B | ||
TUINT m_uiUId; // 0x2C | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TTextureResource | ||
class TOSHI_EXPORT TTextureResource | ||
{ | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "TResource.h" | ||
#include "TSystemTools.h" | ||
|
||
TOSHI_NAMESPACE_USING | ||
|
||
IMPLEMENT_DYNCREATE(TResource, TObject) | ||
|
||
void TResource::SetParent(TResource* a_pParent) | ||
{ | ||
TASSERT((TNULL == a_pParent) || (TTRUE == IsDying()) || (TFALSE == a_pParent->IsDying())); | ||
TASSERT(TNULL != GetTree()); | ||
|
||
GetTree()->Remove(this, TFALSE); | ||
|
||
if (!a_pParent) { | ||
GetTree()->InsertAtRoot(this); | ||
} | ||
else { | ||
GetTree()->Insert(a_pParent, this); | ||
} | ||
} | ||
|
||
void TResource::SetName(TPCCHAR a_strName) | ||
{ | ||
char szName[12]; | ||
if (!a_strName) { | ||
a_strName = szName; | ||
szName[0] = 'r'; | ||
szName[1] = 'e'; | ||
szName[2] = 's'; | ||
szName[3] = ':'; | ||
TSystem::StringIntToString(GetUId(), &szName[4], 10); | ||
} | ||
TASSERT(TSystem::StringLength(a_strName)<=MAXNAMELEN); | ||
TSystem::StringCopy(m_szName, a_strName, -1); | ||
} |