Skip to content

Commit c2d1b0c

Browse files
committed
PGUITRDisplayContext WIP
1 parent cab4aa1 commit c2d1b0c

File tree

6 files changed

+260
-103
lines changed

6 files changed

+260
-103
lines changed

Toshi/Include/TKernel/TNodeList.h

Lines changed: 201 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class TKERNELINTERFACE_EXPORTS TGenericNodeList
9292
~Iterator() = default;
9393

9494
TBOOL operator!() { return IsNull(); }
95-
TBOOL operator!=(Iterator &a_rIterator) { return m_pPtr != a_rIterator.m_pPtr; }
95+
TBOOL operator!=(Iterator &a_rIterator) const { return m_pPtr != a_rIterator.m_pPtr; }
9696

9797
TNode &operator*() const
9898
{
@@ -145,7 +145,7 @@ class TKERNELINTERFACE_EXPORTS TGenericNodeList
145145

146146
TBOOL IsNull() { return m_pPtr == TNULL; }
147147

148-
private:
148+
protected:
149149
TNode *m_pPtr;
150150
};
151151

@@ -324,6 +324,205 @@ class TKERNELINTERFACE_EXPORTS TGenericNodeList
324324
TINT m_iCount; // 0x10
325325
};
326326

327+
//template <typename T>
328+
//class TNodeList : public TGenericNodeList
329+
//{
330+
//public:
331+
// class TNode : public TGenericNodeList::TNode
332+
// {
333+
// public:
334+
// TNode() : TGenericNodeList::TNode() {}
335+
// TNode(const TNode& node) : TGenericNodeList::TNode(node) {}
336+
//
337+
// static T* FromBase(TGenericNodeList::TNode* pNode) {
338+
// return static_cast<T*>(static_cast<TNode*>(pNode));
339+
// }
340+
//
341+
// static const T* FromBase(const TGenericNodeList::TNode* pNode) {
342+
// return static_cast<const T*>(static_cast<const TNode*>(pNode));
343+
// }
344+
//
345+
// T* Next() const { return FromBase(TGenericNodeList::TNode::Next()); }
346+
// T* Prev() const { return FromBase(TGenericNodeList::TNode::Prev()); }
347+
//
348+
// TNodeList<T>* GetList() const {
349+
// return static_cast<TNodeList<T>*>(TGenericNodeList::TNode::GetList());
350+
// }
351+
// };
352+
//
353+
// class Iterator
354+
// {
355+
// public:
356+
// Iterator() : m_pPtr(nullptr) {}
357+
// Iterator(T* node) : m_pPtr(node) {}
358+
// Iterator(const TGenericNodeList::Iterator& base) :
359+
// m_pPtr(TNode::FromBase(static_cast<TGenericNodeList::TNode*>(base))) {}
360+
//
361+
// T& operator*() const {
362+
// return *m_pPtr;
363+
// }
364+
//
365+
// T* operator->() const {
366+
// return m_pPtr;
367+
// }
368+
//
369+
// Iterator& operator++() {
370+
// m_pPtr = m_pPtr->Next();
371+
// return *this;
372+
// }
373+
//
374+
// Iterator operator++(int) {
375+
// Iterator tmp = *this;
376+
// m_pPtr = m_pPtr->Next();
377+
// return tmp;
378+
// }
379+
//
380+
// Iterator& operator--() {
381+
// m_pPtr = m_pPtr->Prev();
382+
// return *this;
383+
// }
384+
//
385+
// Iterator operator--(int) {
386+
// Iterator tmp = *this;
387+
// m_pPtr = m_pPtr->Prev();
388+
// return tmp;
389+
// }
390+
//
391+
// TBOOL operator!() const {
392+
// return m_pPtr == nullptr;
393+
// }
394+
//
395+
// TBOOL operator!=(const Iterator& other) const {
396+
// return m_pPtr != other.m_pPtr;
397+
// }
398+
//
399+
// TBOOL operator==(const Iterator& other) const {
400+
// return m_pPtr == other.m_pPtr;
401+
// }
402+
//
403+
// operator T*() const {
404+
// return m_pPtr;
405+
// }
406+
//
407+
// operator TGenericNodeList::Iterator() const {
408+
// return TGenericNodeList::Iterator(m_pPtr);
409+
// }
410+
//
411+
// private:
412+
// T* m_pPtr;
413+
// };
414+
//
415+
// TNodeList()
416+
// : TGenericNodeList() {}
417+
// ~TNodeList() {}
418+
//
419+
// // Insert methods
420+
// void InsertAfter(T &rInsertAfter, T &rNewNode)
421+
// {
422+
// TGenericNodeList::InsertAfter(rInsertAfter, rNewNode);
423+
// }
424+
//
425+
// void InsertBefore(T &rInsertBefore, T &rNewNode)
426+
// {
427+
// TGenericNodeList::InsertBefore(rInsertBefore, rNewNode);
428+
// }
429+
//
430+
// void InsertHead(T &rNode)
431+
// {
432+
// TGenericNodeList::InsertHead(rNode);
433+
// }
434+
//
435+
// void InsertTail(T &rNode)
436+
// {
437+
// TGenericNodeList::InsertTail(rNode);
438+
// }
439+
//
440+
// // Remove methods
441+
// T *Remove(T &rNode)
442+
// {
443+
// return TNode::FromBase(TGenericNodeList::Remove(rNode));
444+
// }
445+
//
446+
// T *RemoveHead()
447+
// {
448+
// return TNode::FromBase(TGenericNodeList::RemoveHead());
449+
// }
450+
//
451+
// T *RemoveTail()
452+
// {
453+
// return TNode::FromBase(TGenericNodeList::RemoveTail());
454+
// }
455+
//
456+
// // Delete methods
457+
// void Delete(T &rNode)
458+
// {
459+
// TGenericNodeList::Delete(rNode);
460+
// }
461+
//
462+
// void DeleteAll()
463+
// {
464+
// TGenericNodeList::DeleteAll();
465+
// }
466+
//
467+
// void DeleteHead()
468+
// {
469+
// if (!IsEmpty()) {
470+
// Delete(*Head());
471+
// }
472+
// }
473+
//
474+
// void DeleteTail()
475+
// {
476+
// if (!IsEmpty()) {
477+
// Delete(*Tail());
478+
// }
479+
// }
480+
//
481+
// // Iterator methods
482+
// Iterator Begin() const
483+
// {
484+
// return Iterator(TNode::FromBase(TGenericNodeList::Head()));
485+
// }
486+
//
487+
// Iterator End() const
488+
// {
489+
// return Iterator(TNode::FromBase(const_cast<TGenericNodeList::TNode *>(&m_oRoot)));
490+
// }
491+
//
492+
// Iterator RBegin() const
493+
// {
494+
// return Iterator(TNode::FromBase(TGenericNodeList::Tail()));
495+
// }
496+
//
497+
// Iterator REnd() const
498+
// {
499+
// return Iterator(TNode::FromBase(const_cast<TGenericNodeList::TNode *>(&m_oRoot)));
500+
// }
501+
//
502+
// // Access methods
503+
// T *Head() const
504+
// {
505+
// return TNode::FromBase(TGenericNodeList::Head());
506+
// }
507+
//
508+
// T *Tail() const
509+
// {
510+
// return TNode::FromBase(TGenericNodeList::Tail());
511+
// }
512+
//
513+
// // Other methods
514+
// TBOOL IsEmpty() const
515+
// {
516+
// return TGenericNodeList::IsEmpty();
517+
// }
518+
//
519+
// TINT Count() const
520+
// {
521+
// return TGenericNodeList::Count();
522+
// }
523+
//};
524+
525+
327526
template <class T, class Node>
328527
class T2Iterator
329528
{
@@ -409,95 +608,6 @@ class T2Iterator
409608
T *m_pPtr;
410609
};
411610

