69 Commits

Author SHA1 Message Date
Andreas Löf
358bd1235f Remove SDL1.2 code
This removes all legacy SDL1.2 code. It was done by invoking:
coan source --replace --no-transients -D"SDL_VERSION_ATLEAST(X, Y, Z)"=1 <file>
on each file.
2016-03-13 11:34:34 +13:00
Chris Beck
ba51524f6e update copyright to year 2016
using this shell script:

find src -type f -print0 | xargs -0 sed -i "s|Copyright (C) \([[:digit:]]*\)\([ ]*\)-\([ ]*\)2015|Copyright (C) \1\2-\32016|g"
2016-01-02 23:59:31 -05:00
Andreas Löf
aae2ad77e6 Make the game compile with SDL2.
This does the bare minimum to get the game compiling and running again with SDL 2. It fixes all of the compile errors, adds a missing seek operation to the SDL_RWops. The missing seek operation caused a NULL pointer dereference during game start.
2015-08-02 22:09:02 +12:00
Ignacio R. Morelle
4265527a90 ttext: Add support for selecting monospace font family
This selects DejaVu Sans Mono instead of whatever sans serif font is the
default for the current locale is. I'm not entirely sure what to do to
handle non-Western European languages since this is intended to be used
for displaying code or debug info anyway.

Because I can't be bothered to figure out how the codepoint fallback
works for GUI1, I'm only adding support for using this with the
Pango/Cairo ttext wrapper, which is used by GUI2. I'm also leaving it up
to fontconfig to find the correct font file for the font when selected.
Hopefully this will suffice for now.
2015-05-30 20:30:06 -03:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
gfgtdf
7e2f0e6c37 fix some includes 2014-10-23 01:15:23 +02:00
Chris Beck
5f3dbe1d98 add link_color property of label defn, passed to font::ttext
This commit permits link_color to be specified in any label defn,
at the same place that link_aware is specified. It will be passed
through to tcanvas and finally font::ttext in a similar manner as
link awareness, and used for the color parameter in any link
formatting. We choose a default value of #ffff00 everywhere,
matching the definition currently in the help browser for cross-
references.
2014-10-18 21:02:28 -04:00
Chris Beck
854688b397 add "link awareness" to font::ttext objects
If link awareness is enabled, then tokens that look like links
will be rendered thusly, and a "get_link" function is provided
to check if a layout location is pointing to a token which was
rendered as a link.
2014-10-18 20:56:35 -04:00
Chris Beck
1dd26fb696 replace "get_string_index" with "get_token"
The get_token function, for a font::ttext, takes a coordinate
position and a list of delimiter characters, and returns the token
pointed to, if the position is in bounds, and the character being
pointed at is not itself a delimiter. Otherwise it returns the
empty string.

We also add some debugging output to the label click handler,
so that on log channel gui/event, we can see example tokens and
whether they look like URLs.
2014-10-18 20:56:34 -04:00
Chris Beck
b4f559dad0 add to font::ttext an interface to pango fcn xy_to_index
This is used implicitly in the "get_column_line" function but
sometimes you just want the index, for instance, if you want to
resolve whether a link was clicked on.
2014-10-18 20:56:33 -04:00
Boldizsár Lipka
f463cf32da SDL_Color-parametered overload for ttext::set_foreground_color. 2014-07-22 18:53:35 +02:00
Boldizsár Lipka
1a7873e5aa Move sdl/texture.?pp to sdl/image.?pp. 2014-07-17 21:47:04 +02:00
Boldizsár Lipka
7d3535645f Rename ttexture to timage. 2014-07-17 21:47:04 +02:00
Boldizsár Lipka
b16ded3527 Remove SDL2 code. 2014-07-03 21:37:57 +02:00
Boldizsár Lipka
dde5c00d08 SDL_gpu implementation for ttext::render_as_texture. 2014-07-03 21:37:00 +02:00
Boldizsár Lipka
c59414b121 Enable rendering text as a texture. 2014-06-17 18:49:42 +02:00
Boldizsár Lipka
7ca6ad8ad1 Move sdl_utils to sdl/utils. 2014-06-03 10:30:12 +02:00
Mark de Wever
3a36b5288d Update some Doxygen comment. 2014-05-09 19:46:03 +02:00
Alexander van Gessel
1aad7f9d45 Move unicode support to its own file 2014-03-24 00:24:21 +01:00
Alexander van Gessel
6b5f357b6e Follow up the utf8 namespace with ucs4 and utf16 namespaces 2014-03-23 04:24:02 +01:00
Alexander van Gessel
6318b37ffd Get rid of utils::wide_string
utils::wide_string was a std::vector<wchar_t>
On most unix systems, this is 32 bits wide, and therefore a UCS-4 encoding.
On windows however, wchar_t is 16 bits wide, and the naive approach results
in UCS-2, which can only represent the Basic Multilingual Plane.

