commit
ec93668f8d
30 changed files with 840 additions and 106 deletions
|
|
@ -995,12 +995,44 @@ Variant Object::get_meta(const String& p_name) const {
|
|||
return metadata[p_name];
|
||||
}
|
||||
|
||||
|
||||
Array Object::_get_property_list_bind() const {
|
||||
|
||||
List<PropertyInfo> lpi;
|
||||
get_property_list(&lpi);
|
||||
return convert_property_list(&lpi);
|
||||
}
|
||||
|
||||
Array Object::_get_method_list_bind() const {
|
||||
|
||||
List<MethodInfo> ml;
|
||||
get_method_list(&ml);
|
||||
Array ret;
|
||||
|
||||
for(List<MethodInfo>::Element *E=ml.front();E;E=E->next()) {
|
||||
|
||||
Dictionary d;
|
||||
d["name"]=E->get().name;
|
||||
d["args"]=convert_property_list(&E->get().arguments);
|
||||
Array da;
|
||||
for(int i=0;i<E->get().default_arguments.size();i++)
|
||||
da.push_back(E->get().default_arguments[i]);
|
||||
d["default_args"]=da;
|
||||
d["flags"]=E->get().flags;
|
||||
d["id"]=E->get().id;
|
||||
Dictionary r;
|
||||
r["type"]=E->get().return_val.type;
|
||||
r["hint"]=E->get().return_val.hint;
|
||||
r["hint_string"]=E->get().return_val.hint_string;
|
||||
d["return_type"]=r;
|
||||
//va.push_back(d);
|
||||
ret.push_back(d);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
DVector<String> Object::_get_meta_list_bind() const {
|
||||
|
||||
DVector<String> _metaret;
|
||||
|
|
@ -1439,6 +1471,7 @@ void Object::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("set","property","value"),&Object::_set_bind);
|
||||
ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind);
|
||||
ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind);
|
||||
ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind);
|
||||
ObjectTypeDB::bind_method(_MD("notification","what"),&Object::notification,DEFVAL(false));
|
||||
ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ enum PropertyHint {
|
|||
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
|
||||
PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
|
||||
PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
|
||||
PROPERTY_HINT_SPRITE_FRAME,
|
||||
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
|
||||
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
|
||||
PROPERTY_HINT_ALL_FLAGS,
|
||||
|
|
@ -448,6 +449,7 @@ protected:
|
|||
|
||||
DVector<String> _get_meta_list_bind() const;
|
||||
Array _get_property_list_bind() const;
|
||||
Array _get_method_list_bind() const;
|
||||
|
||||
public: //should be protected, but bug in clang++
|
||||
static void initialize_type();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,20 @@
|
|||
|
||||
void MainLoop::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method("input_event",&MainLoop::input_event);
|
||||
ObjectTypeDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event);
|
||||
ObjectTypeDB::bind_method(_MD("input_text","text"),&MainLoop::input_text);
|
||||
ObjectTypeDB::bind_method(_MD("init"),&MainLoop::init);
|
||||
ObjectTypeDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration);
|
||||
ObjectTypeDB::bind_method(_MD("idle","delta"),&MainLoop::idle);
|
||||
ObjectTypeDB::bind_method(_MD("finish"),&MainLoop::finish);
|
||||
|
||||
BIND_VMETHOD( MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"ev")) );
|
||||
BIND_VMETHOD( MethodInfo("_input_text",PropertyInfo(Variant::STRING,"text")) );
|
||||
BIND_VMETHOD( MethodInfo("_initialize") );
|
||||
BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) );
|
||||
BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) );
|
||||
BIND_VMETHOD( MethodInfo("_finalize") );
|
||||
|
||||
|
||||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
|
||||
|
|
@ -58,13 +71,15 @@ MainLoop::~MainLoop()
|
|||
|
||||
void MainLoop::input_text( const String& p_text ) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("_input_text",p_text);
|
||||
|
||||
}
|
||||
|
||||
void MainLoop::input_event( const InputEvent& p_event ) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("input_event",p_event);
|
||||
get_script_instance()->call("_input_event",p_event);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -74,13 +89,13 @@ void MainLoop::init() {
|
|||
set_script(init_script.get_ref_ptr());
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("init");
|
||||
get_script_instance()->call("_initialize");
|
||||
|
||||
}
|
||||
bool MainLoop::iteration(float p_time) {
|
||||
|
||||
if (get_script_instance())
|
||||
return get_script_instance()->call("iteration",p_time);
|
||||
return get_script_instance()->call("_iteration",p_time);
|
||||
|
||||
return false;
|
||||
|
||||
|
|
@ -88,14 +103,14 @@ bool MainLoop::iteration(float p_time) {
|
|||
bool MainLoop::idle(float p_time) {
|
||||
|
||||
if (get_script_instance())
|
||||
return get_script_instance()->call("idle",p_time);
|
||||
return get_script_instance()->call("_idle",p_time);
|
||||
|
||||
return false;
|
||||
}
|
||||
void MainLoop::finish() {
|
||||
|
||||
if (get_script_instance()) {
|
||||
get_script_instance()->call("finish");
|
||||
get_script_instance()->call("_finalize");
|
||||
set_script(RefPtr()); //clear script
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue