GLUT tutorial (7) glut advanced keyboard control

Source: Internet
Author: User
In this section, we will introduce four new functions for processing keyboard input. The first function allows us to disable keyboard repeat. The function is prototype: int glusetkeyrepeat (INT repeatmode); parameter: repeatmode: Enable, disable, or restore Auto Repeat mode. Below are the possible values. The possible value of repeatmode is: glu_key_repeat_off: Disable auto repeat mode. Glu_key_repeat_on: Enable Auto Repeat mode. Glu_key_repeat_default: restores the auto repeat mode to the default state. Note that this function is global. That is, it will affect the repeat mode of all windows. It is not just our application. Therefore, when you use this function to disable the auto repeat mode, it is necessary to reset the auto repeat mode to the default mode at the end of the program. GLUT provides another simple function to disable keyboard repeat, which allows us to safely ignore keyboard repeat without affecting other programs. The function is prototype: int glutignorekeyrepeat (INT repeatmode); parameter: repeatmode: 0 is passed, Auto Repeat is enabled, and Auto Repeat is disabled if not 0. In some cases, when the key repeat occurs, function callback is not accepted. However, if you want to execute an action after a key is pressed, you need to know when the key will be released. GLUT provides two callback functions for function registration. Void glukeyboardupfunc (void (* func) (unsigned char key, int X, int y); void gluspecialupfunc (void (* func) (INT key, int X, int y); parameter: FUNC: name of the callback function. In the next section, we will provide a program, that is, the code in the previous section, to see how these functions work. (This chapter is difficult to translate. I don't know what to say, Khan. --| View the original text if necessary. Http://www.lighthouse3d.com/opengl/glut/index.php? 7. I don't think the original article is clearly written. Let's take a look at the example in the next section. Haha .)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.