Most functions that used wide_string have been moved over to ucs4_string.
The Win32 API has been moved over to a specially created utf16_string instead.

Specialty tolower #ifdefs have been removed, as the towlower function has
been available since OS X 10.3, OpenBSD 3.7 and probably ancient versions of
all other BSDs too. The only issue is that on windows, the function cannot
be applied to characters outside the BMP.
2014-03-23 01:56:40 +01:00
Mark de Wever
3b1ce3bb72 Fix a Doxygen style issue.
The issue was found by Clang 3.4.
2014-01-05 16:39:21 +01:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
Ignacio R. Morelle
444b7eafe0 Doxygen comment fixes 2013-08-17 23:53:21 -04:00
fendrin
fa86e2e350 Fix some wrong spelling, mostly in comments. 2013-06-23 17:18:49 +02:00
Mark de Wever
34c2cd503f Remove a default argument.
Bug #17220 was probably a side effect of the default argument of
ttext::set_maximum_height. So make the argument mandatory and change all
current callers to the old default value.
2013-03-31 21:14:05 +02:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
Mark de Wever
73e640b6d3 Adds character limit width constrain for a text.
The number of characters per line can now be limited for a text object.
The limit is an approximation since the character width for a true type
font is not fixed. When this constrain is used, the text should also be
allowed to wrap.
2012-04-30 19:37:20 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Mark de Wever
caa19a0dc4 Try to recover from broken pango-markup.
Espreon noticed an ampersand in a campaign description breaks the
description markup. Now try to recover from unescaped ampersands. The
rest of the broken markup remains broken (pango seems to handle
unescaped single quotes and double quotes properly).
2011-11-14 20:37:16 +00:00
Mark de Wever
220603b50f Disable pango formatting of unit names.
Since the markup is used it does so by escaping the markup characters in
the unit name. (Fixes bug #17788).
2011-10-23 17:49:04 +00:00
Mark de Wever
ecbabea838 New year copyright update. 2011-01-01 15:57:50 +00:00
Ignacio R. Morelle
d6a3de1938 Apply patch #2213 by stikonas, using file #11274 2010-11-21 01:56:29 +00:00
Guillaume Melquiond
eeb047de55 Fixed file headers so that they match the content of the COPYING file. 2010-09-01 21:12:38 +00:00
Ali El Gariani
51ab72860e Replace all uses of 'colour' by 'color' in code. 2010-06-03 01:47:06 +00:00
Mark de Wever
36df36fbe0 Fix a comment typo 2010-03-29 08:32:55 +00:00
Mark de Wever
ee92e1f733 Minor coding style fixes. 2010-03-07 18:43:15 +00:00
Guillaume Melquiond
abb460b61c Added support for text alignment. 2010-02-20 22:39:41 +00:00
Mark de Wever
92f5f92ce5 New year copyright update. 2010-01-01 13:16:49 +00:00
Guillaume Melquiond
4d031eab2b Made it possible to separately set height and multiline behavior. 2009-10-04 20:15:01 +00:00
Guillaume Melquiond
520df2339f Removed useless dependency. 2009-09-12 13:50:17 +00:00
Mark de Wever
671b0b256c Strip trailing whitespace. 2009-08-29 18:46:38 +00:00
Mark de Wever
6dc6ebd51d Fix the "crashing" upon invalid pango markup.
Fixes bug #13602.
2009-08-04 16:27:31 +00:00
Mark de Wever
7a368de056 Remove the old copy policy code.
The ttext is no longer copyable and it's no longer needed, so remove
that option.
2009-04-25 20:46:26 +00:00
Mark de Wever
722804d26f Remove unused clone function. 2009-04-25 20:46:19 +00:00
Mark de Wever
9d050e7df7 Updated a copyright statement.
It seems the old statement was copy-pasted from the boilerplate.
2009-02-14 13:00:54 +00:00
Mark de Wever
973a0a7d5c Remove trailing whitespace. 2009-01-01 10:28:26 +00:00
Mark de Wever
a5d1d2e969 New year copyright update. 2009-01-01 10:27:41 +00:00
Mark de Wever
31b55472f1 Make the class not copyable.
Now that widgets are not copyable, there's no need to have the ttext
class copyable. It might cause some problems, but those haven't been
confirmed yet.
2008-12-25 14:52:05 +00:00