Input: Remove usage of platform dependent event IDs.
The ID property for InputEvents is set by `SceneTree` when sending the event down the tree. So there's no need for the platform specific code to set this value when it will later be overriden anyway...
This commit is contained in:
parent
a0b0dff6fd
commit
c0b6756875
@ -795,25 +795,25 @@ InputDefault::InputDefault() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t InputDefault::joy_button(uint32_t p_last_id, int p_device, int p_button, bool p_pressed) {
|
void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
|
||||||
|
|
||||||
_THREAD_SAFE_METHOD_;
|
_THREAD_SAFE_METHOD_;
|
||||||
Joypad &joy = joy_names[p_device];
|
Joypad &joy = joy_names[p_device];
|
||||||
//printf("got button %i, mapping is %i\n", p_button, joy.mapping);
|
//printf("got button %i, mapping is %i\n", p_button, joy.mapping);
|
||||||
if (joy.last_buttons[p_button] == p_pressed) {
|
if (joy.last_buttons[p_button] == p_pressed) {
|
||||||
return p_last_id;
|
return;
|
||||||
//printf("same button value\n");
|
|
||||||
}
|
}
|
||||||
joy.last_buttons[p_button] = p_pressed;
|
joy.last_buttons[p_button] = p_pressed;
|
||||||
if (joy.mapping == -1) {
|
if (joy.mapping == -1) {
|
||||||
return _button_event(p_last_id, p_device, p_button, p_pressed);
|
_button_event(p_device, p_button, p_pressed);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<int, JoyEvent>::Element *el = map_db[joy.mapping].buttons.find(p_button);
|
Map<int, JoyEvent>::Element *el = map_db[joy.mapping].buttons.find(p_button);
|
||||||
if (!el) {
|
if (!el) {
|
||||||
//don't process un-mapped events for now, it could mess things up badly for devices with additional buttons/axis
|
//don't process un-mapped events for now, it could mess things up badly for devices with additional buttons/axis
|
||||||
//return _button_event(p_last_id, p_device, p_button, p_pressed);
|
//return _button_event(p_last_id, p_device, p_button, p_pressed);
|
||||||
return p_last_id;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
JoyEvent map = el->get();
|
JoyEvent map = el->get();
|
||||||
@ -822,37 +822,38 @@ uint32_t InputDefault::joy_button(uint32_t p_last_id, int p_device, int p_button
|
|||||||
if (map.index == JOY_L2 || map.index == JOY_R2) {
|
if (map.index == JOY_L2 || map.index == JOY_R2) {
|
||||||
float value = p_pressed ? 1.0f : 0.0f;
|
float value = p_pressed ? 1.0f : 0.0f;
|
||||||
int axis = map.index == JOY_L2 ? JOY_ANALOG_L2 : JOY_ANALOG_R2;
|
int axis = map.index == JOY_L2 ? JOY_ANALOG_L2 : JOY_ANALOG_R2;
|
||||||
p_last_id = _axis_event(p_last_id, p_device, axis, value);
|
_axis_event(p_device, axis, value);
|
||||||
}
|
}
|
||||||
return _button_event(p_last_id, p_device, map.index, p_pressed);
|
_button_event(p_device, map.index, p_pressed);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (map.type == TYPE_AXIS) {
|
if (map.type == TYPE_AXIS) {
|
||||||
return _axis_event(p_last_id, p_device, map.index, p_pressed ? 1.0 : 0.0);
|
_axis_event(p_device, map.index, p_pressed ? 1.0 : 0.0);
|
||||||
};
|
};
|
||||||
|
|
||||||
return p_last_id; // no event?
|
return; // no event?
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, const JoyAxis &p_value) {
|
void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
||||||
|
|
||||||
_THREAD_SAFE_METHOD_;
|
_THREAD_SAFE_METHOD_;
|
||||||
|
|
||||||
Joypad &joy = joy_names[p_device];
|
Joypad &joy = joy_names[p_device];
|
||||||
|
|
||||||
if (joy.last_axis[p_axis] == p_value.value) {
|
if (joy.last_axis[p_axis] == p_value.value) {
|
||||||
return p_last_id;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_value.value > joy.last_axis[p_axis]) {
|
if (p_value.value > joy.last_axis[p_axis]) {
|
||||||
|
|
||||||
if (p_value.value < joy.last_axis[p_axis] + joy.filter) {
|
if (p_value.value < joy.last_axis[p_axis] + joy.filter) {
|
||||||
|
|
||||||
return p_last_id;
|
return;
|
||||||
}
|
}
|
||||||
} else if (p_value.value > joy.last_axis[p_axis] - joy.filter) {
|
} else if (p_value.value > joy.last_axis[p_axis] - joy.filter) {
|
||||||
|
|
||||||
return p_last_id;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) {
|
if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) {
|
||||||
@ -860,20 +861,20 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co
|
|||||||
JoyAxis jx;
|
JoyAxis jx;
|
||||||
jx.min = p_value.min;
|
jx.min = p_value.min;
|
||||||
jx.value = p_value.value < 0 ? 0.1 : -0.1;
|
jx.value = p_value.value < 0 ? 0.1 : -0.1;
|
||||||
p_last_id = joy_axis(p_last_id, p_device, p_axis, jx);
|
joy_axis(p_device, p_axis, jx);
|
||||||
}
|
}
|
||||||
|
|
||||||
joy.last_axis[p_axis] = p_value.value;
|
joy.last_axis[p_axis] = p_value.value;
|
||||||
float val = p_value.min == 0 ? -1.0f + 2.0f * p_value.value : p_value.value;
|
float val = p_value.min == 0 ? -1.0f + 2.0f * p_value.value : p_value.value;
|
||||||
|
|
||||||
if (joy.mapping == -1) {
|
if (joy.mapping == -1) {
|
||||||
return _axis_event(p_last_id, p_device, p_axis, val);
|
_axis_event(p_device, p_axis, val);
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<int, JoyEvent>::Element *el = map_db[joy.mapping].axis.find(p_axis);
|
Map<int, JoyEvent>::Element *el = map_db[joy.mapping].axis.find(p_axis);
|
||||||
if (!el) {
|
if (!el) {
|
||||||
//return _axis_event(p_last_id, p_device, p_axis, p_value);
|
//return _axis_event(p_last_id, p_device, p_axis, p_value);
|
||||||
return p_last_id;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
JoyEvent map = el->get();
|
JoyEvent map = el->get();
|
||||||
@ -883,7 +884,7 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co
|
|||||||
if (map.index == JOY_L2 || map.index == JOY_R2) {
|
if (map.index == JOY_L2 || map.index == JOY_R2) {
|
||||||
float value = p_value.min == 0 ? p_value.value : 0.5f + p_value.value / 2.0f;
|
float value = p_value.min == 0 ? p_value.value : 0.5f + p_value.value / 2.0f;
|
||||||
int axis = map.index == JOY_L2 ? JOY_ANALOG_L2 : JOY_ANALOG_R2;
|
int axis = map.index == JOY_L2 ? JOY_ANALOG_L2 : JOY_ANALOG_R2;
|
||||||
p_last_id = _axis_event(p_last_id, p_device, axis, value);
|
_axis_event(p_device, axis, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map.index == JOY_DPAD_UP || map.index == JOY_DPAD_DOWN) {
|
if (map.index == JOY_DPAD_UP || map.index == JOY_DPAD_DOWN) {
|
||||||
@ -892,16 +893,17 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co
|
|||||||
|
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_UP, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_UP, p_device))) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_UP, false);
|
_button_event(p_device, JOY_DPAD_UP, false);
|
||||||
}
|
}
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_DOWN, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_DOWN, p_device))) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_DOWN, false);
|
_button_event(p_device, JOY_DPAD_DOWN, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
||||||
return p_last_id;
|
return;
|
||||||
}
|
}
|
||||||
return _button_event(p_last_id, p_device, button, true);
|
_button_event(p_device, button, true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (map.index == JOY_DPAD_LEFT || map.index == JOY_DPAD_RIGHT) {
|
if (map.index == JOY_DPAD_LEFT || map.index == JOY_DPAD_RIGHT) {
|
||||||
bool pressed = p_value.value != 0.0f;
|
bool pressed = p_value.value != 0.0f;
|
||||||
@ -909,35 +911,38 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co
|
|||||||
|
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_LEFT, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_LEFT, p_device))) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_LEFT, false);
|
_button_event(p_device, JOY_DPAD_LEFT, false);
|
||||||
}
|
}
|
||||||
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_RIGHT, p_device))) {
|
if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_RIGHT, p_device))) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_RIGHT, false);
|
_button_event(p_device, JOY_DPAD_RIGHT, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
if (pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) {
|
||||||
return p_last_id;
|
return;
|
||||||
}
|
}
|
||||||
return _button_event(p_last_id, p_device, button, true);
|
_button_event(p_device, button, true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
float deadzone = p_value.min == 0 ? 0.5f : 0.0f;
|
float deadzone = p_value.min == 0 ? 0.5f : 0.0f;
|
||||||
bool pressed = p_value.value > deadzone ? true : false;
|
bool pressed = p_value.value > deadzone ? true : false;
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
|
if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
|
||||||
// button already pressed or released, this is an axis bounce value
|
// button already pressed or released, this is an axis bounce value
|
||||||
return p_last_id;
|
return;
|
||||||
};
|
};
|
||||||
return _button_event(p_last_id, p_device, map.index, pressed);
|
_button_event(p_device, map.index, pressed);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (map.type == TYPE_AXIS) {
|
if (map.type == TYPE_AXIS) {
|
||||||
|
|
||||||
return _axis_event(p_last_id, p_device, map.index, val);
|
_axis_event(p_device, map.index, val);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
//printf("invalid mapping\n");
|
//printf("invalid mapping\n");
|
||||||
return p_last_id;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t InputDefault::joy_hat(uint32_t p_last_id, int p_device, int p_val) {
|
void InputDefault::joy_hat(int p_device, int p_val) {
|
||||||
|
|
||||||
_THREAD_SAFE_METHOD_;
|
_THREAD_SAFE_METHOD_;
|
||||||
const Joypad &joy = joy_names[p_device];
|
const Joypad &joy = joy_names[p_device];
|
||||||
@ -953,50 +958,42 @@ uint32_t InputDefault::joy_hat(uint32_t p_last_id, int p_device, int p_val) {
|
|||||||
int cur_val = joy_names[p_device].hat_current;
|
int cur_val = joy_names[p_device].hat_current;
|
||||||
|
|
||||||
if ((p_val & HAT_MASK_UP) != (cur_val & HAT_MASK_UP)) {
|
if ((p_val & HAT_MASK_UP) != (cur_val & HAT_MASK_UP)) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, map[HAT_UP].index, p_val & HAT_MASK_UP);
|
_button_event(p_device, map[HAT_UP].index, p_val & HAT_MASK_UP);
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((p_val & HAT_MASK_RIGHT) != (cur_val & HAT_MASK_RIGHT)) {
|
if ((p_val & HAT_MASK_RIGHT) != (cur_val & HAT_MASK_RIGHT)) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, map[HAT_RIGHT].index, p_val & HAT_MASK_RIGHT);
|
_button_event(p_device, map[HAT_RIGHT].index, p_val & HAT_MASK_RIGHT);
|
||||||
};
|
};
|
||||||
if ((p_val & HAT_MASK_DOWN) != (cur_val & HAT_MASK_DOWN)) {
|
if ((p_val & HAT_MASK_DOWN) != (cur_val & HAT_MASK_DOWN)) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, map[HAT_DOWN].index, p_val & HAT_MASK_DOWN);
|
_button_event(p_device, map[HAT_DOWN].index, p_val & HAT_MASK_DOWN);
|
||||||
};
|
};
|
||||||
if ((p_val & HAT_MASK_LEFT) != (cur_val & HAT_MASK_LEFT)) {
|
if ((p_val & HAT_MASK_LEFT) != (cur_val & HAT_MASK_LEFT)) {
|
||||||
p_last_id = _button_event(p_last_id, p_device, map[HAT_LEFT].index, p_val & HAT_MASK_LEFT);
|
_button_event(p_device, map[HAT_LEFT].index, p_val & HAT_MASK_LEFT);
|
||||||
};
|
};
|
||||||
|
|
||||||
joy_names[p_device].hat_current = p_val;
|
joy_names[p_device].hat_current = p_val;
|
||||||
|
|
||||||
return p_last_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t InputDefault::_button_event(uint32_t p_last_id, int p_device, int p_index, bool p_pressed) {
|
void InputDefault::_button_event(int p_device, int p_index, bool p_pressed) {
|
||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::JOYPAD_BUTTON;
|
ievent.type = InputEvent::JOYPAD_BUTTON;
|
||||||
ievent.device = p_device;
|
ievent.device = p_device;
|
||||||
ievent.ID = ++p_last_id;
|
|
||||||
ievent.joy_button.button_index = p_index;
|
ievent.joy_button.button_index = p_index;
|
||||||
ievent.joy_button.pressed = p_pressed;
|
ievent.joy_button.pressed = p_pressed;
|
||||||
|
|
||||||
parse_input_event(ievent);
|
parse_input_event(ievent);
|
||||||
|
|
||||||
return p_last_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t InputDefault::_axis_event(uint32_t p_last_id, int p_device, int p_axis, float p_value) {
|
void InputDefault::_axis_event(int p_device, int p_axis, float p_value) {
|
||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::JOYPAD_MOTION;
|
ievent.type = InputEvent::JOYPAD_MOTION;
|
||||||
ievent.device = p_device;
|
ievent.device = p_device;
|
||||||
ievent.ID = ++p_last_id;
|
|
||||||
ievent.joy_motion.axis = p_axis;
|
ievent.joy_motion.axis = p_axis;
|
||||||
ievent.joy_motion.axis_value = p_value;
|
ievent.joy_motion.axis_value = p_value;
|
||||||
|
|
||||||
parse_input_event(ievent);
|
parse_input_event(ievent);
|
||||||
|
|
||||||
return p_last_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
InputDefault::JoyEvent InputDefault::_find_to_event(String p_to) {
|
InputDefault::JoyEvent InputDefault::_find_to_event(String p_to) {
|
||||||
|
@ -169,8 +169,8 @@ private:
|
|||||||
Vector<JoyDeviceMapping> map_db;
|
Vector<JoyDeviceMapping> map_db;
|
||||||
|
|
||||||
JoyEvent _find_to_event(String p_to);
|
JoyEvent _find_to_event(String p_to);
|
||||||
uint32_t _button_event(uint32_t p_last_id, int p_device, int p_index, bool p_pressed);
|
void _button_event(int p_device, int p_index, bool p_pressed);
|
||||||
uint32_t _axis_event(uint32_t p_last_id, int p_device, int p_axis, float p_value);
|
void _axis_event(int p_device, int p_axis, float p_value);
|
||||||
float _handle_deadzone(int p_device, int p_axis, float p_value);
|
float _handle_deadzone(int p_device, int p_axis, float p_value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -228,9 +228,9 @@ public:
|
|||||||
virtual void set_mouse_in_window(bool p_in_window);
|
virtual void set_mouse_in_window(bool p_in_window);
|
||||||
|
|
||||||
void parse_mapping(String p_mapping);
|
void parse_mapping(String p_mapping);
|
||||||
uint32_t joy_button(uint32_t p_last_id, int p_device, int p_button, bool p_pressed);
|
void joy_button(int p_device, int p_button, bool p_pressed);
|
||||||
uint32_t joy_axis(uint32_t p_last_id, int p_device, int p_axis, const JoyAxis &p_value);
|
void joy_axis(int p_device, int p_axis, const JoyAxis &p_value);
|
||||||
uint32_t joy_hat(uint32_t p_last_id, int p_device, int p_val);
|
void joy_hat(int p_device, int p_val);
|
||||||
|
|
||||||
virtual void add_joy_mapping(String p_mapping, bool p_update_existing = false);
|
virtual void add_joy_mapping(String p_mapping, bool p_update_existing = false);
|
||||||
virtual void remove_joy_mapping(String p_guid);
|
virtual void remove_joy_mapping(String p_guid);
|
||||||
|
@ -129,7 +129,7 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||||||
RasterizerGLES3::make_current();
|
RasterizerGLES3::make_current();
|
||||||
|
|
||||||
visual_server = memnew(VisualServerRaster);
|
visual_server = memnew(VisualServerRaster);
|
||||||
/* if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
/* if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||||
|
|
||||||
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
||||||
};*/
|
};*/
|
||||||
@ -343,16 +343,16 @@ void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
|
|||||||
|
|
||||||
switch (p_event.type) {
|
switch (p_event.type) {
|
||||||
case JOY_EVENT_BUTTON:
|
case JOY_EVENT_BUTTON:
|
||||||
last_id = input->joy_button(last_id, p_event.device, p_event.index, p_event.pressed);
|
input->joy_button(p_event.device, p_event.index, p_event.pressed);
|
||||||
break;
|
break;
|
||||||
case JOY_EVENT_AXIS:
|
case JOY_EVENT_AXIS:
|
||||||
InputDefault::JoyAxis value;
|
InputDefault::JoyAxis value;
|
||||||
value.min = -1;
|
value.min = -1;
|
||||||
value.value = p_event.value;
|
value.value = p_event.value;
|
||||||
last_id = input->joy_axis(last_id, p_event.device, p_event.index, value);
|
input->joy_axis(p_event.device, p_event.index, value);
|
||||||
break;
|
break;
|
||||||
case JOY_EVENT_HAT:
|
case JOY_EVENT_HAT:
|
||||||
last_id = input->joy_hat(last_id, p_event.device, p_event.hat);
|
input->joy_hat(p_event.device, p_event.hat);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -361,7 +361,6 @@ void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
|
|||||||
|
|
||||||
void OS_Android::process_event(InputEvent p_event) {
|
void OS_Android::process_event(InputEvent p_event) {
|
||||||
|
|
||||||
p_event.ID = last_id++;
|
|
||||||
input->parse_input_event(p_event);
|
input->parse_input_event(p_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +375,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
//end all if exist
|
//end all if exist
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_button.button_index = BUTTON_LEFT;
|
ev.mouse_button.button_index = BUTTON_LEFT;
|
||||||
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_button.pressed = false;
|
ev.mouse_button.pressed = false;
|
||||||
@ -390,7 +388,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = false;
|
ev.screen_touch.pressed = false;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -409,7 +406,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
//send mouse
|
//send mouse
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_button.button_index = BUTTON_LEFT;
|
ev.mouse_button.button_index = BUTTON_LEFT;
|
||||||
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_button.pressed = true;
|
ev.mouse_button.pressed = true;
|
||||||
@ -417,7 +413,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
ev.mouse_button.y = touch[0].pos.y;
|
ev.mouse_button.y = touch[0].pos.y;
|
||||||
ev.mouse_button.global_x = touch[0].pos.x;
|
ev.mouse_button.global_x = touch[0].pos.x;
|
||||||
ev.mouse_button.global_y = touch[0].pos.y;
|
ev.mouse_button.global_y = touch[0].pos.y;
|
||||||
input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y));
|
input->set_mouse_pos(Point2(touch[0].pos.x, touch[0].pos.y));
|
||||||
last_mouse = touch[0].pos;
|
last_mouse = touch[0].pos;
|
||||||
input->parse_input_event(ev);
|
input->parse_input_event(ev);
|
||||||
}
|
}
|
||||||
@ -427,7 +423,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = true;
|
ev.screen_touch.pressed = true;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -442,7 +437,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
//send mouse, should look for point 0?
|
//send mouse, should look for point 0?
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_MOTION;
|
ev.type = InputEvent::MOUSE_MOTION;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_motion.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_motion.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_motion.x = p_points[0].pos.x;
|
ev.mouse_motion.x = p_points[0].pos.x;
|
||||||
ev.mouse_motion.y = p_points[0].pos.y;
|
ev.mouse_motion.y = p_points[0].pos.y;
|
||||||
@ -475,7 +469,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_DRAG;
|
ev.type = InputEvent::SCREEN_DRAG;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_drag.index = touch[i].id;
|
ev.screen_drag.index = touch[i].id;
|
||||||
ev.screen_drag.x = p_points[idx].pos.x;
|
ev.screen_drag.x = p_points[idx].pos.x;
|
||||||
ev.screen_drag.y = p_points[idx].pos.y;
|
ev.screen_drag.y = p_points[idx].pos.y;
|
||||||
@ -492,7 +485,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
//end all if exist
|
//end all if exist
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_button.button_index = BUTTON_LEFT;
|
ev.mouse_button.button_index = BUTTON_LEFT;
|
||||||
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_button.pressed = false;
|
ev.mouse_button.pressed = false;
|
||||||
@ -500,14 +492,13 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
ev.mouse_button.y = touch[0].pos.y;
|
ev.mouse_button.y = touch[0].pos.y;
|
||||||
ev.mouse_button.global_x = touch[0].pos.x;
|
ev.mouse_button.global_x = touch[0].pos.x;
|
||||||
ev.mouse_button.global_y = touch[0].pos.y;
|
ev.mouse_button.global_y = touch[0].pos.y;
|
||||||
input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y));
|
input->set_mouse_pos(Point2(touch[0].pos.x, touch[0].pos.y));
|
||||||
input->parse_input_event(ev);
|
input->parse_input_event(ev);
|
||||||
|
|
||||||
for (int i = 0; i < touch.size(); i++) {
|
for (int i = 0; i < touch.size(); i++) {
|
||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = false;
|
ev.screen_touch.pressed = false;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -527,7 +518,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = tp.id;
|
ev.screen_touch.index = tp.id;
|
||||||
ev.screen_touch.pressed = true;
|
ev.screen_touch.pressed = true;
|
||||||
ev.screen_touch.x = tp.pos.x;
|
ev.screen_touch.x = tp.pos.x;
|
||||||
@ -542,7 +532,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = false;
|
ev.screen_touch.pressed = false;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -627,8 +616,8 @@ void OS_Android::reload_gfx() {
|
|||||||
|
|
||||||
if (gfx_init_func)
|
if (gfx_init_func)
|
||||||
gfx_init_func(gfx_init_ud, use_gl2);
|
gfx_init_func(gfx_init_ud, use_gl2);
|
||||||
// if (rasterizer)
|
//if (rasterizer)
|
||||||
// rasterizer->reload_vram();
|
// rasterizer->reload_vram();
|
||||||
}
|
}
|
||||||
|
|
||||||
Error OS_Android::shell_open(String p_uri) {
|
Error OS_Android::shell_open(String p_uri) {
|
||||||
@ -746,9 +735,9 @@ void OS_Android::native_video_stop() {
|
|||||||
|
|
||||||
void OS_Android::set_context_is_16_bits(bool p_is_16) {
|
void OS_Android::set_context_is_16_bits(bool p_is_16) {
|
||||||
|
|
||||||
// use_16bits_fbo = p_is_16;
|
//use_16bits_fbo = p_is_16;
|
||||||
// if (rasterizer)
|
//if (rasterizer)
|
||||||
// rasterizer->set_force_16_bits_fbo(p_is_16);
|
// rasterizer->set_force_16_bits_fbo(p_is_16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_Android::joy_connection_changed(int p_device, bool p_connected, String p_name) {
|
void OS_Android::joy_connection_changed(int p_device, bool p_connected, String p_name) {
|
||||||
@ -774,9 +763,8 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
|
|||||||
gfx_init_func = p_gfx_init_func;
|
gfx_init_func = p_gfx_init_func;
|
||||||
gfx_init_ud = p_gfx_init_ud;
|
gfx_init_ud = p_gfx_init_ud;
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
last_id = 1;
|
|
||||||
gl_extensions = NULL;
|
gl_extensions = NULL;
|
||||||
// rasterizer = NULL;
|
//rasterizer = NULL;
|
||||||
use_gl2 = false;
|
use_gl2 = false;
|
||||||
|
|
||||||
open_uri_func = p_open_uri_func;
|
open_uri_func = p_open_uri_func;
|
||||||
|
@ -94,7 +94,6 @@ private:
|
|||||||
Vector<TouchPos> touch;
|
Vector<TouchPos> touch;
|
||||||
|
|
||||||
Point2 last_mouse;
|
Point2 last_mouse;
|
||||||
unsigned int last_id;
|
|
||||||
GFXInitFunc gfx_init_func;
|
GFXInitFunc gfx_init_func;
|
||||||
void *gfx_init_ud;
|
void *gfx_init_ud;
|
||||||
|
|
||||||
|
@ -282,7 +282,6 @@ void OSBB10::handle_screen_event(bps_event_t *event) {
|
|||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::SCREEN_TOUCH;
|
ievent.type = InputEvent::SCREEN_TOUCH;
|
||||||
ievent.ID = ++last_id;
|
|
||||||
ievent.device = 0;
|
ievent.device = 0;
|
||||||
ievent.screen_touch.pressed = (screen_val == SCREEN_EVENT_MTOUCH_TOUCH);
|
ievent.screen_touch.pressed = (screen_val == SCREEN_EVENT_MTOUCH_TOUCH);
|
||||||
ievent.screen_touch.x = pos[0];
|
ievent.screen_touch.x = pos[0];
|
||||||
@ -301,7 +300,6 @@ void OSBB10::handle_screen_event(bps_event_t *event) {
|
|||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::MOUSE_BUTTON;
|
ievent.type = InputEvent::MOUSE_BUTTON;
|
||||||
ievent.ID = ++last_id;
|
|
||||||
ievent.device = 0;
|
ievent.device = 0;
|
||||||
ievent.mouse_button.pressed = (screen_val == SCREEN_EVENT_MTOUCH_TOUCH);
|
ievent.mouse_button.pressed = (screen_val == SCREEN_EVENT_MTOUCH_TOUCH);
|
||||||
ievent.mouse_button.button_index = BUTTON_LEFT;
|
ievent.mouse_button.button_index = BUTTON_LEFT;
|
||||||
@ -318,7 +316,6 @@ void OSBB10::handle_screen_event(bps_event_t *event) {
|
|||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::SCREEN_DRAG;
|
ievent.type = InputEvent::SCREEN_DRAG;
|
||||||
ievent.ID = ++last_id;
|
|
||||||
ievent.device = 0;
|
ievent.device = 0;
|
||||||
ievent.screen_drag.x = pos[0];
|
ievent.screen_drag.x = pos[0];
|
||||||
ievent.screen_drag.y = pos[1];
|
ievent.screen_drag.y = pos[1];
|
||||||
@ -347,7 +344,6 @@ void OSBB10::handle_screen_event(bps_event_t *event) {
|
|||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::MOUSE_MOTION;
|
ievent.type = InputEvent::MOUSE_MOTION;
|
||||||
ievent.ID = ++last_id;
|
|
||||||
ievent.device = 0;
|
ievent.device = 0;
|
||||||
ievent.mouse_motion.x = ievent.mouse_motion.global_x = mpos.x;
|
ievent.mouse_motion.x = ievent.mouse_motion.global_x = mpos.x;
|
||||||
ievent.mouse_motion.y = ievent.mouse_motion.global_y = mpos.y;
|
ievent.mouse_motion.y = ievent.mouse_motion.global_y = mpos.y;
|
||||||
@ -366,7 +362,6 @@ void OSBB10::handle_screen_event(bps_event_t *event) {
|
|||||||
|
|
||||||
InputEvent ievent;
|
InputEvent ievent;
|
||||||
ievent.type = InputEvent::KEY;
|
ievent.type = InputEvent::KEY;
|
||||||
ievent.ID = ++last_id;
|
|
||||||
ievent.device = 0;
|
ievent.device = 0;
|
||||||
int val = 0;
|
int val = 0;
|
||||||
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SCAN, &val);
|
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SCAN, &val);
|
||||||
@ -595,7 +590,6 @@ int OSBB10::get_power_percent_left() {
|
|||||||
OSBB10::OSBB10() {
|
OSBB10::OSBB10() {
|
||||||
|
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
last_id = 1;
|
|
||||||
minimized = false;
|
minimized = false;
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
flip_accelerometer = true;
|
flip_accelerometer = true;
|
||||||
|
@ -48,8 +48,6 @@
|
|||||||
|
|
||||||
class OSBB10 : public OS_Unix {
|
class OSBB10 : public OS_Unix {
|
||||||
|
|
||||||
unsigned int last_id;
|
|
||||||
|
|
||||||
screen_context_t screen_cxt;
|
screen_context_t screen_cxt;
|
||||||
float fullscreen_mixer_volume;
|
float fullscreen_mixer_volume;
|
||||||
float fullscreen_stream_volume;
|
float fullscreen_stream_volume;
|
||||||
|
@ -151,7 +151,6 @@ void HaikuDirectWindow::HandleMouseButton(BMessage *message) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
InputEvent mouse_event;
|
InputEvent mouse_event;
|
||||||
mouse_event.ID = ++event_id;
|
|
||||||
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||||
mouse_event.device = 0;
|
mouse_event.device = 0;
|
||||||
|
|
||||||
@ -208,7 +207,6 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage *message) {
|
|||||||
Point2i rel = pos - last_mouse_position;
|
Point2i rel = pos - last_mouse_position;
|
||||||
|
|
||||||
InputEvent motion_event;
|
InputEvent motion_event;
|
||||||
motion_event.ID = ++event_id;
|
|
||||||
motion_event.type = InputEvent::MOUSE_MOTION;
|
motion_event.type = InputEvent::MOUSE_MOTION;
|
||||||
motion_event.device = 0;
|
motion_event.device = 0;
|
||||||
|
|
||||||
@ -237,7 +235,6 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputEvent mouse_event;
|
InputEvent mouse_event;
|
||||||
mouse_event.ID = ++event_id;
|
|
||||||
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||||
mouse_event.device = 0;
|
mouse_event.device = 0;
|
||||||
|
|
||||||
@ -252,7 +249,6 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
|
|||||||
mouse_event.mouse_button.pressed = true;
|
mouse_event.mouse_button.pressed = true;
|
||||||
input->parse_input_event(mouse_event);
|
input->parse_input_event(mouse_event);
|
||||||
|
|
||||||
mouse_event.ID = ++event_id;
|
|
||||||
mouse_event.mouse_button.pressed = false;
|
mouse_event.mouse_button.pressed = false;
|
||||||
input->parse_input_event(mouse_event);
|
input->parse_input_event(mouse_event);
|
||||||
}
|
}
|
||||||
@ -275,7 +271,6 @@ void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.ID = ++event_id;
|
|
||||||
event.type = InputEvent::KEY;
|
event.type = InputEvent::KEY;
|
||||||
event.device = 0;
|
event.device = 0;
|
||||||
event.key.mod = GetKeyModifierState(modifiers);
|
event.key.mod = GetKeyModifierState(modifiers);
|
||||||
@ -313,7 +308,6 @@ void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage *message) {
|
|||||||
int32 key = old_modifiers ^ modifiers;
|
int32 key = old_modifiers ^ modifiers;
|
||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.ID = ++event_id;
|
|
||||||
event.type = InputEvent::KEY;
|
event.type = InputEvent::KEY;
|
||||||
event.device = 0;
|
event.device = 0;
|
||||||
event.key.mod = GetKeyModifierState(modifiers);
|
event.key.mod = GetKeyModifierState(modifiers);
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
class HaikuDirectWindow : public BDirectWindow {
|
class HaikuDirectWindow : public BDirectWindow {
|
||||||
private:
|
private:
|
||||||
unsigned int event_id;
|
|
||||||
Point2i last_mouse_position;
|
Point2i last_mouse_position;
|
||||||
bool last_mouse_pos_valid;
|
bool last_mouse_pos_valid;
|
||||||
uint32 last_buttons_state;
|
uint32 last_buttons_state;
|
||||||
|
@ -196,7 +196,6 @@ void OSIPhone::key(uint32_t p_key, bool p_pressed) {
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::KEY;
|
ev.type = InputEvent::KEY;
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
ev.key.echo = false;
|
ev.key.echo = false;
|
||||||
ev.key.pressed = p_pressed;
|
ev.key.pressed = p_pressed;
|
||||||
ev.key.scancode = p_key;
|
ev.key.scancode = p_key;
|
||||||
@ -209,7 +208,6 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
|
|||||||
if (!GLOBAL_DEF("debug/disable_touch", false)) {
|
if (!GLOBAL_DEF("debug/disable_touch", false)) {
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
ev.screen_touch.index = p_idx;
|
ev.screen_touch.index = p_idx;
|
||||||
ev.screen_touch.pressed = p_pressed;
|
ev.screen_touch.pressed = p_pressed;
|
||||||
ev.screen_touch.x = p_x;
|
ev.screen_touch.x = p_x;
|
||||||
@ -225,7 +223,6 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
|
|||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.device = 0;
|
ev.device = 0;
|
||||||
ev.mouse_button.pointer_index = p_idx;
|
ev.mouse_button.pointer_index = p_idx;
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
|
|
||||||
// swaped it for tilted screen
|
// swaped it for tilted screen
|
||||||
//ev.mouse_button.x = ev.mouse_button.global_x = video_mode.height - p_y;
|
//ev.mouse_button.x = ev.mouse_button.global_x = video_mode.height - p_y;
|
||||||
@ -250,7 +247,6 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_DRAG;
|
ev.type = InputEvent::SCREEN_DRAG;
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
ev.screen_drag.index = p_idx;
|
ev.screen_drag.index = p_idx;
|
||||||
ev.screen_drag.x = p_x;
|
ev.screen_drag.x = p_x;
|
||||||
ev.screen_drag.y = p_y;
|
ev.screen_drag.y = p_y;
|
||||||
@ -264,7 +260,6 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
|
|||||||
ev.type = InputEvent::MOUSE_MOTION;
|
ev.type = InputEvent::MOUSE_MOTION;
|
||||||
ev.device = 0;
|
ev.device = 0;
|
||||||
ev.mouse_motion.pointer_index = p_idx;
|
ev.mouse_motion.pointer_index = p_idx;
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
|
|
||||||
if (true) { // vertical
|
if (true) { // vertical
|
||||||
|
|
||||||
@ -327,7 +322,6 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
|
|||||||
ev.device = 0;
|
ev.device = 0;
|
||||||
ev.joy_motion.axis = JOY_ANALOG_0;
|
ev.joy_motion.axis = JOY_ANALOG_0;
|
||||||
ev.joy_motion.axis_value = (p_x / (float)ACCEL_RANGE);
|
ev.joy_motion.axis_value = (p_x / (float)ACCEL_RANGE);
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
last_accel.x = p_x;
|
last_accel.x = p_x;
|
||||||
queue_event(ev);
|
queue_event(ev);
|
||||||
};
|
};
|
||||||
@ -338,7 +332,6 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
|
|||||||
ev.device = 0;
|
ev.device = 0;
|
||||||
ev.joy_motion.axis = JOY_ANALOG_1;
|
ev.joy_motion.axis = JOY_ANALOG_1;
|
||||||
ev.joy_motion.axis_value = (p_y / (float)ACCEL_RANGE);
|
ev.joy_motion.axis_value = (p_y / (float)ACCEL_RANGE);
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
last_accel.y = p_y;
|
last_accel.y = p_y;
|
||||||
queue_event(ev);
|
queue_event(ev);
|
||||||
};
|
};
|
||||||
@ -349,7 +342,6 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
|
|||||||
ev.device = 0;
|
ev.device = 0;
|
||||||
ev.joy_motion.axis = JOY_ANALOG_2;
|
ev.joy_motion.axis = JOY_ANALOG_2;
|
||||||
ev.joy_motion.axis_value = ( (1.0 - p_z) / (float)ACCEL_RANGE);
|
ev.joy_motion.axis_value = ( (1.0 - p_z) / (float)ACCEL_RANGE);
|
||||||
ev.ID = ++last_event_id;
|
|
||||||
last_accel.z = p_z;
|
last_accel.z = p_z;
|
||||||
queue_event(ev);
|
queue_event(ev);
|
||||||
};
|
};
|
||||||
@ -566,7 +558,6 @@ OSIPhone::OSIPhone(int width, int height) {
|
|||||||
vm.resizable = false;
|
vm.resizable = false;
|
||||||
set_video_mode(vm);
|
set_video_mode(vm);
|
||||||
event_count = 0;
|
event_count = 0;
|
||||||
last_event_id = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
OSIPhone::~OSIPhone() {
|
OSIPhone::~OSIPhone() {
|
||||||
|
@ -119,7 +119,6 @@ private:
|
|||||||
|
|
||||||
InputEvent event_queue[MAX_EVENTS];
|
InputEvent event_queue[MAX_EVENTS];
|
||||||
int event_count;
|
int event_count;
|
||||||
int last_event_id;
|
|
||||||
void queue_event(const InputEvent &p_event);
|
void queue_event(const InputEvent &p_event);
|
||||||
|
|
||||||
String data_dir;
|
String data_dir;
|
||||||
|
@ -520,7 +520,6 @@ void OS_JavaScript::main_loop_focusin() {
|
|||||||
void OS_JavaScript::push_input(const InputEvent &p_ev) {
|
void OS_JavaScript::push_input(const InputEvent &p_ev) {
|
||||||
|
|
||||||
InputEvent ev = p_ev;
|
InputEvent ev = p_ev;
|
||||||
ev.ID = last_id++;
|
|
||||||
if (ev.type == InputEvent::MOUSE_MOTION) {
|
if (ev.type == InputEvent::MOUSE_MOTION) {
|
||||||
input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
|
input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
|
||||||
} else if (ev.type == InputEvent::MOUSE_BUTTON) {
|
} else if (ev.type == InputEvent::MOUSE_BUTTON) {
|
||||||
@ -540,7 +539,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
//end all if exist
|
//end all if exist
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_button.button_index = BUTTON_LEFT;
|
ev.mouse_button.button_index = BUTTON_LEFT;
|
||||||
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_button.pressed = false;
|
ev.mouse_button.pressed = false;
|
||||||
@ -554,7 +552,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = false;
|
ev.screen_touch.pressed = false;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -573,7 +570,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
//send mouse
|
//send mouse
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_button.button_index = BUTTON_LEFT;
|
ev.mouse_button.button_index = BUTTON_LEFT;
|
||||||
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_button.pressed = true;
|
ev.mouse_button.pressed = true;
|
||||||
@ -590,7 +586,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = true;
|
ev.screen_touch.pressed = true;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -605,7 +600,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
//send mouse, should look for point 0?
|
//send mouse, should look for point 0?
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_MOTION;
|
ev.type = InputEvent::MOUSE_MOTION;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_motion.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_motion.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_motion.x = p_points[0].pos.x;
|
ev.mouse_motion.x = p_points[0].pos.x;
|
||||||
ev.mouse_motion.y = p_points[0].pos.y;
|
ev.mouse_motion.y = p_points[0].pos.y;
|
||||||
@ -638,7 +632,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_DRAG;
|
ev.type = InputEvent::SCREEN_DRAG;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_drag.index = touch[i].id;
|
ev.screen_drag.index = touch[i].id;
|
||||||
ev.screen_drag.x = p_points[idx].pos.x;
|
ev.screen_drag.x = p_points[idx].pos.x;
|
||||||
ev.screen_drag.y = p_points[idx].pos.y;
|
ev.screen_drag.y = p_points[idx].pos.y;
|
||||||
@ -655,7 +648,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
//end all if exist
|
//end all if exist
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::MOUSE_BUTTON;
|
ev.type = InputEvent::MOUSE_BUTTON;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.mouse_button.button_index = BUTTON_LEFT;
|
ev.mouse_button.button_index = BUTTON_LEFT;
|
||||||
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
|
||||||
ev.mouse_button.pressed = false;
|
ev.mouse_button.pressed = false;
|
||||||
@ -669,7 +661,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = false;
|
ev.screen_touch.pressed = false;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -689,7 +680,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = tp.id;
|
ev.screen_touch.index = tp.id;
|
||||||
ev.screen_touch.pressed = true;
|
ev.screen_touch.pressed = true;
|
||||||
ev.screen_touch.x = tp.pos.x;
|
ev.screen_touch.x = tp.pos.x;
|
||||||
@ -704,7 +694,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
|
|||||||
|
|
||||||
InputEvent ev;
|
InputEvent ev;
|
||||||
ev.type = InputEvent::SCREEN_TOUCH;
|
ev.type = InputEvent::SCREEN_TOUCH;
|
||||||
ev.ID = last_id++;
|
|
||||||
ev.screen_touch.index = touch[i].id;
|
ev.screen_touch.index = touch[i].id;
|
||||||
ev.screen_touch.pressed = false;
|
ev.screen_touch.pressed = false;
|
||||||
ev.screen_touch.x = touch[i].pos.x;
|
ev.screen_touch.x = touch[i].pos.x;
|
||||||
@ -790,9 +779,9 @@ void OS_JavaScript::process_joypads() {
|
|||||||
InputDefault::JoyAxis jx;
|
InputDefault::JoyAxis jx;
|
||||||
jx.min = 0;
|
jx.min = 0;
|
||||||
jx.value = value;
|
jx.value = value;
|
||||||
last_id = input->joy_axis(last_id, i, j, jx);
|
input->joy_axis(i, j, jx);
|
||||||
} else {
|
} else {
|
||||||
last_id = input->joy_button(last_id, i, j, value);
|
input->joy_button(i, j, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int j = 0; j < num_axes; j++) {
|
for (int j = 0; j < num_axes; j++) {
|
||||||
@ -800,7 +789,7 @@ void OS_JavaScript::process_joypads() {
|
|||||||
InputDefault::JoyAxis jx;
|
InputDefault::JoyAxis jx;
|
||||||
jx.min = -1;
|
jx.min = -1;
|
||||||
jx.value = state.axis[j];
|
jx.value = state.axis[j];
|
||||||
last_id = input->joy_axis(last_id, i, j, jx);
|
input->joy_axis(i, j, jx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -844,7 +833,6 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, G
|
|||||||
gfx_init_ud = p_gfx_init_ud;
|
gfx_init_ud = p_gfx_init_ud;
|
||||||
last_button_mask = 0;
|
last_button_mask = 0;
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
last_id = 1;
|
|
||||||
gl_extensions = NULL;
|
gl_extensions = NULL;
|
||||||
window_maximized = false;
|
window_maximized = false;
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ private:
|
|||||||
Vector<TouchPos> touch;
|
Vector<TouchPos> touch;
|
||||||
Point2 last_mouse;
|
Point2 last_mouse;
|
||||||
int last_button_mask;
|
int last_button_mask;
|
||||||
unsigned int last_id;
|
|
||||||
GFXInitFunc gfx_init_func;
|
GFXInitFunc gfx_init_func;
|
||||||
void *gfx_init_ud;
|
void *gfx_init_ud;
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma
|
|||||||
return jx;
|
return jx;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) {
|
void JoypadOSX::process_joypads() {
|
||||||
poll_joypads();
|
poll_joypads();
|
||||||
|
|
||||||
for (int i = 0; i < device_list.size(); i++) {
|
for (int i = 0; i < device_list.size(); i++) {
|
||||||
@ -467,17 +467,17 @@ uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) {
|
|||||||
for (int j = 0; j < joy.axis_elements.size(); j++) {
|
for (int j = 0; j < joy.axis_elements.size(); j++) {
|
||||||
rec_element &elem = joy.axis_elements[j];
|
rec_element &elem = joy.axis_elements[j];
|
||||||
int value = joy.get_hid_element_state(&elem);
|
int value = joy.get_hid_element_state(&elem);
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, j, axis_correct(value, elem.min, elem.max));
|
input->joy_axis(joy.id, j, axis_correct(value, elem.min, elem.max));
|
||||||
}
|
}
|
||||||
for (int j = 0; j < joy.button_elements.size(); j++) {
|
for (int j = 0; j < joy.button_elements.size(); j++) {
|
||||||
int value = joy.get_hid_element_state(&joy.button_elements[j]);
|
int value = joy.get_hid_element_state(&joy.button_elements[j]);
|
||||||
p_last_id = input->joy_button(p_last_id, joy.id, j, (value >= 1));
|
input->joy_button(joy.id, j, (value >= 1));
|
||||||
}
|
}
|
||||||
for (int j = 0; j < joy.hat_elements.size(); j++) {
|
for (int j = 0; j < joy.hat_elements.size(); j++) {
|
||||||
rec_element &elem = joy.hat_elements[j];
|
rec_element &elem = joy.hat_elements[j];
|
||||||
int value = joy.get_hid_element_state(&elem);
|
int value = joy.get_hid_element_state(&elem);
|
||||||
int hat_value = process_hat_value(elem.min, elem.max, value);
|
int hat_value = process_hat_value(elem.min, elem.max, value);
|
||||||
p_last_id = input->joy_hat(p_last_id, joy.id, hat_value);
|
input->joy_hat(joy.id, hat_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joy.ffservice) {
|
if (joy.ffservice) {
|
||||||
@ -494,7 +494,6 @@ uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p_last_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
|
void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
|
||||||
|
@ -110,7 +110,7 @@ private:
|
|||||||
void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
|
void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint32_t process_joypads(uint32_t p_last_id);
|
void process_joypads();
|
||||||
|
|
||||||
void _device_added(IOReturn p_res, IOHIDDeviceRef p_device);
|
void _device_added(IOReturn p_res, IOHIDDeviceRef p_device);
|
||||||
void _device_removed(int p_id);
|
void _device_removed(int p_id);
|
||||||
|
@ -61,7 +61,6 @@ public:
|
|||||||
|
|
||||||
List<String> args;
|
List<String> args;
|
||||||
MainLoop *main_loop;
|
MainLoop *main_loop;
|
||||||
unsigned int event_id;
|
|
||||||
|
|
||||||
PhysicsServer *physics_server;
|
PhysicsServer *physics_server;
|
||||||
Physics2DServer *physics_2d_server;
|
Physics2DServer *physics_2d_server;
|
||||||
@ -83,7 +82,6 @@ public:
|
|||||||
// pthread_key_t current;
|
// pthread_key_t current;
|
||||||
bool mouse_grab;
|
bool mouse_grab;
|
||||||
Point2 mouse_pos;
|
Point2 mouse_pos;
|
||||||
uint32_t last_id;
|
|
||||||
|
|
||||||
id delegate;
|
id delegate;
|
||||||
id window_delegate;
|
id window_delegate;
|
||||||
|
@ -1698,7 +1698,6 @@ void OS_OSX::process_events() {
|
|||||||
void OS_OSX::push_input(const InputEvent& p_event) {
|
void OS_OSX::push_input(const InputEvent& p_event) {
|
||||||
|
|
||||||
InputEvent ev=p_event;
|
InputEvent ev=p_event;
|
||||||
ev.ID=last_id++;
|
|
||||||
//print_line("EV: "+String(ev));
|
//print_line("EV: "+String(ev));
|
||||||
input->parse_input_event(ev);
|
input->parse_input_event(ev);
|
||||||
}
|
}
|
||||||
@ -1725,7 +1724,7 @@ void OS_OSX::run() {
|
|||||||
while (!force_quit) {
|
while (!force_quit) {
|
||||||
|
|
||||||
process_events(); // get rid of pending events
|
process_events(); // get rid of pending events
|
||||||
last_id = joypad_osx->process_joypads(last_id);
|
joypad_osx->process_joypads();
|
||||||
if (Main::iteration()==true)
|
if (Main::iteration()==true)
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
@ -1822,7 +1821,6 @@ OS_OSX::OS_OSX() {
|
|||||||
[NSApp setDelegate:delegate];
|
[NSApp setDelegate:delegate];
|
||||||
|
|
||||||
|
|
||||||
last_id=1;
|
|
||||||
cursor_shape=CURSOR_ARROW;
|
cursor_shape=CURSOR_ARROW;
|
||||||
|
|
||||||
current_screen = 0;
|
current_screen = 0;
|
||||||
|
@ -40,7 +40,7 @@ void JoypadUWP::register_events() {
|
|||||||
ref new EventHandler<Gamepad ^>(this, &JoypadUWP::OnGamepadRemoved);
|
ref new EventHandler<Gamepad ^>(this, &JoypadUWP::OnGamepadRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) {
|
void JoypadUWP::process_controllers() {
|
||||||
|
|
||||||
for (int i = 0; i < MAX_CONTROLLERS; i++) {
|
for (int i = 0; i < MAX_CONTROLLERS; i++) {
|
||||||
|
|
||||||
@ -55,23 +55,21 @@ uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) {
|
|||||||
int button_mask = (int)GamepadButtons::Menu;
|
int button_mask = (int)GamepadButtons::Menu;
|
||||||
for (int j = 0; j < 14; j++) {
|
for (int j = 0; j < 14; j++) {
|
||||||
|
|
||||||
p_last_id = input->joy_button(p_last_id, controllers[i].id, j, (int)reading.Buttons & button_mask);
|
input->joy_button(controllers[i].id, j, (int)reading.Buttons & button_mask);
|
||||||
button_mask *= 2;
|
button_mask *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX));
|
input->joy_axis(controllers[i].id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX));
|
||||||
p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true));
|
input->joy_axis(controllers[i].id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX));
|
input->joy_axis(controllers[i].id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX));
|
||||||
p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true));
|
input->joy_axis(controllers[i].id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true));
|
input->joy_axis(controllers[i].id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true));
|
input->joy_axis(controllers[i].id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p_last_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JoypadUWP::JoypadUWP() {
|
JoypadUWP::JoypadUWP() {
|
||||||
|
@ -37,7 +37,7 @@ ref class JoypadUWP sealed {
|
|||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
internal:
|
internal:
|
||||||
void register_events();
|
void register_events();
|
||||||
uint32_t process_controllers(uint32_t p_last_id);
|
void process_controllers();
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
JoypadUWP();
|
JoypadUWP();
|
||||||
|
@ -344,15 +344,12 @@ String OSUWP::get_clipboard() const {
|
|||||||
|
|
||||||
void OSUWP::input_event(InputEvent &p_event) {
|
void OSUWP::input_event(InputEvent &p_event) {
|
||||||
|
|
||||||
p_event.ID = ++last_id;
|
|
||||||
|
|
||||||
input->parse_input_event(p_event);
|
input->parse_input_event(p_event);
|
||||||
|
|
||||||
if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index > 3) {
|
if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index > 3) {
|
||||||
|
|
||||||
//send release for mouse wheel
|
//send release for mouse wheel
|
||||||
p_event.mouse_button.pressed = false;
|
p_event.mouse_button.pressed = false;
|
||||||
p_event.ID = ++last_id;
|
|
||||||
input->parse_input_event(p_event);
|
input->parse_input_event(p_event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -680,7 +677,7 @@ uint64_t OSUWP::get_ticks_usec() const {
|
|||||||
|
|
||||||
void OSUWP::process_events() {
|
void OSUWP::process_events() {
|
||||||
|
|
||||||
last_id = joypad->process_controllers(last_id);
|
joypad->process_controllers();
|
||||||
process_key_events();
|
process_key_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,7 +904,6 @@ OSUWP::OSUWP() {
|
|||||||
|
|
||||||
pressrc = 0;
|
pressrc = 0;
|
||||||
old_invalid = true;
|
old_invalid = true;
|
||||||
last_id = 0;
|
|
||||||
mouse_mode = MOUSE_MODE_VISIBLE;
|
mouse_mode = MOUSE_MODE_VISIBLE;
|
||||||
#ifdef STDOUT_FILE
|
#ifdef STDOUT_FILE
|
||||||
stdo = fopen("stdout.txt", "wb");
|
stdo = fopen("stdout.txt", "wb");
|
||||||
|
@ -92,7 +92,6 @@ private:
|
|||||||
bool outside;
|
bool outside;
|
||||||
int old_x, old_y;
|
int old_x, old_y;
|
||||||
Point2i center;
|
Point2i center;
|
||||||
unsigned int last_id;
|
|
||||||
VisualServer *visual_server;
|
VisualServer *visual_server;
|
||||||
Rasterizer *rasterizer;
|
Rasterizer *rasterizer;
|
||||||
PhysicsServer *physics_server;
|
PhysicsServer *physics_server;
|
||||||
|
@ -319,7 +319,7 @@ void JoypadWindows::probe_joypads() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
|
void JoypadWindows::process_joypads() {
|
||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@ -337,16 +337,16 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
|
|||||||
int button_mask = XINPUT_GAMEPAD_DPAD_UP;
|
int button_mask = XINPUT_GAMEPAD_DPAD_UP;
|
||||||
for (int i = 0; i <= 16; i++) {
|
for (int i = 0; i <= 16; i++) {
|
||||||
|
|
||||||
p_last_id = input->joy_button(p_last_id, joy.id, i, joy.state.Gamepad.wButtons & button_mask);
|
input->joy_button(joy.id, i, joy.state.Gamepad.wButtons & button_mask);
|
||||||
button_mask = button_mask * 2;
|
button_mask = button_mask * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_0, axis_correct(joy.state.Gamepad.sThumbLX, true));
|
input->joy_axis(joy.id, JOY_AXIS_0, axis_correct(joy.state.Gamepad.sThumbLX, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_1, axis_correct(joy.state.Gamepad.sThumbLY, true, false, true));
|
input->joy_axis(joy.id, JOY_AXIS_1, axis_correct(joy.state.Gamepad.sThumbLY, true, false, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_2, axis_correct(joy.state.Gamepad.sThumbRX, true));
|
input->joy_axis(joy.id, JOY_AXIS_2, axis_correct(joy.state.Gamepad.sThumbRX, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_3, axis_correct(joy.state.Gamepad.sThumbRY, true, false, true));
|
input->joy_axis(joy.id, JOY_AXIS_3, axis_correct(joy.state.Gamepad.sThumbRY, true, false, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_4, axis_correct(joy.state.Gamepad.bLeftTrigger, true, true));
|
input->joy_axis(joy.id, JOY_AXIS_4, axis_correct(joy.state.Gamepad.bLeftTrigger, true, true));
|
||||||
p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_5, axis_correct(joy.state.Gamepad.bRightTrigger, true, true));
|
input->joy_axis(joy.id, JOY_AXIS_5, axis_correct(joy.state.Gamepad.bRightTrigger, true, true));
|
||||||
joy.last_packet = joy.state.dwPacketNumber;
|
joy.last_packet = joy.state.dwPacketNumber;
|
||||||
}
|
}
|
||||||
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
|
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
|
||||||
@ -384,7 +384,7 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_last_id = post_hat(p_last_id, joy->id, js.rgdwPOV[0]);
|
post_hat(joy->id, js.rgdwPOV[0]);
|
||||||
|
|
||||||
for (int j = 0; j < 128; j++) {
|
for (int j = 0; j < 128; j++) {
|
||||||
|
|
||||||
@ -392,14 +392,14 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
|
|||||||
|
|
||||||
if (!joy->last_buttons[j]) {
|
if (!joy->last_buttons[j]) {
|
||||||
|
|
||||||
p_last_id = input->joy_button(p_last_id, joy->id, j, true);
|
input->joy_button(joy->id, j, true);
|
||||||
joy->last_buttons[j] = true;
|
joy->last_buttons[j] = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (joy->last_buttons[j]) {
|
if (joy->last_buttons[j]) {
|
||||||
|
|
||||||
p_last_id = input->joy_button(p_last_id, joy->id, j, false);
|
input->joy_button(joy->id, j, false);
|
||||||
joy->last_buttons[j] = false;
|
joy->last_buttons[j] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -414,16 +414,16 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
|
|||||||
|
|
||||||
for (int k = 0; k < count; k++) {
|
for (int k = 0; k < count; k++) {
|
||||||
if (joy->joy_axis[j] == axes[k]) {
|
if (joy->joy_axis[j] == axes[k]) {
|
||||||
p_last_id = input->joy_axis(p_last_id, joy->id, j, axis_correct(values[k]));
|
input->joy_axis(joy->id, j, axis_correct(values[k]));
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return p_last_id;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int JoypadWindows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
|
void JoypadWindows::post_hat(int p_device, DWORD p_dpad) {
|
||||||
|
|
||||||
int dpad_val = 0;
|
int dpad_val = 0;
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ unsigned int JoypadWindows::post_hat(unsigned int p_last_id, int p_device, DWORD
|
|||||||
|
|
||||||
dpad_val = (InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_UP);
|
dpad_val = (InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_UP);
|
||||||
}
|
}
|
||||||
return input->joy_hat(p_last_id, p_device, dpad_val);
|
input->joy_hat(p_device, dpad_val);
|
||||||
};
|
};
|
||||||
|
|
||||||
InputDefault::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
|
InputDefault::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
~JoypadWindows();
|
~JoypadWindows();
|
||||||
|
|
||||||
void probe_joypads();
|
void probe_joypads();
|
||||||
unsigned int process_joypads(unsigned int p_last_id);
|
void process_joypads();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
@ -130,7 +130,7 @@ private:
|
|||||||
void load_xinput();
|
void load_xinput();
|
||||||
void unload_xinput();
|
void unload_xinput();
|
||||||
|
|
||||||
unsigned int post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad);
|
void post_hat(int p_device, DWORD p_dpad);
|
||||||
|
|
||||||
bool have_device(const GUID &p_guid);
|
bool have_device(const GUID &p_guid);
|
||||||
bool is_xinput_device(const GUID *p_guid);
|
bool is_xinput_device(const GUID *p_guid);
|
||||||
|
@ -216,7 +216,6 @@ void OS_Windows::_touch_event(bool p_pressed, int p_x, int p_y, int idx) {
|
|||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.type = InputEvent::SCREEN_TOUCH;
|
event.type = InputEvent::SCREEN_TOUCH;
|
||||||
event.ID = ++last_id;
|
|
||||||
event.screen_touch.index = idx;
|
event.screen_touch.index = idx;
|
||||||
|
|
||||||
event.screen_touch.pressed = p_pressed;
|
event.screen_touch.pressed = p_pressed;
|
||||||
@ -233,7 +232,6 @@ void OS_Windows::_drag_event(int p_x, int p_y, int idx) {
|
|||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.type = InputEvent::SCREEN_DRAG;
|
event.type = InputEvent::SCREEN_DRAG;
|
||||||
event.ID = ++last_id;
|
|
||||||
event.screen_drag.index = idx;
|
event.screen_drag.index = idx;
|
||||||
|
|
||||||
event.screen_drag.x = p_x;
|
event.screen_drag.x = p_x;
|
||||||
@ -370,7 +368,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.type = InputEvent::MOUSE_MOTION;
|
event.type = InputEvent::MOUSE_MOTION;
|
||||||
event.ID = ++last_id;
|
|
||||||
InputEventMouseMotion &mm = event.mouse_motion;
|
InputEventMouseMotion &mm = event.mouse_motion;
|
||||||
|
|
||||||
mm.mod.control = (wParam & MK_CONTROL) != 0;
|
mm.mod.control = (wParam & MK_CONTROL) != 0;
|
||||||
@ -451,7 +448,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.type = InputEvent::MOUSE_BUTTON;
|
event.type = InputEvent::MOUSE_BUTTON;
|
||||||
event.ID = ++last_id;
|
|
||||||
InputEventMouseButton &mb = event.mouse_button;
|
InputEventMouseButton &mb = event.mouse_button;
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
@ -582,7 +578,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (mb.pressed && mb.button_index > 3) {
|
if (mb.pressed && mb.button_index > 3) {
|
||||||
//send release for mouse wheel
|
//send release for mouse wheel
|
||||||
mb.pressed = false;
|
mb.pressed = false;
|
||||||
event.ID = ++last_id;
|
|
||||||
input->parse_input_event(event);
|
input->parse_input_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -780,7 +775,6 @@ void OS_Windows::process_key_events() {
|
|||||||
if ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR)) {
|
if ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR)) {
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.type = InputEvent::KEY;
|
event.type = InputEvent::KEY;
|
||||||
event.ID = ++last_id;
|
|
||||||
InputEventKey &k = event.key;
|
InputEventKey &k = event.key;
|
||||||
|
|
||||||
k.mod = ke.mod_state;
|
k.mod = ke.mod_state;
|
||||||
@ -805,7 +799,6 @@ void OS_Windows::process_key_events() {
|
|||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.type = InputEvent::KEY;
|
event.type = InputEvent::KEY;
|
||||||
event.ID = ++last_id;
|
|
||||||
InputEventKey &k = event.key;
|
InputEventKey &k = event.key;
|
||||||
|
|
||||||
k.mod = ke.mod_state;
|
k.mod = ke.mod_state;
|
||||||
@ -1819,7 +1812,7 @@ void OS_Windows::process_events() {
|
|||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
last_id = joypad->process_joypads(last_id);
|
joypad->process_joypads();
|
||||||
|
|
||||||
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
|
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
|
|
||||||
@ -2303,7 +2296,6 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
|
|||||||
hInstance = _hInstance;
|
hInstance = _hInstance;
|
||||||
pressrc = 0;
|
pressrc = 0;
|
||||||
old_invalid = true;
|
old_invalid = true;
|
||||||
last_id = 0;
|
|
||||||
mouse_mode = MOUSE_MODE_VISIBLE;
|
mouse_mode = MOUSE_MODE_VISIBLE;
|
||||||
#ifdef STDOUT_FILE
|
#ifdef STDOUT_FILE
|
||||||
stdo = fopen("stdout.txt", "wb");
|
stdo = fopen("stdout.txt", "wb");
|
||||||
|
@ -83,7 +83,6 @@ class OS_Windows : public OS {
|
|||||||
bool outside;
|
bool outside;
|
||||||
int old_x, old_y;
|
int old_x, old_y;
|
||||||
Point2i center;
|
Point2i center;
|
||||||
unsigned int last_id;
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED)
|
||||||
ContextGL_Win *gl_context;
|
ContextGL_Win *gl_context;
|
||||||
#endif
|
#endif
|
||||||
|
@ -454,10 +454,10 @@ InputDefault::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int
|
|||||||
return jx;
|
return jx;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
|
void JoypadLinux::process_joypads() {
|
||||||
|
|
||||||
if (joy_mutex->try_lock() != OK) {
|
if (joy_mutex->try_lock() != OK) {
|
||||||
return p_event_id;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < JOYPADS_MAX; i++) {
|
for (int i = 0; i < JOYPADS_MAX; i++) {
|
||||||
|
|
||||||
@ -477,11 +477,11 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
|
|||||||
// ev may be tainted and out of MAX_KEY range, which will cause
|
// ev may be tainted and out of MAX_KEY range, which will cause
|
||||||
// joy->key_map[ev.code] to crash
|
// joy->key_map[ev.code] to crash
|
||||||
if (ev.code < 0 || ev.code >= MAX_KEY)
|
if (ev.code < 0 || ev.code >= MAX_KEY)
|
||||||
return p_event_id;
|
return;
|
||||||
|
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
case EV_KEY:
|
case EV_KEY:
|
||||||
p_event_id = input->joy_button(p_event_id, i, joy->key_map[ev.code], ev.value);
|
input->joy_button(i, joy->key_map[ev.code], ev.value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_ABS:
|
case EV_ABS:
|
||||||
@ -496,7 +496,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
|
|||||||
} else
|
} else
|
||||||
joy->dpad &= ~(InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_RIGHT);
|
joy->dpad &= ~(InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_RIGHT);
|
||||||
|
|
||||||
p_event_id = input->joy_hat(p_event_id, i, joy->dpad);
|
input->joy_hat(i, joy->dpad);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ABS_HAT0Y:
|
case ABS_HAT0Y:
|
||||||
@ -508,7 +508,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
|
|||||||
} else
|
} else
|
||||||
joy->dpad &= ~(InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_DOWN);
|
joy->dpad &= ~(InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_DOWN);
|
||||||
|
|
||||||
p_event_id = input->joy_hat(p_event_id, i, joy->dpad);
|
input->joy_hat(i, joy->dpad);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -525,7 +525,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
|
|||||||
for (int j = 0; j < MAX_ABS; j++) {
|
for (int j = 0; j < MAX_ABS; j++) {
|
||||||
int index = joy->abs_map[j];
|
int index = joy->abs_map[j];
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
p_event_id = input->joy_axis(p_event_id, i, index, joy->curr_axis[index]);
|
input->joy_axis(i, index, joy->curr_axis[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len == 0 || (len < 0 && errno != EAGAIN)) {
|
if (len == 0 || (len < 0 && errno != EAGAIN)) {
|
||||||
@ -546,6 +546,5 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
joy_mutex->unlock();
|
joy_mutex->unlock();
|
||||||
return p_event_id;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,7 +42,7 @@ class JoypadLinux {
|
|||||||
public:
|
public:
|
||||||
JoypadLinux(InputDefault *in);
|
JoypadLinux(InputDefault *in);
|
||||||
~JoypadLinux();
|
~JoypadLinux();
|
||||||
uint32_t process_joypads(uint32_t p_event_id);
|
void process_joypads();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
|
@ -94,7 +94,6 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
|
|||||||
last_button_state = 0;
|
last_button_state = 0;
|
||||||
|
|
||||||
xmbstring = NULL;
|
xmbstring = NULL;
|
||||||
event_id = 0;
|
|
||||||
x11_window = 0;
|
x11_window = 0;
|
||||||
last_click_ms = 0;
|
last_click_ms = 0;
|
||||||
args = OS::get_singleton()->get_cmdline_args();
|
args = OS::get_singleton()->get_cmdline_args();
|
||||||
@ -1143,7 +1142,6 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
|
|||||||
/* Phase 7, send event to Window */
|
/* Phase 7, send event to Window */
|
||||||
|
|
||||||
InputEvent event;
|
InputEvent event;
|
||||||
event.ID = ++event_id;
|
|
||||||
event.type = InputEvent::KEY;
|
event.type = InputEvent::KEY;
|
||||||
event.device = 0;
|
event.device = 0;
|
||||||
event.key.mod = state;
|
event.key.mod = state;
|
||||||
@ -1334,7 +1332,6 @@ void OS_X11::process_xevents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputEvent mouse_event;
|
InputEvent mouse_event;
|
||||||
mouse_event.ID = ++event_id;
|
|
||||||
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||||
mouse_event.device = 0;
|
mouse_event.device = 0;
|
||||||
mouse_event.mouse_button.mod = get_key_modifier_state(event.xbutton.state);
|
mouse_event.mouse_button.mod = get_key_modifier_state(event.xbutton.state);
|
||||||
@ -1360,7 +1357,6 @@ void OS_X11::process_xevents() {
|
|||||||
last_click_ms = 0;
|
last_click_ms = 0;
|
||||||
last_click_pos = Point2(-100, -100);
|
last_click_pos = Point2(-100, -100);
|
||||||
mouse_event.mouse_button.doubleclick = true;
|
mouse_event.mouse_button.doubleclick = true;
|
||||||
mouse_event.ID = ++event_id;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
last_click_ms += diff;
|
last_click_ms += diff;
|
||||||
@ -1447,7 +1443,6 @@ void OS_X11::process_xevents() {
|
|||||||
Point2i rel = pos - last_mouse_pos;
|
Point2i rel = pos - last_mouse_pos;
|
||||||
|
|
||||||
InputEvent motion_event;
|
InputEvent motion_event;
|
||||||
motion_event.ID = ++event_id;
|
|
||||||
motion_event.type = InputEvent::MOUSE_MOTION;
|
motion_event.type = InputEvent::MOUSE_MOTION;
|
||||||
motion_event.device = 0;
|
motion_event.device = 0;
|
||||||
|
|
||||||
@ -1916,7 +1911,7 @@ void OS_X11::run() {
|
|||||||
|
|
||||||
process_xevents(); // get rid of pending events
|
process_xevents(); // get rid of pending events
|
||||||
#ifdef JOYDEV_ENABLED
|
#ifdef JOYDEV_ENABLED
|
||||||
event_id = joypad->process_joypads(event_id);
|
joypad->process_joypads();
|
||||||
#endif
|
#endif
|
||||||
if (Main::iteration() == true)
|
if (Main::iteration() == true)
|
||||||
break;
|
break;
|
||||||
|
@ -116,7 +116,6 @@ class OS_X11 : public OS_Unix {
|
|||||||
bool last_mouse_pos_valid;
|
bool last_mouse_pos_valid;
|
||||||
Point2i last_click_pos;
|
Point2i last_click_pos;
|
||||||
uint64_t last_click_ms;
|
uint64_t last_click_ms;
|
||||||
unsigned int event_id;
|
|
||||||
uint32_t last_button_state;
|
uint32_t last_button_state;
|
||||||
|
|
||||||
PhysicsServer *physics_server;
|
PhysicsServer *physics_server;
|
||||||
|
Loading…
Reference in New Issue
Block a user