SDL
2.0
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#include "SDL_test_common.h"
Go to the source code of this file.
Macros | |
#define | DEFAULT_PTSIZE 30 |
#define | DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" |
#define | MAX_TEXT_LENGTH 256 |
Functions | |
size_t | utf8_length (unsigned char c) |
char * | utf8_next (char *p) |
char * | utf8_advance (char *p, size_t distance) |
void | usage () |
void | InitInput () |
void | CleanupVideo () |
void | _Redraw (SDL_Renderer *renderer) |
void | Redraw () |
int | main (int argc, char *argv[]) |
Variables | |
static SDLTest_CommonState * | state |
static SDL_Rect | textRect |
static SDL_Rect | markedRect |
static SDL_Color | lineColor = {0,0,0,0} |
static SDL_Color | backColor = {255,255,255,0} |
static SDL_Color | textColor = {0,0,0,0} |
static char | text [MAX_TEXT_LENGTH] |
static char | markedText [SDL_TEXTEDITINGEVENT_TEXT_SIZE] |
static int | cursor = 0 |
#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" |
void _Redraw | ( | SDL_Renderer * | renderer | ) |
Definition at line 112 of file testime.c.
References cursor, SDL_Rect::h, SDL_Surface::h, markedRect, markedText, NULL, SDL_CreateTextureFromSurface, SDL_DestroyTexture, SDL_FreeSurface, SDL_RenderCopy, SDL_RenderFillRect, SDL_SetRenderDrawColor, SDL_SetTextInputRect, SDL_StartTextInput, SDL_StopTextInput, text, utf8_advance(), SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by Redraw().
void CleanupVideo | ( | ) |
void InitInput | ( | ) |
Definition at line 87 of file testime.c.
References DEFAULT_WINDOW_WIDTH, SDL_Rect::h, markedText, SDL_StartTextInput, text, textRect, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 210 of file testime.c.
References CleanupVideo(), cursor, DEFAULT_FONT, DEFAULT_PTSIZE, done, SDL_Event::edit, i, InitInput(), SDL_Event::key, SDL_KeyboardEvent::keysym, SDL_TextEditingEvent::length, markedText, SDLTest_CommonState::num_windows, Redraw(), renderer, SDLTest_CommonState::renderers, SDL_Keysym::scancode, SDL_BLENDMODE_NONE, SDL_GetKeyName, SDL_GetScancodeName, SDL_INIT_VIDEO, SDL_KEYDOWN, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, SDL_LogError, SDL_LogSetPriority, SDL_PollEvent, SDL_Quit, SDL_RenderClear, SDL_SetRenderDrawBlendMode, SDL_SetRenderDrawColor, SDL_strlcat, SDL_strlen, SDL_TEXTEDITING, SDL_TEXTINPUT, SDLK_BACKSPACE, SDLK_RETURN, SDLTest_CommonArg(), SDLTest_CommonCreateState(), SDLTest_CommonEvent(), SDLTest_CommonInit(), SDLTest_CommonQuit(), SDL_TextEditingEvent::start, SDL_Keysym::sym, text, SDL_TextEditingEvent::text, SDL_TextInputEvent::text, SDL_Event::text, SDL_Event::type, usage(), and SDL_Rect::w.
void Redraw | ( | ) |
Definition at line 195 of file testime.c.
References _Redraw(), i, NULL, SDLTest_CommonState::num_windows, renderer, SDLTest_CommonState::renderers, SDL_RenderClear, SDL_RenderPresent, SDL_SetRenderDrawColor, and SDLTest_CommonState::windows.
Referenced by main().
char* utf8_advance | ( | char * | p, |
size_t | distance | ||
) |
Definition at line 71 of file testime.c.
References i, and utf8_next().
Referenced by _Redraw().
size_t utf8_length | ( | unsigned char | c | ) |
char* utf8_next | ( | char * | p | ) |
Definition at line 55 of file testime.c.
References i, and utf8_length().
Referenced by utf8_advance().
|
static |
Definition at line 34 of file testime.c.
Referenced by _Redraw(), InitInput(), and main().
|
static |
|
static |
Definition at line 34 of file testime.c.
Referenced by _Redraw(), clipboard_testClipboardTextFunctions(), clipboard_testSetClipboardText(), InitInput(), main(), SDL_GetClipboardText(), SDL_LogOutput(), SDL_memset4(), SDL_PrintFloat(), SDL_ScanFloat(), SDL_ScanLong(), SDL_ScanLongLong(), SDL_ScanUintPtrT(), SDL_ScanUnsignedLong(), SDL_ScanUnsignedLongLong(), SDL_sscanf(), SDL_vsnprintf(), SDL_vsscanf(), SDLTest_CommonEvent(), stdlib_getsetenv(), stdlib_snprintf(), and stdlib_strlcpy().
|
static |
Definition at line 30 of file testime.c.
Referenced by InitInput().