Scripting begins!

Hefty document with all the details of what's implemented so far (check out sub-pages in the Tasks grid) [here](https://www.notion.so/rive-app/Hydrogen-1175da0b06d9807ea221c1cd2fbd0175?pvs=4).

Working in the desktop and web editors:

Desktop
![CleanShot 2024-12-13 at 15 47 33@2x](https://github.com/user-attachments/assets/04c796a7-c358-48cc-8f3a-8e31439eafd9)

Web
![CleanShot 2024-12-13 at 15 47 59@2x](https://github.com/user-attachments/assets/fd67851a-ef76-4420-8459-a0bfeb8b94dd)

There's also a standalone test app in packages/sample_code_core:
![CleanShot 2024-12-13 at 15 48 54@2x](https://github.com/user-attachments/assets/7deedf87-3b54-4f80-876b-ac348a0d5b0d)

Diffs=
b9773680e3 Scripting begins! (#8751)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This commit is contained in:
luigi-rosso
2024-12-16 16:52:22 +00:00
parent 1880239f07
commit 914d487551
4 changed files with 44 additions and 1 deletions

View File

@@ -1 +1 @@
7cc6f5bbe3c726fc1c94f2075aed7f262240282d
b9773680e341b946fa06d046cfeeda8f97555645

View File

@@ -3,6 +3,7 @@
#include <cstddef>
#include <cstdint>
#include <string>
namespace rive
{
@@ -25,6 +26,7 @@ public:
void writeDouble(double value);
void write(uint16_t value);
void write(uint32_t value);
void write(std::string value);
void clear();
};
} // namespace rive

34
scripting/premake5.lua Executable file
View File

@@ -0,0 +1,34 @@
local dependency = require("dependency")
luau = dependency.github("luigi-rosso/luau", "rive_0_2")
require("export-compile-commands")
dofile("rive_build_config.lua")
project("luau_vm")
do
kind("StaticLib")
exceptionhandling("On")
includedirs({
luau .. "/VM/include",
luau .. "/Common/include",
})
files({ luau .. "/VM/src/**.cpp" })
optimize("Size")
end
project("luau_compiler")
do
kind("StaticLib")
exceptionhandling("On")
includedirs({
luau .. "/Compiler/include",
luau .. "/Ast/include",
luau .. "/Common/include",
})
files({ luau .. "/Compiler/src/**.cpp", luau .. "/Ast/src/**.cpp" })
optimize("Size")
end

View File

@@ -142,4 +142,11 @@ void BinaryWriter::write(uint32_t value)
m_Stream->write((const uint8_t*)&value, 4);
}
void BinaryWriter::write(std::string value)
{
auto length = value.size();
writeVarUint((uint64_t)length);
write((uint8_t*)value.c_str(), length);
}
void BinaryWriter::clear() { m_Stream->clear(); }