summaryrefslogtreecommitdiff
path: root/gfx.h
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-02-21 18:59:54 +0000
committerDarkvater <darkvater@openttd.org>2005-02-21 18:59:54 +0000
commitd865c55007321366d49b9b3d49eb0d61715dfc98 (patch)
treeac473756965e88790f53e13ff4589035499ce9c1 /gfx.h
parent0d8dcacee2dbd1ae639f8851a2847b3806c7da16 (diff)
downloadopenttd-d865c55007321366d49b9b3d49eb0d61715dfc98.tar.xz
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
- Codechange: Introduction of Textbuf struct which not only holds physical data as length but also pixel-constrains (width) and information about the caret - Codechange: Move Clipboard function to OS specific file. Currently only Windows has clipboard actions - Feature: Editboxes, console and exit screen also accept the numeric-enter as a yes - Feature: Navigation through text with cursor keys is possible, as well as arbitrary insertion (also paste) and deletion; both backspace and del keys. Functions DeleteTextBufferChar, InsertTextBufferChar and InsertTextBufferClipboard handle input and deletion. Navigation is done through MoveTextBufferPos. - Fix: OTTD crash when opening 'add server' editbox - CodeChange: fix up some stringwidth calculations in gfx.c. You can get the width in pixels of a character by calling GetCharacterWidth().
Diffstat (limited to 'gfx.h')
-rw-r--r--gfx.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gfx.h b/gfx.h
index 9dcf01296..58cf6dea9 100644
--- a/gfx.h
+++ b/gfx.h
@@ -69,8 +69,10 @@ bool ChangeResInGame(int w, int h);
void ToggleFullScreen(const bool full_screen);
/* gfx.c */
+#define ASCII_LETTERSTART 32
VARDEF int _stringwidth_base;
VARDEF byte _stringwidth_table[0x2A0];
+static inline byte GetCharacterWidth(int key) { return _stringwidth_table[key - ASCII_LETTERSTART];}
VARDEF DrawPixelInfo _screen;
VARDEF DrawPixelInfo *_cur_dpi;