Skip to content

Commit

Permalink
Scripting begins!
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
luigi-rosso and luigi-rosso committed Dec 16, 2024
1 parent 1880239 commit 914d487
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7cc6f5bbe3c726fc1c94f2075aed7f262240282d
b9773680e341b946fa06d046cfeeda8f97555645
2 changes: 2 additions & 0 deletions include/rive/core/binary_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <cstddef>
#include <cstdint>
#include <string>

namespace rive
{
Expand All @@ -25,6 +26,7 @@ class BinaryWriter
void writeDouble(double value);
void write(uint16_t value);
void write(uint32_t value);
void write(std::string value);
void clear();
};
} // namespace rive
Expand Down
34 changes: 34 additions & 0 deletions scripting/premake5.lua
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions src/core/binary_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }

0 comments on commit 914d487

Please sign in to comment.