Solarus-Games English Forum

Solarus => Development => Topic started by: jnew23 on February 22, 2016, 09:45:24 PM

Title: Mac keyboard controls?
Post by: jnew23 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
Title: Re: Mac keyboard controls?
Post by: Christopho 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?
Title: Re: Mac keyboard controls?
Post by: jnew23 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.
Title: Re: Mac keyboard controls?
Post by: Christopho 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.
Title: Re: Mac keyboard controls?
Post by: anthony on March 03, 2016, 09:15:24 PM
Where can i get version 1.5 for osx, my keyboard isn't working either.
Title: Re: Mac keyboard controls?
Post by: Christopho 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.
Title: Re: Mac keyboard controls?
Post by: anthony 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
Title: Re: Mac keyboard controls?
Post by: vlag 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 ?