skylicht-lab / skylicht-engine

Skylicht Engine is C++ Game Engine based on Irrlicht 3D. And my goal is to create a high-performance and lightweight Game Framework that can seamlessly function on both web and mobile platforms. This framework will be available to everyone for free.
MIT License
630 stars 51 forks source link

Skylicht doesn't load resources #139

Closed Joilnen closed 1 month ago

Joilnen commented 2 years ago

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

ducphamhong commented 2 years ago

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 commented 2 years ago

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 commented 1 month ago

I have fixed on MacOS and Linux Thank you,