projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8c7cf07
)
fixed drawing centered text in envelope style request dialog
author
Holger Schemel
<info@artsoft.org>
Sat, 12 Sep 2015 19:24:13 +0000
(21:24 +0200)
committer
Holger Schemel
<info@artsoft.org>
Sat, 12 Sep 2015 19:24:13 +0000
(21:24 +0200)
src/tools.c
patch
|
blob
|
history
diff --git
a/src/tools.c
b/src/tools.c
index 6597768de6f08e6a9451eef6c81a62b46659ff92..1dc080b22906ea71c5afa4815509c72c52eae037 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-2276,18
+2276,24
@@
void DrawEnvelopeRequest(char *text)
int border_size = request.border_size;
int line_spacing = request.line_spacing;
int line_height = font_height + line_spacing;
int border_size = request.border_size;
int line_spacing = request.line_spacing;
int line_height = font_height + line_spacing;
- int text_width = request.width - 2 * border_size;
- int text_height = request.height - 2 * border_size;
- int line_length = text_width / font_width;
- int max_lines = text_height / line_height;
+ int max_text_width = request.width - 2 * border_size;
+ int max_text_height = request.height - 2 * border_size;
+ int line_length = max_text_width / font_width;
+ int max_lines = max_text_height / line_height;
+ int text_width = line_length * font_width;
int width = request.width;
int height = request.height;
int tile_size = request.step_offset;
int x_steps = width / tile_size;
int y_steps = height / tile_size;
int width = request.width;
int height = request.height;
int tile_size = request.step_offset;
int x_steps = width / tile_size;
int y_steps = height / tile_size;
+ int sx_offset = border_size;
+ int sy_offset = border_size;
int sx, sy;
int i, x, y;
int sx, sy;
int i, x, y;
+ if (request.centered)
+ sx_offset = (request.width - text_width) / 2;
+
if (request.wrap_single_words)
{
char *src_text_ptr, *dst_text_ptr;
if (request.wrap_single_words)
{
char *src_text_ptr, *dst_text_ptr;
@@
-2328,7
+2334,7
@@
void DrawEnvelopeRequest(char *text)
/* force DOOR font inside door area */
game_status = GAME_MODE_PSEUDO_DOOR;
/* force DOOR font inside door area */
game_status = GAME_MODE_PSEUDO_DOOR;
- DrawTextBuffer(sx +
border_size, sy + border_size
, text_final, font_nr,
+ DrawTextBuffer(sx +
sx_offset, sy + sy_offset
, text_final, font_nr,
line_length, -1, max_lines, line_spacing, mask_mode,
request.autowrap, request.centered, FALSE);
line_length, -1, max_lines, line_spacing, mask_mode,
request.autowrap, request.centered, FALSE);