Path: blob/master/libmupen64plus/mupen64plus-core/src/osd/osd.h
2 views
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1* Mupen64plus - osd.h *2* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *3* Copyright (C) 2008 Nmn, Ebenblues *4* *5* This program is free software; you can redistribute it and/or modify *6* it under the terms of the GNU General Public License as published by *7* the Free Software Foundation; either version 2 of the License, or *8* (at your option) any later version. *9* *10* This program is distributed in the hope that it will be useful, *11* but WITHOUT ANY WARRANTY; without even the implied warranty of *12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *13* GNU General Public License for more details. *14* *15* You should have received a copy of the GNU General Public License *16* along with this program; if not, write to the *17* Free Software Foundation, Inc., *18* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *19* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */2021#ifndef __OSD_H__22#define __OSD_H__2324#include "main/list.h"25#include "osal/preproc.h"2627/******************************************************************28osd_corner290 1 2 |30\ __|__/ | Offset always effects the same:31| | | +X = Leftward +Y = Upward323-| 4 |-5 | With no offset, the text will touch the border.33|_____| |34/ | \ |356 7 8 |36*******************************************************************/37enum osd_corner {38OSD_TOP_LEFT, // 0 in the picture above39OSD_TOP_CENTER, // 1 in the picture above40OSD_TOP_RIGHT, // 2 in the picture above4142OSD_MIDDLE_LEFT, // 3 in the picture above43OSD_MIDDLE_CENTER, // 4 in the picture above44OSD_MIDDLE_RIGHT, // 5 in the picture above4546OSD_BOTTOM_LEFT, // 6 in the picture above47OSD_BOTTOM_CENTER, // 7 in the picture above48OSD_BOTTOM_RIGHT, // 8 in the picture above4950OSD_NUM_CORNERS51};5253enum osd_message_state {54OSD_APPEAR, // OSD message is appearing on the screen55OSD_DISPLAY, // OSD message is being displayed on the screen56OSD_DISAPPEAR, // OSD message is disappearing from the screen5758OSD_NUM_STATES59};6061enum osd_animation_type {62OSD_NONE,63OSD_FADE,6465OSD_NUM_ANIM_TYPES66};6768typedef struct {69char *text; // Text that this object will have when displayed70enum osd_corner corner; // One of the 9 corners71float xoffset; // Relative X position72float yoffset; // Relative Y position73float color[3]; // Red, Green, Blue values74float sizebox[4]; // bounding box (xmin, ymin, xmax, ymax)75int state; // display state of current message76enum osd_animation_type animation[OSD_NUM_STATES]; // animations for each display state77unsigned int timeout[OSD_NUM_STATES]; // timeouts for each display state78#define OSD_INFINITE_TIMEOUT 0xffffffff79unsigned int frames; // number of frames in this state80int user_managed; // structure managed by caller and not to be freed by us81struct list_head list;82} osd_message_t;8384enum { R, G, B }; // for referencing color array8586#ifdef __cplusplus87extern "C" {88#endif8990#ifdef M64P_OSD9192void osd_init(int width, int height);93void osd_exit(void);94void osd_render(void);95osd_message_t * osd_new_message(enum osd_corner, const char *, ...);96void osd_update_message(osd_message_t *, const char *, ...);97void osd_delete_message(osd_message_t *);98void osd_message_set_static(osd_message_t *);99void osd_message_set_user_managed(osd_message_t *);100101#else102103static osal_inline void osd_init(int width, int height)104{105}106107static osal_inline void osd_exit(void)108{109}110111static osal_inline void osd_render(void)112{113}114115static osal_inline osd_message_t * osd_new_message(enum osd_corner eCorner, const char *fmt, ...)116{117return NULL;118}119120static osal_inline void osd_update_message(osd_message_t *msg, const char *fmt, ...)121{122}123124static osal_inline void osd_delete_message(osd_message_t *msg)125{126}127128static osal_inline void osd_message_set_static(osd_message_t *msg)129{130}131132static osal_inline void osd_message_set_user_managed(osd_message_t *msg)133{134}135136#endif137138#ifdef __cplusplus139}140#endif141142#endif // __OSD_H__143144145146