mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-24 10:27:45 +00:00
correct text handling in SDL2
This commit is contained in:
@@ -89,7 +89,7 @@ EX unsigned backcolor = 0;
|
||||
EX unsigned bordcolor = 0;
|
||||
EX unsigned forecolor = 0xFFFFFF;
|
||||
|
||||
int utfsize(char c) {
|
||||
EX int utfsize(char c) {
|
||||
unsigned char cu = c;
|
||||
if(cu < 128) return 1;
|
||||
if(cu < 224) return 2;
|
||||
@@ -97,6 +97,13 @@ int utfsize(char c) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
EX int utfsize_before(const string& s, int pos) {
|
||||
if(!pos) return 0;
|
||||
int npos = pos - 1;
|
||||
while(npos && ((unsigned char)s[npos]) >= 128 && ((unsigned char)s[npos]) < 192) npos--;
|
||||
return pos - npos;
|
||||
}
|
||||
|
||||
EX int get_sightrange() { return getDistLimit() + sightrange_bonus; }
|
||||
|
||||
EX int get_sightrange_ambush() {
|
||||
|
||||
Reference in New Issue
Block a user