|
SDL
2.0
|
Include dependency graph for keyboard.c:Go to the source code of this file.
Data Structures | |
| struct | fontMapping |
Macros | |
| #define | TEST_INPUT_RECT |
| #define | GLYPH_SIZE_IMAGE 16 /* size of glyphs (characters) in the bitmap font file */ |
| #define | GLYPH_SIZE_SCREEN 32 /* size of glyphs (characters) as shown on the screen */ |
| #define | MAX_CHARS 1024 |
| #define | TABLE_SIZE 51 /* size of our table which maps keys and modifiers to font indices */ |
Functions | |
| int | keyToGlyphIndex (SDL_Keysym key) |
| void | getPositionForCharNumber (int n, int *x, int *y) |
| void | drawGlyph (int glyph, int positionIndex) |
| SDL_Texture * | loadFont (void) |
| void | draw () |
| int | main (int argc, char *argv[]) |
Variables | |
| static SDL_Texture * | texture |
| static SDL_Renderer * | renderer |
| static int | numChars = 0 |
| static SDL_Color | bg_color = { 50, 50, 100, 255 } |
| static int | glyphs [MAX_CHARS] |
| fontMapping | map [TABLE_SIZE] |
Definition at line 12 of file keyboard.c.
Referenced by drawGlyph(), and main().
Definition at line 13 of file keyboard.c.
Referenced by drawGlyph(), and getPositionForCharNumber().
| #define MAX_CHARS 1024 |
Definition at line 15 of file keyboard.c.
Referenced by main().
Definition at line 38 of file keyboard.c.
Referenced by keyToGlyphIndex().
| #define TEST_INPUT_RECT |
Definition at line 10 of file keyboard.c.
| void draw | ( | ) |
Definition at line 199 of file keyboard.c.
References SDL_Color::a, SDL_Color::b, drawGlyph(), SDL_Color::g, glyphs, i, numChars, SDL_Color::r, SDL_RenderClear, SDL_RenderPresent, and SDL_SetRenderDrawColor.
Referenced by main().
| void drawGlyph | ( | int | glyph, |
| int | positionIndex | ||
| ) |
Definition at line 153 of file keyboard.c.
References getPositionForCharNumber(), GLYPH_SIZE_IMAGE, GLYPH_SIZE_SCREEN, and SDL_RenderCopy.
Referenced by draw().
| void getPositionForCharNumber | ( | int | n, |
| int * | x, | ||
| int * | y | ||
| ) |
Definition at line 134 of file keyboard.c.
References GLYPH_SIZE_SCREEN, and SDL_RenderGetLogicalSize.
Referenced by drawGlyph().
| int keyToGlyphIndex | ( | SDL_Keysym | key | ) |
Definition at line 111 of file keyboard.c.
References fontMapping::allow_no_mod, i, fontMapping::index, fontMapping::mod, SDL_Keysym::mod, fontMapping::scancode, SDL_Keysym::scancode, and TABLE_SIZE.
Referenced by main().
| SDL_Texture* loadFont | ( | void | ) |
Definition at line 164 of file keyboard.c.
References SDL_Surface::format, SDL_Surface::h, NULL, SDL_BLENDMODE_BLEND, SDL_BlitSurface, SDL_CreateRGBSurface, SDL_CreateTextureFromSurface, SDL_FreeSurface, SDL_GetError, SDL_LoadBMP, SDL_MapRGB, SDL_PIXELFORMAT_ABGR8888, SDL_PixelFormatEnumToMasks, SDL_SetColorKey, SDL_SetTextureBlendMode, texture, and SDL_Surface::w.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 214 of file keyboard.c.
References done, draw(), SDL_WindowEvent::event, GLYPH_SIZE_IMAGE, glyphs, SDL_Rect::h, SDL_Event::key, SDL_KeyboardEvent::keysym, keyToGlyphIndex(), loadFont(), MAX_CHARS, numChars, SDL_Keysym::scancode, SDL_CreateRenderer, SDL_CreateWindow, SDL_Delay, SDL_DestroyRenderer, SDL_DestroyTexture, SDL_DestroyWindow, SDL_GetError, SDL_GetWindowSize, SDL_Init, SDL_INIT_VIDEO, SDL_IsTextInputActive, SDL_KEYDOWN, SDL_MOUSEBUTTONUP, SDL_PollEvent, SDL_Quit, SDL_QUIT, SDL_RENDERER_PRESENTVSYNC, SDL_RenderSetLogicalSize, SDL_SCANCODE_BACKSPACE, SDL_SetTextInputRect, SDL_StartTextInput, SDL_StopTextInput, SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_WINDOW_RESIZABLE, SDL_WINDOWEVENT, SDL_WINDOWEVENT_RESIZED, SDL_Event::type, SDL_Rect::w, SDL_Event::window, SDL_Rect::x, and SDL_Rect::y.
|
static |
Definition at line 21 of file keyboard.c.
|
static |
Definition at line 23 of file keyboard.c.
| fontMapping map[TABLE_SIZE] |
Definition at line 46 of file keyboard.c.
|
static |
Definition at line 20 of file keyboard.c.
|
static |
Definition at line 19 of file keyboard.c.
|
static |
Definition at line 17 of file keyboard.c.
Referenced by loadFont().