| 1 |
|
| 2 |
|
| 3 |
#ifndef ZTERP_SCREEN_H |
| 4 |
#define ZTERP_SCREEN_H |
| 5 |
|
| 6 |
#include <bitset> |
| 7 |
#include <string> |
| 8 |
|
| 9 |
#ifdef ZTERP_GLK |
| 10 |
extern "C" { |
| 11 |
#include <glk.h> |
| 12 |
} |
| 13 |
#endif |
| 14 |
|
| 15 |
#include "iff.h" |
| 16 |
#include "io.h" |
| 17 |
#include "types.h" |
| 18 |
#include "util.h" |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
. |
| 24 |
|
| 25 |
d |
| 26 |
. |
| 27 |
struct Color { |
| 28 |
enum class Mode { ANSI, True } mode; |
| 29 |
uint16_t value; |
| 30 |
|
| 31 |
explicit Color() : mode(Mode::ANSI), value(1) { |
| 32 |
} |
| 33 |
|
| 34 |
Color(Mode mode_, uint16_t value_) : mode(mode_), value(value_) { |
| 35 |
} |
| 36 |
|
| 37 |
uint16_t as_zcolor() const { |
| 38 |
|
| 39 |
if (mode == Mode::True) { |
| 40 |
return 1; |
| 41 |
} |
| 42 |
|
| 43 |
return value; |
| 44 |
} |
| 45 |
}; |
| 46 |
|
| 47 |
void init_screen(bool first_run); |
| 48 |
|
| 49 |
bool create_mainwin(); |
| 50 |
void create_graphicswin(); |
| 51 |
bool create_statuswin(); |
| 52 |
bool create_upperwin(); |
| 53 |
void get_screen_size(unsigned int &width, unsigned int &height); |
| 54 |
void close_upper_window(); |
| 55 |
|
| 56 |
uint32_t screen_convert_color(uint16_t color); |
| 57 |
|
| 58 |
|
| 59 |
using Style = std::bitset<4>; |
| 60 |
|
| 61 |
enum StyleBit { |
| 62 |
STYLE_REVERSE = 0, |
| 63 |
STYLE_BOLD = 1, |
| 64 |
STYLE_ITALIC = 2, |
| 65 |
STYLE_FIXED = 3, |
| 66 |
}; |
| 67 |
|
| 68 |
zprintflike(1, 2) |
| 69 |
void show_message(const char *fmt, ...); |
| 70 |
void screen_print(const std::string &s); |
| 71 |
void screen_putc(uint32_t c); |
| 72 |
zprintflike(1, 2) |
| 73 |
void screen_printf(const char *fmt, ...); |
| 74 |
void screen_puts(const std::string &s); |
| 75 |
void screen_message_prompt(const std::string &message); |
| 76 |
void screen_flush(); |
| 77 |
|
| 78 |
#ifdef ZTERP_GLK |
| 79 |
|
| 80 |
void screen_clean_up_glk_streams(); |
| 81 |
void screen_recover_glk_windows(); |
| 82 |
void screen_recover_glk_streams(); |
| 83 |
|
| 84 |
#ifdef GLK_MODULE_GARGLKTEXT |
| 85 |
void update_color(int which, unsigned long color); |
| 86 |
#endif |
| 87 |
|
| 88 |
#ifdef ZTERP_GLK_BLORB |
| 89 |
void screen_load_scale_info(const std::string &blorb_file); |
| 90 |
#endif |
| 91 |
|
| 92 |
#endif |
| 93 |
|
| 94 |
|
| 95 |
enum : int { |
| 96 |
OSTREAM_SCREEN = 1, |
| 97 |
OSTREAM_TRANSCRIPT = 2, |
| 98 |
OSTREAM_MEMORY = 3, |
| 99 |
OSTREAM_RECORD = 4, |
| 100 |
}; |
| 101 |
|
| 102 |
|
| 103 |
enum : int { |
| 104 |
ISTREAM_KEYBOARD = 0, |
| 105 |
ISTREAM_FILE = 1, |
| 106 |
}; |
| 107 |
|
| 108 |
void screen_set_header_bit(bool set); |
| 109 |
|
| 110 |
bool output_stream(int16_t number, uint16_t table); |
| 111 |
bool input_stream(int which); |
| 112 |
|
| 113 |
int print_handler(uint32_t addr, void (*outc)(uint8_t)); |
| 114 |
void put_char(uint8_t c); |
| 115 |
|
| 116 |
std::string screen_format_time(long hours, long minutes); |
| 117 |
void screen_read_scrn(IO &io, uint32_t size); |
| 118 |
IFF::TypeID screen_write_scrn(IO &io); |
| 119 |
void screen_read_bfhs(IO &io, bool autosave); |
| 120 |
IFF::TypeID screen_write_bfhs(IO &io); |
| 121 |
void screen_read_bfts(IO &io, uint32_t size); |
| 122 |
IFF::TypeID screen_write_bfts(IO &io); |
| 123 |
void screen_save_persistent_transcript(); |
| 124 |
void screen_show_persistent_transcript(); |
| 125 |
|
| 126 |
bool screen_toggle_force_fixed(); |
| 127 |
|
| 128 |
void zoutput_stream(); |
| 129 |
void zinput_stream(); |
| 130 |
void zprint(); |
| 131 |
void znew_line(); |
| 132 |
void zprint_ret(); |
| 133 |
void zerase_window(); |
| 134 |
void zerase_line(); |
| 135 |
void zset_cursor(); |
| 136 |
void zget_cursor(); |
| 137 |
void zset_colour(); |
| 138 |
void zset_true_colour(); |
| 139 |
void zset_text_style(); |
| 140 |
void zset_font(); |
| 141 |
void zprint_table(); |
| 142 |
void zprint_char(); |
| 143 |
void zprint_num(); |
| 144 |
void zprint_addr(); |
| 145 |
void zprint_paddr(); |
| 146 |
void zsplit_window(); |
| 147 |
void zset_window(); |
| 148 |
void zread_char(); |
| 149 |
void zshow_status(); |
| 150 |
void zread(); |
| 151 |
void zprint_unicode(); |
| 152 |
void zcheck_unicode(); |
| 153 |
void zdraw_picture(); |
| 154 |
void zpicture_data(); |
| 155 |
void zget_wind_prop(); |
| 156 |
void zprint_form(); |
| 157 |
void zmake_menu(); |
| 158 |
void zbuffer_screen(); |
| 159 |
|
| 160 |
void zjourney_dial(); |
| 161 |
void zshogun_menu(); |
| 162 |
|
| 163 |
#endif |