Author Topic: Mac keyboard controls?  (Read 1834 times)

jnew23

  • Newbie
  • *
  • Posts: 2
    • View Profile
Mac keyboard controls?
« on: February 22, 2016, 09:45:24 pm »
Hi, I'm making a game with a group of people for a class we're all in.  I have a macbook pro and a desktop computer.  My groupmate also has a linux laptop, and on windows and linux the keyboard controls work.  However, for a mac, it never goes into on_key_pressed.  I cannot figure out why this is the case, can anyone help me?  This is what we have:

Code: ( lua) [Select]
function game_manager:start_game()
    ...
    game:set_command_keyboard_binding("left", "a")
    game:set_command_keyboard_binding("right", dvorak and "e" or "d")
    game:set_command_keyboard_binding("up", dvorak and "," or "w")
    game:set_command_keyboard_binding("down", dvorak and "o" or "s")
    game:set_command_keyboard_binding("pause", "escape")
    ....
end

function sol.main:on_key_pressed(key, modifiers)
print("hey")
print(key)
if game:is_paused() or game:is_suspended() or hero.entitydata == nil then
print("PAUSED!")
return
end

mousex, mousey = sol.input.get_mouse_position()
x, y = convert_to_map(mousex, mousey)

if x ~= nil then
hero:set_direction(hero:get_direction4_to(x, y))
end

hero = game:get_hero()
if hero:get_state() ~= "freezed" then
if key == "space" then
hero.entitydata:startability("sword")
elseif (key == "e" and not dvorak) or (key == "." and dvorak) then
hero.entitydata:startability("swordtransform")
elseif key == "left shift" then
hero.entitydata:startability("block")
elseif key == "escape" then
print("TODO: pause menu")
--debug keys
elseif key == "r" then
hero.entitydata:throwrandom()
elseif key == "k" then
hero.entitydata:kill()
end
end
end

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Mac keyboard controls?
« Reply #1 on: February 22, 2016, 10:47:08 pm »
What version of Solarus are you using? Are you running the game directly or from the quest editor?

jnew23

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Mac keyboard controls?
« Reply #2 on: February 23, 2016, 01:33:33 am »
I'm using the most recent version.  I'm running it in the editor because I don't have solarus_run on my mac, just the GUI.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Mac keyboard controls?
« Reply #3 on: February 23, 2016, 10:36:43 am »
It is not normal that the Mac version has no solarus_run. The quest editor 1.4 is known to have to issues with keyboard and joypad when running a quest from it. This is fixed in the development version of 1.5 though.

anthony

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Mac keyboard controls?
« Reply #4 on: March 03, 2016, 09:15:24 pm »
Where can i get version 1.5 for osx, my keyboard isn't working either.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Mac keyboard controls?
« Reply #5 on: March 03, 2016, 09:28:17 pm »
1.5 is not released yet. In 1.4, the keyboard currently works when running from solarus_run but not when running from the quest editor.

anthony

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Mac keyboard controls?
« Reply #6 on: March 03, 2016, 09:51:51 pm »
1.4.5 solarus_run doesn't seem to work, got it working with v 1.4.4 solarus_run
« Last Edit: March 03, 2016, 10:24:18 pm by anthony »

vlag

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Mac keyboard controls?
« Reply #7 on: March 05, 2016, 02:42:29 pm »
Thanks for the feedback.

You may help to debug, actually the Solarus bundle works fine for me on my developer environment, so I probably made a mistake when I was building the package.
Could you report the error message when running the Solarus bundle, and also the error message when running solarus_run through the command line ?