Skip to content

Commit

Permalink
ALTV-732 | New rml apis
Browse files Browse the repository at this point in the history
  • Loading branch information
vadzz-dev committed Feb 23, 2025
1 parent 80fe718 commit 89c10bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions client/src/classes/RmlDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern js::Class rmlDocumentClass("RmlDocument", &rmlElementClass, nullptr, [](j
tpl.Property<&alt::IRmlDocument::GetSourceUrl>("sourceUrl");
tpl.Property<&alt::IRmlDocument::IsVisible>("isVisible");
tpl.Property<&alt::IRmlDocument::IsModal>("isModal");
tpl.Property<&alt::IRmlDocument::IsFullscreen>("isFullscreen");
tpl.Property<&alt::IRmlDocument::GetBody>("body");

tpl.Method("show", Show);
Expand Down
12 changes: 8 additions & 4 deletions client/src/factories/RmlDocumentFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

// clang-format off
static js::FactoryHandler rmlDocumentFactory(alt::IBaseObject::Type::RML_DOCUMENT, [](js::Object& args) -> alt::IBaseObject* {
std::string url;
if(!args.Get("url", url)) return nullptr;
alt::IRmlDocument::CreateOptions options;

if(!args.Get("url", options.url)) return nullptr;

options.isFullscreen = args.Get<bool>("isFullscreen", options.isFullscreen);
options.size = args.Get<alt::Vector2i>("size", options.size);

js::IResource* resource = args.GetResource();
js::SourceLocation origin = js::SourceLocation::GetCurrent(resource);
options.currentPath = js::SourceLocation::GetCurrent(resource).file;

return alt::ICore::Instance().CreateDocument(url, origin.file, resource->GetResource());
return alt::ICore::Instance().CreateDocument(options, resource->GetResource());
});
2 changes: 1 addition & 1 deletion deps/cpp-sdk
Submodule cpp-sdk updated 2 files
+1 −1 ICore.h
+138 −126 script-objects/IRml.h

0 comments on commit 89c10bd

Please sign in to comment.