How to handle GLFW_REPEAT? getting more events than expectedfork() branches more than expected?Function Pointer as Function ParameterHow to tell if shift is pressed on numpad input with NumLock on? Or at least get NumLock status?SDL 2.0 Key repeat and delayGLFW Input StatesPassing in C++ Method as a Function Pointer?Why there is no GLFW_REPEAT for the mouse?Is there a way to process only one input event after a key is pressed using GLFW?GLFW switching boolean toggleglfwSetKeyCallback() from GLFW is not called constantly during a key press

How to deal with relatively technically incompetent coworker?

Do these creatures from the Tomb of Annihilation campaign speak Common?

Names of the Six Tastes

Illegal assignment from Id to List

Magical Modulo Squares

Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?

Is it safe to keep the GPU on 100% utilization for a very long time?

How can I test a shell script in a "safe environment" to avoid harm to my computer?

Examples where existence is harder than evaluation

Can the Telekinesis spell be used on yourself for the following?

Crime rates in a post-scarcity economy

What is the oldest instrument ever?

Why did Ham the Chimp push levers?

What's an appropriate age to involve kids in life changing decisions?

Light Switch Neutrals: Bundle all together?

Identity of a supposed anonymous referee revealed through "Description" of the report

get unsigned long long addition carry

How to explain intravenous drug abuse to a 6-year-old?

Why is there a cap on 401k contributions?

Opposite party turned away from voting when ballot is all opposing party

Colorless commander using lands that chose based upon identity?

How to animate petals opening

99 coins into the sacks

Should one save up to purchase a house/condo or maximize their 401k first?



How to handle GLFW_REPEAT? getting more events than expected


fork() branches more than expected?Function Pointer as Function ParameterHow to tell if shift is pressed on numpad input with NumLock on? Or at least get NumLock status?SDL 2.0 Key repeat and delayGLFW Input StatesPassing in C++ Method as a Function Pointer?Why there is no GLFW_REPEAT for the mouse?Is there a way to process only one input event after a key is pressed using GLFW?GLFW switching boolean toggleglfwSetKeyCallback() from GLFW is not called constantly during a key press






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm writing a simple game to discover Vulkan. I'm using GLFW 3 to create the window and handle input. I wanted some basic control over my camera with keyboard input, and I'm observing some strange lag when releasing a key passed the repeat delay.



I use glfwPollEvents() once in my update loop, and set up a key callback :



void Keyboard::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)

static size_t count;
count++;
if(action == GLFW_PRESS)

std::cout << "(" << count << ") PRESS >> scancode : " << scancode << "
if(action == GLFW_REPEAT)

std::cout << "(" << count << ") REPEAT >> scancode : " << scancode << "
if (action == GLFW_RELEASE)
keycode : " << key << std::endl;




When running the application, I'm pressing the space bar once, keeping it pressed for some time and releasing it once. (the space bar isn't important here, the results are the same with other keys).



I would expect something like that :



(1) PRESS >> scancode : 65 | keycode : 32
(2) REPEAT >> scancode : 65 | keycode : 32
(3) REPEAT >> scancode : 65 | keycode : 32
// more REPEAT lines
(18) REPEAT >> scancode : 65 | keycode : 32
(19) REPEAT >> scancode : 65 | keycode : 32
(20) RELEASE >> scancode : 65 | keycode : 32


But in fact I get this :



(1) PRESS >> scancode : 65 | keycode : 32
(2) REPEAT >> scancode : 65 | keycode : 32
(3) REPEAT >> scancode : 65 | keycode : 32
// more REPEAT lines
(18) REPEAT >> scancode : 65 | keycode : 32
(19) REPEAT >> scancode : 65 | keycode : 32
(20) RELEASE >> scancode : 65 | keycode : 32
(21) PRESS >> scancode : 65 | keycode : 32
(22) REPEAT >> scancode : 65 | keycode : 32
(23) REPEAT >> scancode : 65 | keycode : 32
(24) REPEAT >> scancode : 65 | keycode : 32
(25) RELEASE >> scancode : 65 | keycode : 32


