Handing input controls while Editor running application logic


Recommended Posts


While Editor is running and application logic is on, I would like to handle input from keyboard.

Currently I am using a "Usage Example\Basic Object Movements" example from documentation 

int init() 
  Player player = new PlayerSpectator();
  int index = engine.editor.findNode("Player");
  if (index != -1) 
    sphere = engine.editor.getNode(index);
  engine.controls.setStateKey(CONTROLS_STATE_AUX_0, 'p');
  return 1;

// start of the main loop
int update() 
  if (sphere != NULL)
    float ifps = engine.game.getIFps();
    float angle = ifps * 90.0f;
    // get the current world transform matrix of the mesh
    Mat4 worldTransform = sphere.getWorldTransform();
    // get the direction vector
    Vec3 direction = Vec3(worldTransform.col1);
    engine.visualizer.renderDirection(sphere.getWorldPosition(), vec3(direction), vec4(1.0f, 0.0f, 0.0f, 1.0f), 0.1f, 0);
    if (engine.controls.getState(CONTROLS_STATE_AUX_0))
      Vec3 delta_movement = direction * movement_speed * ifps;
      sphere.setWorldPosition(sphere.getWorldPosition() + delta_movement);
    mat4 transform = sphere.getTransform() * rotateZ(angle);
  return 1;


but input is ignored when I am running a project in Editor.

If I run the project from the DSK browser it works as expected.

How can I handle the same input while the editor is executing application logic. Otherwise I have to keep running the project which is not the best experience while developing?




Link to post

Hi Morbid,

Thank you, I'll try that when I get home.

I think I would have tried that in the first place, but there is a small chance that I didn't :)


Link to post