skylicht-engine icon indicating copy to clipboard operation
skylicht-engine copied to clipboard

Skylicht doesn't load resources

Open Joilnen opened this issue 2 years ago • 2 comments

It compiles ok but I can't run Should I to follow XCode cmake command to compile it in linux ? output.txt

Joilnen avatar Jan 28 '22 03:01 Joilnen

Hello @Joilnen

Sorry because i not yet test it on MacOS.

The editor run on Windows/Linux load resources directy from path. But MacOS need add all to .zip and add to XCode project At the current version i need do something to load it, but i have not yet did it.

Thanks.

ducphamhong avatar Jan 31 '22 02:01 ducphamhong

You can edit the file: SkylichtEditor.cpp But i think the editor is not yet ready to run on MacOS

void SkylichtEditor::onUpdate()
{
	float currentTime = (float)getIrrlichtDevice()->getTimer()->getTime();

	switch (m_editorState)
	{
	case Startup:
		// init engine
		m_editorState = InitGUI;
		break;
	case InitGUI:
	{
		// import resources
		CBaseApp* app = getApplication();
		app->getFileSystem()->addFileArchive(app->getBuiltInPath("BuiltIn.zip"), false, false); << ADD THIS LINE
		app->getFileSystem()->addFileArchive(app->getBuiltInPath("Editor.zip"), false, false); << ADD THIS LINE

		// load gui shader
		CShaderManager* shaderMgr = CShaderManager::getInstance();
		shaderMgr->initGUIShader();

		// init editor gui		
		u32 w = app->getWidth();
		u32 h = app->getHeight();
		Editor::GUI::CGUIContext::initGUI((float)w, (float)h);

		m_editor = Editor::CEditor::createGetInstance();
		m_editorState = InitEngine;
	}
	break;
	case InitEngine:
	{
		CShaderManager::getInstance()->initBasicShader();
		CShaderManager::getInstance()->initSGDeferredShader();

		// import project		
		m_editor->initImportGUI();

		// change state loading
		m_editorState = Import;
	}
	break;
	case Import:
	{
		// loading project
		if (m_editor->isImportFinish() == true)
		{
			m_editor->closeImportDialog();

			if (m_editor->isUIInitiate() == false)
				m_editor->initEditorGUI();
			else
				m_editor->refresh();

			m_editorState = Running;
		}

		// running
		m_editor->update();
		Editor::GUI::CGUIContext::update(currentTime);
	}
	break;
	default:
		// running
		m_editor->update();
		Editor::GUI::CGUIContext::update(currentTime);
		break;
	}
}

ducphamhong avatar Jan 31 '22 02:01 ducphamhong