Strange behaviour of Polycode Editor & Debugger

  1. 2 months ago
    Edited 2 months ago by Tassilo

    Hi guys.
    I truly like what I see so far in terms of having a 3D Lua framework. However, some things are puzzling / annoying me so far (Windows 10 64 Bit, v0.8.4):

    • Tabbing in and out of the application is regularily killing keyboard input for me, requiring me to restart the IDE
    • I can't access curly brackets (problem with german keyboard layout?)
    • Running this code
    Services.Input:addEventListener(nil, onKeyDownEvent, InputEvent.EVENT_KEYDOWN)
    
    scene = Scene(Scene.SCENE_3D)
    
    sceneEntity = SceneEntityInstance(scene, "Resources/scene.entity")
    scene:addChild(sceneEntity)
    
    camera = safe_cast(sceneEntity:getEntityById("main_camera", true), Camera)
    scene:setActiveCamera(camera)
    
    playerx = 0
    playery = 0.5
    playerz = 0
    
    function Update(elapsed)
    	camera:setPosition(playerx,playery,playerz)
    end
    
    function onKeyDown(key)
    	if key == KEY_LEFT then
    		print("LEFT WAS PRESSED")
    	end
    end

    results in:

    LEFT WAS PRESSED
    Error in file Scripts/Main.lua on line 51
    attempt to call field 'callback' (a nil value)
    Backtrace:
    In file Scripts/Main.lua on line 51

    Line 51? My program is just 23 lines long and the onKey should not generate an error, should it?
    Any help would be highly appreciated, thanks!

  2. fodinabor

    Sep 8 Administrator

    hey,
    just a fast answer - currently not near a PC to check your code..

    Instead of restarting the engine after ALT+TAB just press ALT once when the IDE is open - afterwards it should be working again as it should.

    jep... german keyboard layouts are not fully supported.

    just something I discovered in your code:
    look at the first line: Services.Input:addEventListener(nil, onKeyDownEvent, InputEvent.EVENT_KEYDOWN)
    where is onKeyDownEvent?
    (I actually think you can just leave that line away and just use the function onKeyDown - this will be called automatically..)

    Greetings

  3. Great, thanks a lot, very helpful. Any chance I could support the project regarding the german keyboard layout?

  4. fodinabor

    Sep 8 Administrator

    Hmm.. The issue is, that this public version is no longer being updated, therefore that would not help too much..

 

or Sign Up to reply!