1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
---|---|
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #include "Resources/BsScriptCode.h" |
4 | #include "Resources/BsResources.h" |
5 | #include "Private/RTTI/BsScriptCodeRTTI.h" |
6 | |
7 | namespace bs |
8 | { |
9 | ScriptCode::ScriptCode(const WString& data, bool editorScript) |
10 | :Resource(false), mString(data), mEditorScript(editorScript) |
11 | { |
12 | |
13 | } |
14 | |
15 | HScriptCode ScriptCode::create(const WString& data, bool editorScript) |
16 | { |
17 | return static_resource_cast<ScriptCode>(gResources()._createResourceHandle(_createPtr(data, editorScript))); |
18 | } |
19 | |
20 | SPtr<ScriptCode> ScriptCode::_createPtr(const WString& data, bool editorScript) |
21 | { |
22 | SPtr<ScriptCode> scriptCodePtr = bs_core_ptr<ScriptCode>( |
23 | new (bs_alloc<ScriptCode>()) ScriptCode(data, editorScript)); |
24 | scriptCodePtr->_setThisPtr(scriptCodePtr); |
25 | scriptCodePtr->initialize(); |
26 | |
27 | return scriptCodePtr; |
28 | } |
29 | |
30 | RTTITypeBase* ScriptCode::getRTTIStatic() |
31 | { |
32 | return ScriptCodeRTTI::instance(); |
33 | } |
34 | |
35 | RTTITypeBase* ScriptCode::getRTTI() const |
36 | { |
37 | return ScriptCode::getRTTIStatic(); |
38 | } |
39 | } |