1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - osd.h *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2008 Nmn, Ebenblues *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 #include "main/list.h"
26 #include "osal/preproc.h"
28 /******************************************************************
31 \ __|__/ | Offset always effects the same:
32 | | | +X = Leftward +Y = Upward
33 3-| 4 |-5 | With no offset, the text will touch the border.
37 *******************************************************************/
39 OSD_TOP_LEFT, // 0 in the picture above
40 OSD_TOP_CENTER, // 1 in the picture above
41 OSD_TOP_RIGHT, // 2 in the picture above
43 OSD_MIDDLE_LEFT, // 3 in the picture above
44 OSD_MIDDLE_CENTER, // 4 in the picture above
45 OSD_MIDDLE_RIGHT, // 5 in the picture above
47 OSD_BOTTOM_LEFT, // 6 in the picture above
48 OSD_BOTTOM_CENTER, // 7 in the picture above
49 OSD_BOTTOM_RIGHT, // 8 in the picture above
54 enum osd_message_state {
55 OSD_APPEAR, // OSD message is appearing on the screen
56 OSD_DISPLAY, // OSD message is being displayed on the screen
57 OSD_DISAPPEAR, // OSD message is disappearing from the screen
62 enum osd_animation_type {
70 char *text; // Text that this object will have when displayed
71 enum osd_corner corner; // One of the 9 corners
72 float xoffset; // Relative X position
73 float yoffset; // Relative Y position
74 float color[3]; // Red, Green, Blue values
75 float sizebox[4]; // bounding box (xmin, ymin, xmax, ymax)
76 int state; // display state of current message
77 enum osd_animation_type animation[OSD_NUM_STATES]; // animations for each display state
78 unsigned int timeout[OSD_NUM_STATES]; // timeouts for each display state
79 #define OSD_INFINITE_TIMEOUT 0xffffffff
80 unsigned int frames; // number of frames in this state
81 int user_managed; // structure managed by caller and not to be freed by us
82 struct list_head list;
85 enum { R, G, B }; // for referencing color array
93 void osd_init(int width, int height);
95 void osd_render(void);
96 osd_message_t * osd_new_message(enum osd_corner, const char *, ...);
97 void osd_update_message(osd_message_t *, const char *, ...);
98 void osd_delete_message(osd_message_t *);
99 void osd_message_set_static(osd_message_t *);
100 void osd_message_set_user_managed(osd_message_t *);
104 static osal_inline void osd_init(int width, int height)
108 static osal_inline void osd_exit(void)
112 static osal_inline void osd_render(void)
116 static osal_inline osd_message_t * osd_new_message(enum osd_corner eCorner, const char *fmt, ...)
121 static osal_inline void osd_update_message(osd_message_t *msg, const char *fmt, ...)
125 static osal_inline void osd_delete_message(osd_message_t *msg)
129 static osal_inline void osd_message_set_static(osd_message_t *msg)
133 static osal_inline void osd_message_set_user_managed(osd_message_t *msg)