Pārlūkot izejas kodu

update version number

Sean Barrett 11 gadi atpakaļ
vecāks
revīzija
d4d046be09
3 mainītis faili ar 8 papildinājumiem un 5 dzēšanām
  1. 1 1
      README.md
  2. 5 3
      stb_textedit.h
  3. 2 1
      tests/textedit_sample.c

+ 1 - 1
README.md

@@ -10,7 +10,7 @@ library    | lastest version | category | description
 **stb_truetype.h** | 0.8 | graphics | parse, decode, and rasterize characters from truetype fonts
 **stb_image_write.h** | 0.94 | graphics | image writing to disk: PNG, TGA, BMP
 **stretchy_buffer.h** | 1.01 | utility | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
-**stb_textedit.h** | 1.2 | UI | guts of a text editor for games etc implementing them from scratch
+**stb_textedit.h** | 1.3 | UI | guts of a text editor for games etc implementing them from scratch
 **stb_dxt.h** | 1.04 | 3D&nbsp;graphics | Fabian "ryg" Giesen's real-time DXT compressor
 **stb_perlin.h** | 0.2 | 3D&nbsp;graphics | revised Perlin noise (3D input, 1D output)
 **stb_c_lexer.h** | 0.04 | parsing | simplify writing parsers for C-like languages

+ 5 - 3
stb_textedit.h

@@ -1,4 +1,4 @@
-// stb_textedit.h - v1.2  - public domain - Sean Barrett
+// stb_textedit.h - v1.3  - public domain - Sean Barrett
 // Development of this library was sponsored by RAD Game Tools
 //
 // This C header file implements the guts of a multi-line text-editing
@@ -30,6 +30,7 @@
 //
 // VERSION HISTORY
 //
+//   1.3  (2013-06-19) fix mouse clicking to round to nearest char boundary
 //   1.2  (2013-05-27) fix some RAD types that had crept into the new code
 //   1.1  (2013-12-15) move-by-word (requires STB_TEXTEDIT_IS_SPACE )
 //   1.0  (2012-07-26) improve documentation, initial public release
@@ -40,6 +41,7 @@
 // ADDITIONAL CONTRIBUTORS
 //
 //   Ulf Winklemann: move-by-word in 1.1
+//   Scott Graham: mouse selectiom bugfix in 1.3
 //
 // USAGE
 //
@@ -105,8 +107,8 @@
 //    STB_TEXTEDIT_STRINGLEN(obj)       the length of the string (ideally O(1))
 //    STB_TEXTEDIT_LAYOUTROW(&r,obj,n)  returns the results of laying out a line of characters
 //                                        starting from character #n (see discussion below)
-//    STB_TEXTEDIT_GETWIDTH(obj,n,i)    returns the pixel delta from the xpos of the i-1'th
-//                                        character to the i'th char for a line of characters
+//    STB_TEXTEDIT_GETWIDTH(obj,n,i)    returns the pixel delta from the xpos of the i'th character
+//                                        to the xpos of the i+1'th char for a line of characters
 //                                        starting at character #n (i.e. accounts for kerning
 //                                        with previous char)
 //    STB_TEXTEDIT_KEYTOTEXT(k)         maps a keyboard input to an insertable character

+ 2 - 1
tests/textedit_sample.c

@@ -48,7 +48,8 @@ int insert_chars(STB_TEXTEDIT_STRING *str, int pos, STB_TEXTEDIT_CHARTYPE *newte
 
 // define all the #defines needed 
 
-#define KEYDOWN_BIT     0x80000000
+#define KEYDOWN_BIT                    0x80000000
+
 #define STB_TEXTEDIT_STRINGLEN(tc)     ((tc)->stringlen)
 #define STB_TEXTEDIT_LAYOUTROW         layout_func
 #define STB_TEXTEDIT_GETWIDTH(tc,n,i)  (1) // quick hack for monospaced