fix build of modules

This commit is contained in:
Anthony Rabine 2025-10-01 17:38:52 +02:00
parent da04c38dec
commit 31e76ce6d7
6 changed files with 46 additions and 30 deletions

View file

@ -9,8 +9,8 @@ Size=400,400
Collapsed=0
[Window][Library Manager]
Pos=591,26
Size=689,224
Pos=597,26
Size=683,350
Collapsed=0
DockId=0x00000003,0
@ -21,20 +21,20 @@ Collapsed=0
DockId=0x00000004,0
[Window][Emulator]
Pos=591,26
Size=689,224
Pos=597,26
Size=683,350
Collapsed=0
DockId=0x00000003,5
[Window][Code viewer]
Pos=591,26
Size=689,224
Pos=597,26
Size=683,350
Collapsed=0
DockId=0x00000003,4
[Window][Resources]
Pos=591,26
Size=689,224
Pos=597,26
Size=683,350
Collapsed=0
DockId=0x00000003,1
@ -56,20 +56,20 @@ Collapsed=0
DockId=0x00000005,0
[Window][CPU]
Pos=591,26
Size=689,224
Pos=597,26
Size=683,350
Collapsed=0
DockId=0x00000003,2
[Window][RAM view]
Pos=591,26
Size=689,224
Pos=597,26
Size=683,350
Collapsed=0
DockId=0x00000003,3
[Window][Properties]
Pos=591,252
Size=689,279
Pos=597,378
Size=683,153
Collapsed=0
DockId=0x00000006,0
@ -90,13 +90,13 @@ Collapsed=0
[Window][Module editor]
Pos=60,26
Size=529,505
Size=535,505
Collapsed=0
DockId=0x00000001,1
[Window][Story editor]
Pos=60,26
Size=529,505
Size=535,505
Collapsed=0
DockId=0x00000001,0
@ -144,10 +144,10 @@ Column 0 Sort=0v
[Docking][Data]
DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=60,26 Size=1220,694 Split=Y
DockNode ID=0x00000007 Parent=0x08BD597D SizeRef=1220,505 Split=X
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=721,694 CentralNode=1 Selected=0x93ADCAAB
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=689,694 Split=Y Selected=0x52EB28B5
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=718,224 Selected=0x63869CAF
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=718,279 Selected=0x8C72BEA8
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=535,694 CentralNode=1 Selected=0x93ADCAAB
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=683,694 Split=Y Selected=0x52EB28B5
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=718,452 Selected=0x63869CAF
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=718,197 Selected=0x8C72BEA8
DockNode ID=0x00000008 Parent=0x08BD597D SizeRef=1220,187 Split=X Selected=0xEA83D666
DockNode ID=0x00000004 Parent=0x00000008 SizeRef=610,192 Selected=0xEA83D666
DockNode ID=0x00000005 Parent=0x00000008 SizeRef=608,192 Selected=0x6DE9B20C

View file

@ -247,10 +247,6 @@ void AppController::CompileNodes(IStoryProject::Type type)
{
if (m_story->GenerateScript(m_storyAssembly))
{
// La GUI (DebuggerWindow) doit être notifiée de cette mise à jour.
// Au lieu de appeler m_debuggerWindow.SetScript(m_storyAssembly); directement,
// AppController pourrait émettre un événement ou un callback.
// Pour l'instant, on suppose une notification ou que la GUI tire les données.
m_logger.Log("Nodes script generated for story.");
Build(true); // Compile seulement par défaut
}
@ -261,9 +257,11 @@ void AppController::CompileNodes(IStoryProject::Type type)
}
else if (type == IStoryProject::Type::PROJECT_TYPE_MODULE && m_module)
{
if (m_module->GenerateScript(m_storyAssembly))
if (m_module->GenerateScript(m_moduleAssembly))
{
m_logger.Log("Nodes script generated for module.");
m_eventBus.Emit(std::make_shared<ModuleEvent>(ModuleEvent::Type::BuildSuccess, m_module->GetUuid()));
Build(true); // Compile seulement par défaut
}
else
{

View file

@ -104,6 +104,8 @@ public:
void ProcessStory();
void StepInstruction();
void StopAudio() { m_player.Stop(); }
std::string GetModuleAssembly() const { return m_moduleAssembly; }
std::string GetStoryAssembly() const { return m_storyAssembly; }
bool IsLibraryManagerInitialized() const { return m_libraryManager.IsInitialized(); }

View file

@ -62,6 +62,8 @@ public:
{
Opened,
Closed,
BuildSuccess,
BuildFailure
};
ModuleEvent(Type type, const std::string &uuid)
@ -70,9 +72,17 @@ public:
Type GetType() const { return m_type; }
const std::string& GetUuid() const { return m_uuid; }
const std::string& GetScript() const { return m_script; }
bool IsSuccess() const { return success; }
void SetScript(const std::string& script) { m_script = script; }
void SetSuccess(bool s) { success = s; }
private:
Type m_type;
std::string m_uuid;
std::string m_script;
bool success{false};
};
#endif // ALL_EVENTS_H

View file

@ -71,6 +71,11 @@ MainWindow::MainWindow(ILogger& logger, EventBus& eventBus, AppController& appCo
OpenModule(event.GetUuid());
} else if (event.GetType() == ModuleEvent::Type::Closed) {
CloseModule();
} else if (event.GetType() == ModuleEvent::Type::BuildSuccess) {
m_toastNotifier.addToast("Module", "Module built successfully", ToastType::Success);
m_debuggerWindow.SetScript(m_appController.GetModuleAssembly());
} else if (event.GetType() == ModuleEvent::Type::BuildFailure) {
m_toastNotifier.addToast("Module", "Module build failed", ToastType::Error);
}
});
}
@ -388,7 +393,7 @@ void MainWindow::DrawToolBar(float topPadding)
// Création de la fenêtre pour la barre d'outils
ImGui::Begin("ToolBar", nullptr, window_flags);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); // rouge
// ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); // rouge
float old_size = ImGui::GetFont()->Scale;
ImGui::GetFont()->Scale *= 2.5;
@ -415,7 +420,7 @@ void MainWindow::DrawToolBar(float topPadding)
ImGui::GetFont()->Scale = old_size;
ImGui::PopFont();
ImGui::PopStyleColor();
// ImGui::PopStyleColor();
// Fermeture de la fenêtre ImGui

View file

@ -15,10 +15,11 @@ PrintNodeWidget::PrintNodeWidget(IStoryManager &manager, std::shared_ptr<BaseNod
{
m_printNode = std::dynamic_pointer_cast<PrintNode>(node);
// Create defaut one input and one output
AddInputs(1);
SetInputPinName(0, "");
AddInputs(2);
SetInputPinName(0, ">");
SetInputPinName(1, "Argument 1");
AddOutputs(1);
SetOutPinName(0, "");
SetOutPinName(0, ">");
}
void PrintNodeWidget::Initialize()