Changeset View
Changeset View
Standalone View
Standalone View
source/gui/scripting/GuiScriptConversions.cpp
Show All 14 Lines | |||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "gui/CGUIColor.h" | #include "gui/CGUIColor.h" | ||||
#include "gui/CGUIList.h" | #include "gui/CGUIList.h" | ||||
#include "gui/CGUISeries.h" | #include "gui/CGUISeries.h" | ||||
#include "gui/CIntList.h" | |||||
#include "gui/GUIbase.h" | #include "gui/GUIbase.h" | ||||
#include "gui/IGUIObject.h" | #include "gui/IGUIObject.h" | ||||
#include "lib/external_libraries/libsdl.h" | #include "lib/external_libraries/libsdl.h" | ||||
#include "maths/Vector2D.h" | #include "maths/Vector2D.h" | ||||
#include "ps/Hotkey.h" | #include "ps/Hotkey.h" | ||||
#include "scriptinterface/ScriptConversions.h" | #include "scriptinterface/ScriptConversions.h" | ||||
#define SET(obj, name, value) STMT(JS::RootedValue v_(cx); AssignOrToJSVal(cx, &v_, (value)); JS_SetProperty(cx, obj, (name), v_)) | #define SET(obj, name, value) STMT(JS::RootedValue v_(cx); AssignOrToJSVal(cx, &v_, (value)); JS_SetProperty(cx, obj, (name), v_)) | ||||
▲ Show 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | template<> void ScriptInterface::ToJSVal<CGUISeries>(JSContext* cx, JS::MutableHandleValue ret, const CGUISeries& val) | ||||
ToJSVal(cx, ret, val.m_Series); | ToJSVal(cx, ret, val.m_Series); | ||||
} | } | ||||
template<> bool ScriptInterface::FromJSVal<CGUISeries>(JSContext* cx, JS::HandleValue v, CGUISeries& out) | template<> bool ScriptInterface::FromJSVal<CGUISeries>(JSContext* cx, JS::HandleValue v, CGUISeries& out) | ||||
{ | { | ||||
return FromJSVal(cx, v, out.m_Series); | return FromJSVal(cx, v, out.m_Series); | ||||
} | } | ||||
template<> void ScriptInterface::ToJSVal<CIntList>(JSContext* cx, JS::MutableHandleValue ret, const CIntList& val) | |||||
{ | |||||
ToJSVal(cx, ret, val.m_Items); | |||||
} | |||||
template<> bool ScriptInterface::FromJSVal<CIntList>(JSContext* cx, JS::HandleValue v, CIntList& out) | |||||
{ | |||||
return FromJSVal(cx, v, out.m_Items); | |||||
} | |||||
template<> void ScriptInterface::ToJSVal<EVAlign>(JSContext* cx, JS::MutableHandleValue ret, const EVAlign& val) | template<> void ScriptInterface::ToJSVal<EVAlign>(JSContext* cx, JS::MutableHandleValue ret, const EVAlign& val) | ||||
{ | { | ||||
std::string word; | std::string word; | ||||
switch (val) | switch (val) | ||||
{ | { | ||||
case EVAlign_Top: | case EVAlign_Top: | ||||
word = "top"; | word = "top"; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator