GCU port: problem with keypresses?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2987

    GCU port: problem with keypresses?

    Anyone using this port with Windows in console mode? I managed to compile a version of the client using PDCurses (defined both USE_GCU and WIN32_CONSOLE_MODE), it works perfectly... except for the keypresses. Pressing a key does nothing 99% of the time, and when it works, it simply takes ages to respond. Keys are queued, but most of the time don't seem to be processed. Any idea?
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2987

    #2
    Nevermind... found the problem. From the curses documentation:

    "The halfdelay routine is used for half-delay mode, which is similar to cbreak mode in that characters typed by the user are immediately available to the program. However, after blocking for tenths tenths of seconds, ERR is returned if nothing has been typed. The value of tenths must be a number between 1 and 255. Use nocbreak to leave half-delay mode."

    And in main-gcu (Term_xtra_gcu_event):
    Code:
    		/* Wait for a keypress; use halfdelay(1) so if the user takes more */
    		/* than 0.2 seconds we get a chance to do updates. */
    		halfdelay(2);
    		i = getch();
    		while (i == ERR) {
    			i = getch();
    			idle_update();
    		}
    		cbreak();
    Half-delay mode is still occuring when leaving this part of code. Even if it sounds useless, a call to nocbreak() must be made before calling cbreak().
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

    Comment

    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