misc/winutils/include/SDL_keyboard.h
author Janne Uusitupa
Mon, 24 Nov 2014 04:14:06 +0100
changeset 10543 decba1e6099f
parent 10017 de822cd3df3a
permissions -rw-r--r--
finnish translation update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     1
/*
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     2
    SDL - Simple DirectMedia Layer
7809
7d4fb2f35f4f update SDL headers for winutils
koda
parents: 6560
diff changeset
     3
    Copyright (C) 1997-2012 Sam Lantinga
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     4
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     5
    This library is free software; you can redistribute it and/or
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     6
    modify it under the terms of the GNU Lesser General Public
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     7
    License as published by the Free Software Foundation; either
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     8
    version 2.1 of the License, or (at your option) any later version.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     9
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    10
    This library is distributed in the hope that it will be useful,
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    13
    Lesser General Public License for more details.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    14
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    15
    You should have received a copy of the GNU Lesser General Public
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    16
    License along with this library; if not, write to the Free Software
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    18
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    19
    Sam Lantinga
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    20
    slouken@libsdl.org
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    21
*/
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    22
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    23
/** @file SDL_keyboard.h
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    24
 *  Include file for SDL keyboard event handling
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    25
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    26
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    27
#ifndef _SDL_keyboard_h
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    28
#define _SDL_keyboard_h
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    29
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    30
#include "SDL_stdinc.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    31
#include "SDL_error.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    32
#include "SDL_keysym.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    33
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    34
#include "begin_code.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    35
/* Set up for C function definitions, even when using C++ */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    36
#ifdef __cplusplus
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    37
extern "C" {
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    38
#endif
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    39
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    40
/** Keysym structure
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    41
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    42
 *  - The scancode is hardware dependent, and should not be used by general
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    43
 *    applications.  If no hardware scancode is available, it will be 0.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    44
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    45
 *  - The 'unicode' translated character is only available when character
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    46
 *    translation is enabled by the SDL_EnableUNICODE() API.  If non-zero,
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    47
 *    this is a UNICODE character corresponding to the keypress.  If the
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    48
 *    high 9 bits of the character are 0, then this maps to the equivalent
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    49
 *    ASCII character:
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    50
 *      @code
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    51
 *  char ch;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    52
 *  if ( (keysym.unicode & 0xFF80) == 0 ) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    53
 *      ch = keysym.unicode & 0x7F;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    54
 *  } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    55
 *      An international character..
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    56
 *  }
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    57
 *      @endcode
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    58
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    59
typedef struct SDL_keysym {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    60
    Uint8 scancode;         /**< hardware specific scancode */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    61
    SDLKey sym;         /**< SDL virtual keysym */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    62
    SDLMod mod;         /**< current key modifiers */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    63
    Uint16 unicode;         /**< translated character */
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    64
} SDL_keysym;
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    65
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    66
/** This is the mask which refers to all hotkey bindings */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    67
#define SDL_ALL_HOTKEYS     0xFFFFFFFF
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    68
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    69
/* Function prototypes */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    70
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    71
 * Enable/Disable UNICODE translation of keyboard input.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    72
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    73
 * This translation has some overhead, so translation defaults off.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    74
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    75
 * @param[in] enable
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    76
 * If 'enable' is 1, translation is enabled.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    77
 * If 'enable' is 0, translation is disabled.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    78
 * If 'enable' is -1, the translation state is not changed.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    79
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    80
 * @return It returns the previous state of keyboard translation.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    81
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    82
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    83
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    84
#define SDL_DEFAULT_REPEAT_DELAY    500
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
    85
#define SDL_DEFAULT_REPEAT_INTERVAL 30
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    86
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    87
 * Enable/Disable keyboard repeat.  Keyboard repeat defaults to off.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    88
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    89
 *  @param[in] delay
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    90
 *  'delay' is the initial delay in ms between the time when a key is
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    91
 *  pressed, and keyboard repeat begins.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    92
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    93
 *  @param[in] interval
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    94
 *  'interval' is the time in ms between keyboard repeat events.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    95
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    96
 *  If 'delay' is set to 0, keyboard repeat is disabled.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    97
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    98
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    99
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   100
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   101
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   102
 * Get a snapshot of the current state of the keyboard.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   103
 * Returns an array of keystates, indexed by the SDLK_* syms.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   104
 * Usage:
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
   105
 *  @code
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
   106
 *  Uint8 *keystate = SDL_GetKeyState(NULL);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
   107
 *  if ( keystate[SDLK_RETURN] ) //... \<RETURN> is pressed.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7809
diff changeset
   108
 *  @endcode
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   109
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   110
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   111
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   112
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   113
 * Get the current key modifier state
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   114
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   115
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   116
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   117
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   118
 * Set the current key modifier state.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   119
 * This does not change the keyboard state, only the key modifier flags.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   120
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   121
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   122
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   123
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   124
 * Get the name of an SDL virtual keysym
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   125
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   126
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   127
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   128
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   129
/* Ends C function definitions when using C++ */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   130
#ifdef __cplusplus
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   131
}
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   132
#endif
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   133
#include "close_code.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   134
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   135
#endif /* _SDL_keyboard_h */