Xemu [doxygen]  hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
osd.h
Go to the documentation of this file.
1 /* Xemu - emulation (running on Linux/Unix/Windows/OSX, utilizing
2  SDL2) of some 8 bit machines, including the Commodore LCD and Commodore 65
3  and MEGA65 as well.
4  Copyright (C)2016-2022 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
5 
6  The goal of emutools.c is to provide a relative simple solution
7  for relative simple emulators using SDL2.
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
22 
23 
24 extern int osd_status;
25 extern void (*osd_update_callback)(void);
26 extern int osd_notifications_enabled;
27 #ifdef XEMU_OSD_EXPORT_FONT
28 extern const Uint16 font_16x16[];
29 #endif
30 
31 extern int osd_init ( int xsize, int ysize, const Uint8 *palette, int palette_entries, int fade_dec, int fade_end );
32 extern int osd_init_with_defaults ( void );
33 extern void osd_clear ( void );
34 extern void osd_clear_with_colour ( const int index );
35 extern void osd_texture_update ( const SDL_Rect *rect );
36 extern void osd_on ( int value );
37 extern void osd_off ( void );
38 extern void osd_global_enable ( int status );
39 extern void osd_set_colours ( int fg_index, int bg_index );
40 extern void osd_write_char ( int x, int y, char ch );
41 extern void osd_write_string ( int x, int y, const char *s );
42 extern void osd_hijack ( void(*updater)(void), int *xsize_ptr, int *ysize_ptr, Uint32 **pixel_ptr );
43 
44 #define OSD_STATIC 0x1000
45 #define OSD_FADE_START 300
46 #define OSD_FADE_DEC_VAL 5
47 #define OSD_FADE_END_VAL 0x20
48 
49 #define OSD_TEXTURE_X_SIZE 640
50 #define OSD_TEXTURE_Y_SIZE 200
51 
52 
53 #define OSD(x, y, ...) do { \
54  if (osd_notifications_enabled) { \
55  char _buf_for_msg_[4096]; \
56  CHECK_SNPRINTF(snprintf(_buf_for_msg_, sizeof _buf_for_msg_, __VA_ARGS__), sizeof _buf_for_msg_); \
57  fprintf(stderr, "OSD: %s" NL, _buf_for_msg_); \
58  osd_clear(); \
59  osd_write_string(x, y, _buf_for_msg_); \
60  osd_texture_update(NULL); \
61  osd_on(OSD_FADE_START); \
62  } \
63 } while(0)
osd_clear
void osd_clear(void)
Definition: screen.c:72
index
int index
Definition: vera.c:66
osd_global_enable
void osd_global_enable(int status)
Definition: osd.c:166
fade_end
int fade_end
Definition: osd.c:31
osd_texture_update
void osd_texture_update(const SDL_Rect *rect)
Definition: osd.c:87
osd_update_callback
void(* osd_update_callback)(void)
Definition: osd.c:25
fade_dec
int fade_dec
Definition: osd.c:31
osd_on
void osd_on(int value)
Definition: osd.c:149
osd_init
int osd_init(int xsize, int ysize, const Uint8 *palette, int palette_entries, int fade_dec, int fade_end)
Definition: osd.c:96
ysize
int ysize
Definition: osd.c:30
font_16x16
const Uint16 font_16x16[]
Definition: osd_font_16x16.c:1
Uint32
uint32_t Uint32
Definition: fat32.c:49
Uint8
uint8_t Uint8
Definition: fat32.c:51
osd_status
int osd_status
Definition: osd.c:23
osd_set_colours
void osd_set_colours(int fg_index, int bg_index)
Definition: osd.c:175
x
int x
Definition: console.c:27
osd_write_char
void osd_write_char(int x, int y, char ch)
Definition: screen.c:92
osd_clear_with_colour
void osd_clear_with_colour(const int index)
Definition: osd.c:68
osd_notifications_enabled
int osd_notifications_enabled
Definition: osd.c:24
osd_hijack
void osd_hijack(void(*updater)(void), int *xsize_ptr, int *ysize_ptr, Uint32 **pixel_ptr)
Definition: osd.c:234
status
enum @26::@29 status
xsize
int xsize
Definition: osd.c:30
osd_off
void osd_off(void)
Definition: osd.c:159
y
int y
Definition: console.c:27
value
int value
Definition: dma65.c:90
Uint16
uint16_t Uint16
Definition: fat32.c:50
osd_write_string
void osd_write_string(int x, int y, const char *s)
Definition: screen.c:109
osd_init_with_defaults
int osd_init_with_defaults(void)
Definition: osd.c:131