Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed Oct 3, 2024
1 parent d09e58d commit cbd797f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
5 changes: 5 additions & 0 deletions Projects/Skylicht/Engine/Graphics2D/CGraphics2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ namespace Skylicht
return m_2dMaterial;
}

IMeshBuffer* getCurrentBuffer()
{
return m_buffer;
}

private:

void updateRectBuffer(video::S3DVertex* vtx, const core::rectf& r, const core::matrix4& mat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ This file is part of the "Skylicht Engine".
*/

#include "pch.h"
#include "CSpineLoader.h"
#include "CSpineResource.h"

using namespace Skylicht;

namespace spine
{
CSpineLoader::CSpineLoader() :
CSpineResource::CSpineResource() :
m_textureLoader(NULL),
m_drawable(NULL),
m_atlas(NULL),
Expand All @@ -40,12 +40,12 @@ namespace spine

}

CSpineLoader::~CSpineLoader()
CSpineResource::~CSpineResource()
{
free();
}

bool CSpineLoader::loadAtlas(const char* path, const char* folder)
bool CSpineResource::loadAtlas(const char* path, const char* folder)
{
io::IFileSystem* fs = getIrrlichtDevice()->getFileSystem();

Expand All @@ -70,11 +70,11 @@ namespace spine
return true;
}

bool CSpineLoader::loadSkeletonJson(const char* path)
bool CSpineResource::loadSkeletonJson(const char* path)
{
if (m_atlas == NULL)
{
os::Printer::log("[CSpineLoader] loadSkeletonJson with NULL atlas");
os::Printer::log("[CSpineResource] loadSkeletonJson with NULL atlas");
return false;
}

Expand Down Expand Up @@ -109,15 +109,15 @@ namespace spine
}
else
{
os::Printer::log("[CSpineLoader] loadSkeletonJson load json failed!");
os::Printer::log("[CSpineResource] loadSkeletonJson load json failed!");
os::Printer::log(m_skeletonJson->getError().buffer());
}

delete[]fileData;
return true;
}

void CSpineLoader::free()
void CSpineResource::free()
{
if (m_skeletonJson)
delete m_skeletonJson;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This file is part of the "Skylicht Engine".

namespace spine
{
class CSpineLoader
class CSpineResource
{
protected:
CTextureLoader* m_textureLoader;
Expand All @@ -41,14 +41,19 @@ namespace spine
spine::SkeletonData* m_skeletonData;

public:
CSpineLoader();
CSpineResource();

virtual ~CSpineLoader();
virtual ~CSpineResource();

bool loadAtlas(const char* path, const char* folder);

bool loadSkeletonJson(const char* path);

void free();

inline CSkeletonDrawable* getDrawable()
{
return m_drawable;
}
};
}
4 changes: 2 additions & 2 deletions Projects/SpineCpp/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if(MSVC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
else()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -std=c99")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -Wno-unused-parameter -std=c++11 -fno-exceptions -fno-rtti")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -std=c99")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -std=c++11 -fno-exceptions")
if (${SPINE_SANITIZE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined")
Expand Down
8 changes: 4 additions & 4 deletions Samples/Spine2D/Source/CViewDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "CImguiManager.h"
#include "imgui.h"

#include "CSpineLoader.h"
#include "CSpineResource.h"

CViewDemo::CViewDemo()
{
Expand Down Expand Up @@ -37,9 +37,9 @@ void CViewDemo::onInit()
io::IFileSystem* fs = getIrrlichtDevice()->getFileSystem();

// spine2d
spine::CSpineLoader spineLoader;
spineLoader.loadAtlas("SampleSpine2D/spineboy-pma.atlas", "SampleSpine2D");
spineLoader.loadSkeletonJson("SampleSpine2D/spineboy-pro.json");
spine::CSpineResource spineRes;
spineRes.loadAtlas("SampleSpine2D/spineboy-pma.atlas", "SampleSpine2D");
spineRes.loadSkeletonJson("SampleSpine2D/spineboy-pro.json");

scene->updateIndexSearchObject();
}
Expand Down

0 comments on commit cbd797f

Please sign in to comment.