mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 14:12:51 +00:00
- more fixes on #672 on windows
- added #660, but need help on osx, help please I don't have a mac! - fixed #667 and #668 (eol detection in comments) - added #670 (hint when using method without () )
This commit is contained in:
parent
549d344f0f
commit
0a557f3bf5
@ -155,7 +155,7 @@ Error DirAccess::make_dir_recursive(String p_dir) {
|
||||
full_dir=dir;
|
||||
}
|
||||
|
||||
int slices = full_dir.get_slice_count("/");
|
||||
//int slices = full_dir.get_slice_count("/");
|
||||
|
||||
int pos = 0;
|
||||
while (pos < full_dir.length()) {
|
||||
|
@ -60,6 +60,7 @@ void Input::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask);
|
||||
ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode);
|
||||
ObjectTypeDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode);
|
||||
ObjectTypeDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos);
|
||||
|
||||
BIND_CONSTANT( MOUSE_MODE_VISIBLE );
|
||||
BIND_CONSTANT( MOUSE_MODE_HIDDEN );
|
||||
@ -304,6 +305,11 @@ int InputDefault::get_mouse_button_mask() const {
|
||||
return OS::get_singleton()->get_mouse_button_state();
|
||||
}
|
||||
|
||||
void InputDefault::warp_mouse_pos(const Vector2& p_to) {
|
||||
|
||||
OS::get_singleton()->warp_mouse_pos(p_to);
|
||||
}
|
||||
|
||||
|
||||
void InputDefault::iteration(float p_step) {
|
||||
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
virtual Point2 get_mouse_speed() const=0;
|
||||
virtual int get_mouse_button_mask() const=0;
|
||||
|
||||
virtual void warp_mouse_pos(const Vector2& p_to)=0;
|
||||
|
||||
virtual Vector3 get_accelerometer()=0;
|
||||
|
||||
virtual void action_press(const StringName& p_action)=0;
|
||||
@ -128,6 +130,9 @@ public:
|
||||
virtual Point2 get_mouse_speed() const;
|
||||
virtual int get_mouse_button_mask() const;
|
||||
|
||||
virtual void warp_mouse_pos(const Vector2& p_to);
|
||||
|
||||
|
||||
void parse_input_event(const InputEvent& p_event);
|
||||
void set_accelerometer(const Vector3& p_accel);
|
||||
void set_joy_axis(int p_device,int p_axis,float p_value);
|
||||
|
@ -136,6 +136,7 @@ public:
|
||||
virtual MouseMode get_mouse_mode() const;
|
||||
|
||||
|
||||
virtual void warp_mouse_pos(const Point2& p_to) {}
|
||||
virtual Point2 get_mouse_pos() const=0;
|
||||
virtual int get_mouse_button_state() const=0;
|
||||
virtual void set_window_title(const String& p_title)=0;
|
||||
|
@ -387,6 +387,7 @@ public:
|
||||
static Variant construct(const Variant::Type,const Variant** p_args,int p_argcount,CallError &r_error);
|
||||
|
||||
void get_method_list(List<MethodInfo> *p_list) const;
|
||||
bool has_method(const StringName& p_method) const;
|
||||
|
||||
void set_named(const StringName& p_index, const Variant& p_value, bool *r_valid=NULL);
|
||||
Variant get_named(const StringName& p_index, bool *r_valid=NULL) const;
|
||||
|
@ -1012,6 +1012,32 @@ Variant Variant::construct(const Variant::Type p_type,const Variant** p_args,int
|
||||
return Variant();
|
||||
}
|
||||
|
||||
|
||||
bool Variant::has_method(const StringName& p_method) const {
|
||||
|
||||
|
||||
if (type==OBJECT) {
|
||||
Object *obj = operator Object*();
|
||||
if (!obj)
|
||||
return false;
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (ScriptDebugger::get_singleton()) {
|
||||
if (ObjectDB::instance_validate(obj)) {
|
||||
#endif
|
||||
return obj->has_method(p_method);
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[type];
|
||||
return fd.functions.has(p_method);
|
||||
|
||||
}
|
||||
|
||||
void Variant::get_method_list(List<MethodInfo> *p_list) const {
|
||||
|
||||
|
||||
|
@ -510,7 +510,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
|
||||
*dst = src->get_named(*index,&valid);
|
||||
|
||||
if (!valid) {
|
||||
err_text="Invalid get index '"+index->operator String()+"' (on base: '"+_get_var_type(src)+"').";
|
||||
if (src->has_method(*index)) {
|
||||
err_text="Invalid get index '"+index->operator String()+"' (on base: '"+_get_var_type(src)+"'). Did you mean '."+index->operator String()+"()' ?";
|
||||
} else {
|
||||
err_text="Invalid get index '"+index->operator String()+"' (on base: '"+_get_var_type(src)+"').";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,8 @@ void GDTokenizerText::_advance() {
|
||||
while(GETCHAR(0)!='\n') {
|
||||
code_pos++;
|
||||
if (GETCHAR(0)==0) { //end of file
|
||||
_make_error("Unterminated Comment");
|
||||
//_make_error("Unterminated Comment");
|
||||
_make_token(TK_EOF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ public:
|
||||
virtual void set_mouse_show(bool p_show);
|
||||
virtual void set_mouse_grab(bool p_grab);
|
||||
virtual bool is_mouse_grab_enabled() const;
|
||||
virtual void warp_mouse_pos(const Point2& p_to);
|
||||
virtual Point2 get_mouse_pos() const;
|
||||
virtual int get_mouse_button_state() const;
|
||||
virtual void set_window_title(const String& p_title);
|
||||
|
@ -1067,6 +1067,12 @@ bool OS_OSX::is_mouse_grab_enabled() const {
|
||||
|
||||
return mouse_grab;
|
||||
}
|
||||
|
||||
void OS_OSX::warp_mouse_pos(const Point2& p_to) {
|
||||
|
||||
//not done, must be done
|
||||
}
|
||||
|
||||
Point2 OS_OSX::get_mouse_pos() const {
|
||||
|
||||
return Vector2(mouse_x,mouse_y);
|
||||
|
@ -1323,11 +1323,25 @@ void OS_Windows::set_mouse_mode(MouseMode p_mode) {
|
||||
|
||||
OS_Windows::MouseMode OS_Windows::get_mouse_mode() const{
|
||||
|
||||
|
||||
return mouse_mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OS_Windows::warp_mouse_pos(const Point2& p_to) {
|
||||
|
||||
if (p_mode==MOUSE_MODE_CAPTURED) {
|
||||
|
||||
old_x=p_to.x;
|
||||
old_y=p_to.y;
|
||||
} else {
|
||||
|
||||
SetCursorPos(p_to.x, p_to.y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Point2 OS_Windows::get_mouse_pos() const {
|
||||
|
||||
return Point2(old_x, old_y);
|
||||
@ -1836,7 +1850,7 @@ String OS_Windows::get_data_dir() const {
|
||||
if (has_environment("APPDATA")) {
|
||||
|
||||
bool use_godot = Globals::get_singleton()->get("application/use_shared_user_dir");
|
||||
if (use_godot)
|
||||
if (!use_godot)
|
||||
return (OS::get_singleton()->get_environment("APPDATA")+"/"+an).replace("\\","/");
|
||||
else
|
||||
return (OS::get_singleton()->get_environment("APPDATA")+"/Godot/app_userdata/"+an).replace("\\","/");
|
||||
|
@ -209,6 +209,7 @@ public:
|
||||
void set_mouse_mode(MouseMode p_mode);
|
||||
MouseMode get_mouse_mode() const;
|
||||
|
||||
virtual void warp_mouse_pos(const Point2& p_to);
|
||||
virtual Point2 get_mouse_pos() const;
|
||||
virtual int get_mouse_button_state() const;
|
||||
virtual void set_window_title(const String& p_title);
|
||||
|
@ -461,6 +461,19 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
|
||||
|
||||
}
|
||||
|
||||
void OS_X11::warp_mouse_pos(const Point2& p_to) {
|
||||
|
||||
if (mouse_mode==MOUSE_MODE_CAPTURED) {
|
||||
|
||||
last_mouse_pos=p_to;
|
||||
} else {
|
||||
|
||||
XWarpPointer(x11_display, None, x11_window,
|
||||
0,0,0,0, (int)p_to.x, (int)p_to.y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OS::MouseMode OS_X11::get_mouse_mode() const {
|
||||
|
||||
return mouse_mode;
|
||||
|
@ -179,6 +179,7 @@ public:
|
||||
void set_mouse_mode(MouseMode p_mode);
|
||||
MouseMode get_mouse_mode() const;
|
||||
|
||||
virtual void warp_mouse_pos(const Point2& p_to);
|
||||
virtual Point2 get_mouse_pos() const;
|
||||
virtual int get_mouse_button_state() const;
|
||||
virtual void set_window_title(const String& p_title);
|
||||
|
@ -134,6 +134,8 @@ ShaderLanguage::Token ShaderLanguage::read_token(const CharType* p_text,int p_le
|
||||
while(GETCHAR(r_chars+1)!='\n' && GETCHAR(r_chars+1)!=0) {
|
||||
r_chars++;
|
||||
}
|
||||
r_chars++;
|
||||
//r_line++;
|
||||
|
||||
return Token();
|
||||
|
||||
@ -981,17 +983,17 @@ const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={
|
||||
{OP_NEG,TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}},
|
||||
{OP_NOT,TYPE_BOOL,{TYPE_BOOL,TYPE_VOID}},
|
||||
{OP_CMP_EQ,TYPE_BOOL,{TYPE_BOOL,TYPE_BOOL}},
|
||||
{OP_CMP_EQ,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}},
|
||||
{OP_CMP_EQ,TYPE_VEC2,{TYPE_VEC3,TYPE_VEC2}},
|
||||
{OP_CMP_EQ,TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3}},
|
||||
{OP_CMP_EQ,TYPE_VEC4,{TYPE_VEC3,TYPE_VEC4}},
|
||||
{OP_CMP_EQ,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}},
|
||||
{OP_CMP_EQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC2}},
|
||||
{OP_CMP_EQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC3}},
|
||||
{OP_CMP_EQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC4}},
|
||||
//{OP_CMP_EQ,TYPE_MAT3,{TYPE_MAT4,TYPE_MAT3}}, ??
|
||||
//{OP_CMP_EQ,TYPE_MAT4,{TYPE_MAT4,TYPE_MAT4}}, ??
|
||||
{OP_CMP_NEQ,TYPE_BOOL,{TYPE_BOOL,TYPE_BOOL}},
|
||||
{OP_CMP_NEQ,TYPE_F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