I get REPEAT events after the initial RELEASE event (which happens when I effectively release the space bar), and I get an extra PRESS and an extra RELEASE event. The longer I press the space bar, the more extra REPEAT I get, but I get only one extra PRESS and one extra RELEASE. If I don't get passed the repetition delay set up in my OS, I get only one PRESS and one RELEASE.



I'm looking for an explanation and/or a workaround, but I don't really know where to go from here. Reading GLFW documentation regarding input handling didn't help, I didn't find anyone with the same problem either.










share|improve this question




























    0















    I'm writing a simple game to discover Vulkan. I'm using GLFW 3 to create the window and handle input. I wanted some basic control over my camera with keyboard input, and I'm observing some strange lag when releasing a key passed the repeat delay.



    I use glfwPollEvents() once in my update loop, and set up a key callback :



    void Keyboard::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)

    static size_t count;
    count++;
    if(action == GLFW_PRESS)

    std::cout << "(" << count << ") PRESS >> scancode : " << scancode << "
    if(action == GLFW_REPEAT)

    std::cout << "(" << count << ") REPEAT >> scancode : " << scancode << "
    if (action == GLFW_RELEASE)
    keycode : " << key << std::endl;




    When running the application, I'm pressing the space bar once, keeping it pressed for some time and releasing it once. (the space bar isn't important here, the results are the same with other keys).



    I would expect something like that :



    (1) PRESS >> scancode : 65 | keycode : 32
    (2) REPEAT >> scancode : 65 | keycode : 32
    (3) REPEAT >> scancode : 65 | keycode : 32
    // more REPEAT lines
    (18) REPEAT >> scancode : 65 | keycode : 32
    (19) REPEAT >> scancode : 65 | keycode : 32
    (20) RELEASE >> scancode : 65 | keycode : 32


    But in fact I get this :



    (1) PRESS >> scancode : 65 | keycode : 32
    (2) REPEAT >> scancode : 65 | keycode : 32
    (3) REPEAT >> scancode : 65 | keycode : 32
    // more REPEAT lines
    (18) REPEAT >> scancode : 65 | keycode : 32
    (19) REPEAT >> scancode : 65 | keycode : 32
    (20) RELEASE >> scancode : 65 | keycode : 32
    (21) PRESS >> scancode : 65 | keycode : 32
    (22) REPEAT >> scancode : 65 | keycode : 32
    (23) REPEAT >> scancode : 65 | keycode : 32
    (24) REPEAT >> scancode : 65 | keycode : 32
    (25) RELEASE >> scancode : 65 | keycode : 32


    I get REPEAT events after the initial RELEASE event (which happens when I effectively release the space bar), and I get an extra PRESS and an extra RELEASE event. The longer I press the space bar, the more extra REPEAT I get, but I get only one extra PRESS and one extra RELEASE. If I don't get passed the repetition delay set up in my OS, I get only one PRESS and one RELEASE.



    I'm looking for an explanation and/or a workaround, but I don't really know where to go from here. Reading GLFW documentation regarding input handling didn't help, I didn't find anyone with the same problem either.










    share|improve this question
























      0












      0








      0








      I'm writing a simple game to discover Vulkan. I'm using GLFW 3 to create the window and handle input. I wanted some basic control over my camera with keyboard input, and I'm observing some strange lag when releasing a key passed the repeat delay.



      I use glfwPollEvents() once in my update loop, and set up a key callback :



      void Keyboard::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)

      static size_t count;
      count++;
      if(action == GLFW_PRESS)

      std::cout << "(" << count << ") PRESS >> scancode : " << scancode << "
      if(action == GLFW_REPEAT)

      std::cout << "(" << count << ") REPEAT >> scancode : " << scancode << "
      if (action == GLFW_RELEASE)
      keycode : " << key << std::endl;




      When running the application, I'm pressing the space bar once, keeping it pressed for some time and releasing it once. (the space bar isn't important here, the results are the same with other keys).



      I would expect something like that :



      (1) PRESS >> scancode : 65 | keycode : 32
      (2) REPEAT >> scancode : 65 | keycode : 32
      (3) REPEAT >> scancode : 65 | keycode : 32
      // more REPEAT lines
      (18) REPEAT >> scancode : 65 | keycode : 32
      (19) REPEAT >> scancode : 65 | keycode : 32
      (20) RELEASE >> scancode : 65 | keycode : 32


      But in fact I get this :



      (1) PRESS >> scancode : 65 | keycode : 32
      (2) REPEAT >> scancode : 65 | keycode : 32
      (3) REPEAT >> scancode : 65 | keycode : 32
      // more REPEAT lines
      (18) REPEAT >> scancode : 65 | keycode : 32
      (19) REPEAT >> scancode : 65 | keycode : 32
      (20) RELEASE >> scancode : 65 | keycode : 32
      (21) PRESS >> scancode : 65 | keycode : 32
      (22) REPEAT >> scancode : 65 | keycode : 32
      (23) REPEAT >> scancode : 65 | keycode : 32
      (24) REPEAT >> scancode : 65 | keycode : 32
      (25) RELEASE >> scancode : 65 | keycode : 32


      I get REPEAT events after the initial RELEASE event (which happens when I effectively release the space bar), and I get an extra PRESS and an extra RELEASE event. The longer I press the space bar, the more extra REPEAT I get, but I get only one extra PRESS and one extra RELEASE. If I don't get passed the repetition delay set up in my OS, I get only one PRESS and one RELEASE.



      I'm looking for an explanation and/or a workaround, but I don't really know where to go from here. Reading GLFW documentation regarding input handling didn't help, I didn't find anyone with the same problem either.










      share|improve this question














      I'm writing a simple game to discover Vulkan. I'm using GLFW 3 to create the window and handle input. I wanted some basic control over my camera with keyboard input, and I'm observing some strange lag when releasing a key passed the repeat delay.



      I use glfwPollEvents() once in my update loop, and set up a key callback :



      void Keyboard::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)

      static size_t count;
      count++;
      if(action == GLFW_PRESS)

      std::cout << "(" << count << ") PRESS >> scancode : " << scancode << "
      if(action == GLFW_REPEAT)

      std::cout << "(" << count << ") REPEAT >> scancode : " << scancode << "
      if (action == GLFW_RELEASE)
      keycode : " << key << std::endl;




      When running the application, I'm pressing the space bar once, keeping it pressed for some time and releasing it once. (the space bar isn't important here, the results are the same with other keys).



      I would expect something like that :



      (1) PRESS >> scancode : 65 | keycode : 32
      (2) REPEAT >> scancode : 65 | keycode : 32
      (3) REPEAT >> scancode : 65 | keycode : 32
      // more REPEAT lines
      (18) REPEAT >> scancode : 65 | keycode : 32
      (19) REPEAT >> scancode : 65 | keycode : 32
      (20) RELEASE >> scancode : 65 | keycode : 32


      But in fact I get this :



      (1) PRESS >> scancode : 65 | keycode : 32
      (2) REPEAT >> scancode : 65 | keycode : 32
      (3) REPEAT >> scancode : 65 | keycode : 32
      // more REPEAT lines
      (18) REPEAT >> scancode : 65 | keycode : 32
      (19) REPEAT >> scancode : 65 | keycode : 32
      (20) RELEASE >> scancode : 65 | keycode : 32
      (21) PRESS >> scancode : 65 | keycode : 32
      (22) REPEAT >> scancode : 65 | keycode : 32
      (23) REPEAT >> scancode : 65 | keycode : 32
      (24) REPEAT >> scancode : 65 | keycode : 32
      (25) RELEASE >> scancode : 65 | keycode : 32


      I get REPEAT events after the initial RELEASE event (which happens when I effectively release the space bar), and I get an extra PRESS and an extra RELEASE event. The longer I press the space bar, the more extra REPEAT I get, but I get only one extra PRESS and one extra RELEASE. If I don't get passed the repetition delay set up in my OS, I get only one PRESS and one RELEASE.



      I'm looking for an explanation and/or a workaround, but I don't really know where to go from here. Reading GLFW documentation regarding input handling didn't help, I didn't find anyone with the same problem either.







      c++ glfw






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 7:24









      aTomaTom

      499




      499






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311574%2fhow-to-handle-glfw-repeat-getting-more-events-than-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311574%2fhow-to-handle-glfw-repeat-getting-more-events-than-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해