Author Topic: Cursor Control with gamepad  (Read 4968 times)

hisashipong

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Cursor Control with gamepad
« on: January 13, 2014, 10:46:45 PM »
I'm just start for my programming life. i have some question about the gamepad in mobile.
If i want to make a cursor to control by gamepad, does NGUI have a easier function to do that?
because i have try to make a controller for display the cursor, but i cant use the function of the uiCamera for some dragging (Scroll view)

anyone have the same question with me? plz give me some suggestion / solution, thx very much

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cursor Control with gamepad
« Reply #1 on: January 14, 2014, 09:58:30 PM »
You would need to have custom input: UICamera.onCustomInput.

...although thinking about it... adding support to move the mouse with the controller would be a nice feature that would make it absolutely trivial to do ports of games from PC to consoles. I'm most likely going to do this myself when I start re-doing Windward later this month.

hisashipong

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: Cursor Control with gamepad
« Reply #2 on: January 14, 2014, 11:10:41 PM »
because I'm trying use bluetooth gamepad to link the mobile devices.

i have write a custom control for the cursor, but when i use a gamepad to control the cursor , and give it some input, it cant use OnDrag/ OnScroll , as i see the script , it's using Input.GetMouse / Input.GetTouch .

does it have any method to make a fake input to use the scroll / drag? thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cursor Control with gamepad
« Reply #3 on: January 15, 2014, 10:10:56 PM »
UICamera.ProcessTouch will process any touch, whether it's mouse, touch, controller, or custom. You just need to make sure that UICamera.currentTouch is valid and that you're passing the parameters it expects. Use the other functions like ProcessController as an example.