412-
//class Iterator
413-
//{
414-
//public:
415-
416-
// Iterator()
417-
// {
418-
// m_pPtr = TNULL;
419-
// }
420-
421-
// Iterator(TNode* a_pNode)
422-
// {
423-
// m_pPtr = static_cast<T*>(a_pNode);
424-
// }
425-
426-
// Iterator(T* a_pNode)
427-
// {
428-
// m_pPtr = a_pNode;
429-
// }
430-
431-
// Iterator(const Iterator& a_rIterator)
432-
// {
433-
// m_pPtr = a_rIterator.m_pPtr;
434-
// }
435-
436-
// ~Iterator() = default;
437-
438-
// TBOOL operator!() { return IsNull(); }
439-
// TBOOL operator!=(Iterator& a_rIterator) { return m_pPtr != a_rIterator.m_pPtr; }
440-
441-
// T& operator*() const
442-
// {
443-
// TASSERT(m_pPtr != TNULL);
444-
// return *m_pPtr;
445-
// }
446-
447-
// Iterator& operator++()
448-
// {
449-
// TASSERT(m_pPtr != TNULL);
450-
// m_pPtr = static_cast<T*>(m_pPtr->Next());
451-
// return *this;
452-
// }
453-
454-
// Iterator operator++(int)
455-
// {
456-
// TASSERT(m_pPtr != TNULL);
457-
// Iterator old = m_pPtr;
458-
// m_pPtr = static_cast<T*>(m_pPtr->Next());
459-
// return old;
460-
// }
461-
462-
// Iterator operator--()
463-
// {
464-
// TASSERT(m_pPtr != TNULL);
465-
// m_pPtr = static_cast<T*>(m_pPtr->Prev());
466-
// return *this;
467-
// }
468-
469-
// T* operator->() const
470-
// {
471-
// return m_pPtr;
472-
// }
473-
474-
// void operator=(const Iterator& a_rIterator)
475-
// {
476-
// m_pPtr = a_rIterator.m_pPtr;
477-
// return *this;
478-
// }
479-
480-
// void operator=(T* pPtr)
481-
// {
482-
// m_pPtr = pPtr;
483-
// }
484-
485-
// TBOOL operator==(Iterator& a_rIterator) const
486-
// {
487-
// return m_pPtr == a_rIterator.m_pPtr;
488-
// }
489-
490-
// operator T* () const
491-
// {
492-
// return static_cast<T*>(m_pPtr);
493-
// }
494-
495-
// TBOOL IsNull() { return m_pPtr == TNULL; }
496-
497-
//private:
498-
// T* m_pPtr;
499-
//};
500-
501611
// For the mean time use this until we probably implemented this
502612
template <class T>
503613
class TNodeList

Toshi/Plugins/Include/PGUIRenderer/PGUITRDisplayContext.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#pragma once
12
#include "Defines.h"
23
#include "TKernel/TObject.h"
34
#include "TKernel/TManagedPointer.h"
45
#include "TGui/TGUIDisplayContext.h"
56
#include "TRender/TRenderInterface.h"
6-
#include "PGUITRTextureFactory.h"
7-
#include "PGUITRFontFactory.h"
7+
#include "PGUIRenderer/PGUITRFontFactory.h"
8+
9+
class PGUITRTextureFactory;
810

911
class PGUIRENDERER_EXPORTS PGUITRDisplayContext : Toshi::TGUIDisplayContext
1012
{

0 commit comments

Comments
 (0)