Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blockly editor in C++ project

I'm working on a game where the player writes some basic AI that plays "instead of" him. So an algorithm written by the user must be executable right after he saves it.

The game is written in C++ using Qt framework.

I don't want to scare players with programming so I want to provide them some easy drag'n'drop visual programming editor (like in this CodeSpells game). Blockly looks like exactly what I wanted since it can generate Lua scripts that can be used/executed in C++ code (I need to learn more about this, but that's not for this question).

What I don't know is how to create/integrate this editor in C++. Their documentation says only about web, android and ios.

So my question is: how to integrate Blockly editor to a C++ project?

EDIT :

I wrote to CodeSpells devs. This is the important part of answer:

"For CodeSpells, we used a product called CoherentUI -- which is for Unity. For subsequent projects, we've been using the cheaper Unity product: https://www.assetstore.unity3d.com/en/#!/content/55459"

Can the Blockly editor be integrated in a Qt C++ project using embedded browse? For example like this? (I never worked with it)

like image 662
Pyro2266 Avatar asked Oct 27 '25 05:10

Pyro2266


1 Answers

So, this can be done using embedded browser. I saved Blockly web editor in resources. Then I used QWebEngineView to display editor from resources.

Here is similar tutorial.

like image 122
Pyro2266 Avatar answered Oct 29 '25 20:10

Pyro2266



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!