From edde105b049c15d3aae50494b49d2f224dc358dc Mon Sep 17 00:00:00 2001 From: ennewalker Date: Sat, 27 Sep 2008 04:08:39 +0000 Subject: Adding a tile_repeat_key option (on by default) that determines whether to repeat key input when a key is held down. (Also, some doc update from the previous submission.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7036 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tilesdl.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/tilesdl.cc') diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index fdb888cf17..886d59f8f1 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -126,7 +126,7 @@ bool TilesFramework::initialise() { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - printf ("Failed to initialise SDL: %s\n", SDL_GetError()); + printf("Failed to initialise SDL: %s\n", SDL_GetError()); return false; } @@ -136,7 +136,7 @@ bool TilesFramework::initialise() SDL_Surface *icon = IMG_Load("dat/tiles/stone_soup_icon-32x32.png"); if (!icon) { - printf ("Failed to load icon: %s\n", SDL_GetError()); + printf("Failed to load icon: %s\n", SDL_GetError()); return false; } SDL_WM_SetIcon(icon, NULL); @@ -147,6 +147,14 @@ bool TilesFramework::initialise() SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); + + if (Options.tile_key_repeat) + { + int delay = SDL_DEFAULT_REPEAT_DELAY; + int interval = SDL_DEFAULT_REPEAT_INTERVAL; + if (SDL_EnableKeyRepeat(delay, interval) != 0) + printf("Failed to set key repeat mode: %s\n", SDL_GetError()); + } unsigned int flags = SDL_OPENGL; if (Options.tile_full_screen) @@ -158,7 +166,7 @@ bool TilesFramework::initialise() m_context = SDL_SetVideoMode(m_windowsz.x, m_windowsz.y, 0, flags); if (!m_context) { - printf ("Failed to set video mode: %s\n", SDL_GetError()); + printf("Failed to set video mode: %s\n", SDL_GetError()); return false; } -- cgit v1.2.3-54-g00ecf