1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef AGS_ENGINE_AC_DISPLAY_H
24 #define AGS_ENGINE_AC_DISPLAY_H
25 
26 #include "ags/shared/gui/gui_main.h"
27 
28 namespace AGS3 {
29 
30 using AGS::Shared::GUIMain;
31 
32 // options for 'disp_type' parameter
33 // blocking speech
34 #define DISPLAYTEXT_SPEECH        0
35 // super-blocking message box
36 #define DISPLAYTEXT_MESSAGEBOX    1
37 // regular non-blocking overlay
38 #define DISPLAYTEXT_NORMALOVERLAY 2
39 // also accepts explicit overlay ID >= OVER_CUSTOM
40 
41 int  _display_main(int xx, int yy, int wii, const char *text, int disp_type, int usingfont, int asspch, int isThought, int allowShrink, bool overlayPositionFixed);
42 void _display_at(int xx, int yy, int wii, const char *text, int disp_type, int asspch, int isThought, int allowShrink, bool overlayPositionFixed);
43 // Tests the given string for the voice-over tags and plays cue clip for the given character;
44 // will assign replacement string, which will be blank string if game is in "voice-only" mode
45 // and clip was started, or string cleaned from voice-over tags which is safe to display on screen.
46 // Returns whether voice-over clip was started successfully.
47 bool try_auto_play_speech(const char *text, const char *&replace_text, int charid, bool blocking);
48 bool ShouldAntiAliasText();
49 // Calculates meaningful length of the displayed text
50 int GetTextDisplayLength(const char *text);
51 // Calculates number of game loops for displaying a text on screen
52 int GetTextDisplayTime(const char *text, int canberel = 0);
53 void wouttext_outline(Shared::Bitmap *ds, int xxp, int yyp, int usingfont, color_t text_color, const char *texx);
54 void wouttext_aligned(Shared::Bitmap *ds, int usexp, int yy, int oriwid, int usingfont, color_t text_color, const char *text, HorAlignment align);
55 // TODO: GUI classes located in Common library do not make use of outlining,
56 // need to find a way to make all code use same functions.
57 // Get the maximal height of the given font, with possible outlining in mind
58 int getfontheight_outlined(int font);
59 // Get line spacing for the given font, with possible outlining in mind
60 int getfontspacing_outlined(int font);
61 // Get the distance between bottom one one line and top of the next line (may be negative!)
62 int getfontlinegap(int font);
63 // Gets the total maximal height of the given number of lines printed with the given font
64 int getheightoflines(int font, int numlines);
65 int wgettextwidth_compensate(const char *tex, int font);
66 void do_corner(Shared::Bitmap *ds, int sprn, int xx1, int yy1, int typx, int typy);
67 // Returns the image of a button control on the GUI under given child index
68 int get_but_pic(GUIMain *guo, int indx);
69 void draw_button_background(Shared::Bitmap *ds, int xx1, int yy1, int xx2, int yy2, GUIMain *iep);
70 // Calculate the width that the left and right border of the textwindow
71 // GUI take up
72 int get_textwindow_border_width(int twgui);
73 // get the hegiht of the text window's top border
74 int get_textwindow_top_border_height(int twgui);
75 // draw_text_window: draws the normal or custom text window
76 // create a new bitmap the size of the window before calling, and
77 //   point text_window_ds to it
78 // returns text start x & y pos in parameters
79 // Warning!: draw_text_window() and draw_text_window_and_bar() can create new text_window_ds
80 void draw_text_window(Shared::Bitmap **text_window_ds, bool should_free_ds, int *xins, int *yins, int *xx, int *yy, int *wii, color_t *set_text_color, int ovrheight, int ifnum);
81 void draw_text_window_and_bar(Shared::Bitmap **text_window_ds, bool should_free_ds,
82                               int *xins, int *yins, int *xx, int *yy, int *wii, color_t *set_text_color, int ovrheight = 0, int ifnum = -1);
83 int get_textwindow_padding(int ifnum);
84 
85 } // namespace AGS3
86 
87 #endif
88