Browse Source

Plate resource plString

Adam Johnson 11 years ago committed by Michael Hansen
parent
commit
9e0330feea
  1. 8
      Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp
  2. 4
      Sources/Plasma/PubUtilLib/plPipeline/plPlates.h
  3. 29
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp
  4. 10
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

8
Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp

@ -238,9 +238,9 @@ plMipmap *plPlate::CreateMaterial( uint32_t width, uint32_t height, bool with
//// CreateFromResource ////////////////////////////////////////////////////// //// CreateFromResource //////////////////////////////////////////////////////
// Creates a plate's material from a resource of the given name. // Creates a plate's material from a resource of the given name.
void plPlate::CreateFromResource(const char *resName) void plPlate::CreateFromResource(const plString& resName)
{ {
if (resName) if (!resName.IsEmpty())
{ {
plMipmap* resTexture = new plMipmap; plMipmap* resTexture = new plMipmap;
resTexture->CopyFrom(plClientResMgr::Instance().getResource(resName)); resTexture->CopyFrom(plClientResMgr::Instance().getResource(resName));
@ -256,9 +256,9 @@ void plPlate::CreateFromResource(const char *resName)
} }
} }
void plPlate::ReloadFromResource(const char *resName) void plPlate::ReloadFromResource(const plString& resName)
{ {
if (resName) if (!resName.IsEmpty())
{ {
fMipmap->CopyFrom(plClientResMgr::Instance().getResource(resName)); fMipmap->CopyFrom(plClientResMgr::Instance().getResource(resName));
} }

4
Sources/Plasma/PubUtilLib/plPipeline/plPlates.h

@ -144,8 +144,8 @@ class plPlate
void SetSize( float width, float height, bool adjustByAspectRatio = false ); void SetSize( float width, float height, bool adjustByAspectRatio = false );
plMipmap *CreateMaterial( uint32_t width, uint32_t height, bool withAlpha, plMipmap* texture = NULL ); plMipmap *CreateMaterial( uint32_t width, uint32_t height, bool withAlpha, plMipmap* texture = NULL );
void CreateFromResource( const char *resName ); void CreateFromResource(const plString& resName);
void ReloadFromResource( const char *resName ); void ReloadFromResource(const plString& resName);
}; };
//// plGraphPlate Class Definition /////////////////////////////////////////// //// plGraphPlate Class Definition ///////////////////////////////////////////

29
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp

@ -60,14 +60,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// plProgressMgr Functions ///////////////////////////////////////////////// //// plProgressMgr Functions /////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
plProgressMgr *plProgressMgr::fManager = nil; plProgressMgr* plProgressMgr::fManager = nullptr;
#define LOADING_RES "xLoading_Linking.%02d.png" #define LOADING_RES "xLoading_Linking.%02d.png"
#define LOADING_RES_COUNT 18 #define LOADING_RES_COUNT 18
char* plProgressMgr::fImageRotation[LOADING_RES_COUNT]; plString plProgressMgr::fImageRotation[LOADING_RES_COUNT];
const char* plProgressMgr::fStaticTextIDs[] = { const plString plProgressMgr::fStaticTextIDs[] = {
"xLoading_Linking_Text.png", "xLoading_Linking_Text.png",
"xLoading_Updating_Text.png" "xLoading_Updating_Text.png"
}; };
@ -76,30 +76,21 @@ const char* plProgressMgr::fStaticTextIDs[] = {
plProgressMgr::plProgressMgr() plProgressMgr::plProgressMgr()
{ {
fOperations = nil; fOperations = nullptr;
fManager = this; fManager = this;
fCallbackProc = nil; fCallbackProc = nullptr;
fCurrentStaticText = kNone; fCurrentStaticText = kNone;
// Fill array with pre-computed loading frame IDs // Fill array with pre-computed loading frame IDs
for (int i=0; i < LOADING_RES_COUNT; i++) for (int i=0; i < LOADING_RES_COUNT; i++)
{ fImageRotation[i] = plString::Format(LOADING_RES, i);
char* frameID = new char[128];
sprintf(frameID, LOADING_RES, i);
fImageRotation[i] = frameID;
}
} }
plProgressMgr::~plProgressMgr() plProgressMgr::~plProgressMgr()
{ {
for (int i=0; i < LOADING_RES_COUNT; i++) while (fOperations)
{
delete[] fImageRotation[i];
}
while( fOperations != nil )
delete fOperations; delete fOperations;
fManager = nil; fManager = nullptr;
} }
//// RegisterOperation /////////////////////////////////////////////////////// //// RegisterOperation ///////////////////////////////////////////////////////
@ -238,7 +229,7 @@ void plProgressMgr::CancelAllOps( void )
fCurrentStaticText = kNone; fCurrentStaticText = kNone;
} }
char* plProgressMgr::GetLoadingFrameID(int index) const plString plProgressMgr::GetLoadingFrameID(int index)
{ {
if (index < LOADING_RES_COUNT) if (index < LOADING_RES_COUNT)
return fImageRotation[index]; return fImageRotation[index];
@ -251,7 +242,7 @@ uint32_t plProgressMgr::NumLoadingFrames() const
return LOADING_RES_COUNT; return LOADING_RES_COUNT;
} }
const char* plProgressMgr::GetStaticTextID(StaticText staticTextType) const plString plProgressMgr::GetStaticTextID(StaticText staticTextType)
{ {
return fStaticTextIDs[staticTextType]; return fStaticTextIDs[staticTextType];
} }

10
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

@ -201,9 +201,9 @@ class plProgressMgr
private: private:
static plProgressMgr *fManager; static plProgressMgr* fManager;
static char* fImageRotation[]; static plString fImageRotation[];
static const char* fStaticTextIDs[]; static const plString fStaticTextIDs[];
protected: protected:
@ -235,9 +235,9 @@ class plProgressMgr
virtual ~plProgressMgr(); virtual ~plProgressMgr();
static plProgressMgr* GetInstance() { return fManager; } static plProgressMgr* GetInstance() { return fManager; }
static char* GetLoadingFrameID(int index); static const plString GetLoadingFrameID(int index);
uint32_t plProgressMgr::NumLoadingFrames() const; uint32_t plProgressMgr::NumLoadingFrames() const;
static const char* GetStaticTextID(StaticText staticTextType); static const plString GetStaticTextID(StaticText staticTextType);
virtual void Draw( plPipeline *p ) { } virtual void Draw( plPipeline *p ) { }

Loading…
Cancel
Save