keyboard.h

nds stdio keyboard integration. [詳細]

#include <nds/ndstypes.h>
#include <nds/arm9/background.h>

ソースコードを見る。

構成

struct  KeyMap
 defines a key mapping [詳細]
struct  Keyboard
 describes a keyboard [詳細]

型定義

typedef void(* KeyChangeCallback )(int key)
 KeyChangedCallback.
typedef struct KeyMap KeyMap
typedef struct Keyboard Keyboard

列挙型

enum  KeyboardState {
  Lower = 0,
  Upper = 1,
  Numeric = 2,
  Reduced = 3
}
 

states the keyboard can be in, currently only Lower and Upper supported

[詳細]

関数

KeyboardkeyboardGetDefault (void)
 Gets the default keyboard.
KeyboardkeyboardInit (Keyboard *keyboard, int layer, BgType type, BgSize size, int mapBase, int tileBase, bool mainDisplay, bool loadGraphics)
 initializes the keyboard system with the supplied keyboard
KeyboardkeyboardDemoInit (void)
 initializes the keyboard with default options
void keyboardShow (void)
 Displays the keyboard.
void keyboardHide (void)
 Hides the keyboard.
int keyboardGetKey (int x, int y)
 returns the ascii code for the key located at the supplied x and y. Will not effect keyboard shift state.
void keyboardGetString (char *buffer, int maxLen)
 reads the input until a the return key is pressed or the maxLen is exceeded.
int keyboardGetChar (void)
 Waits for user to press a key and returns the key pressed. Use keyboardUpdate instead for async operation.
int keyboardUpdate (void)
 Processes the keyboard. Should be called once per frame when using the keyboard in an async manner.

説明

nds stdio keyboard integration.

The keyboard component allows the use of a default keyboard via stdin as well as direct via the functions exposed below. The default behavior is a hidden keyboard that shows on a call to scanf(stdin, ...).
By default the keyboard uses background 3 of the sub display, consumes approximatly 40KiB of background vram begining at tile base 1 and 2KB of map stored at map base 30. The default is designed to function along side a default instance of the console print functionality.
To customize keyboard behavior and resource usage modify the keyboard structure returned by keyboardGetDefault() or create your own keyboard.

列挙型

states the keyboard can be in, currently only Lower and Upper supported

列挙型の値:
Lower 

Normal keyboard display (lowercase letters) >

Upper 

Caps lock Held >

Numeric 

Numeric only keypad (not provided by the default keyboard) >

Reduced 

Reduced footprint keyboard (not provided by the default keyboard) >


関数

Keyboard * keyboardDemoInit ( void   ) 

initializes the keyboard with default options

Same as calling keyboardInit(NULL, 3, BgType_Text4bpp, BgSize_T_256x512, 20, 0, false, true)

例:
input/keyboard/keyboard_async/source/template.c, と input/keyboard/keyboard_stdin/source/keymain.c.
int keyboardGetKey ( int  x,
int  y 
)

returns the ascii code for the key located at the supplied x and y. Will not effect keyboard shift state.

引数:
x the pixel x location
y the pixel y location
戻り値:
the key pressed or NOKEY if user pressed outside the keypad
void keyboardGetString ( char *  buffer,
int  maxLen 
)

reads the input until a the return key is pressed or the maxLen is exceeded.

引数:
buffer a buffer to hold the input string
maxLen the maximum length to read
Keyboard * keyboardInit ( Keyboard keyboard,
int  layer,
BgType  type,
BgSize  size,
int  mapBase,
int  tileBase,
bool  mainDisplay,
bool  loadGraphics 
)

initializes the keyboard system with the supplied keyboard

引数:
keyboard the keyboard struct to initialize (can be NULL)
layer the background layer to use
type the background type to initialize
size the background size to initialize
mapBase the map base to use for the background
tileBase the graphics tile base to use for the background
mainDisplay if true the keyboard will render on the main display
loadGraphics if true the keyboard graphics will be loaded
戻り値:
returns the initialized keyboard struct
int keyboardUpdate ( void   ) 

Processes the keyboard. Should be called once per frame when using the keyboard in an async manner.

戻り値:
the ascii code of the key pressed or -1 if no key was pressed.
例:
input/keyboard/keyboard_async/source/template.c.
 全て クラス ファイル 関数 変数 型定義 列挙型 列挙型の値 マクロ定義
libndsに対してMon Apr 26 23:39:50 2010に生成されました。  doxygen 1.6.3