1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/**
* @file
* @brief Misc function used to render the dungeon.
**/
#pragma once
#include <vector>
#include "defines.h"
#include "options.h"
#include "player.h" // player_stealth()
#include "seen-context-type.h"
#include "viewgeom.h"
using std::vector;
string screenshot();
colour_t viewmap_flash_colour();
bool view_update();
void view_update_at(const coord_def &pos);
void redraw_view_at(coord_def pos);
class targeter;
static inline void scaled_delay(unsigned int ms)
{
delay(ms * Options.view_delay / DEFAULT_VIEW_DELAY);
}
void animation_delay(unsigned int ms, bool do_refresh);
void flash_view(use_animation_type a, colour_t colour,
targeter *where = nullptr);
void flash_view_delay(use_animation_type a, colour_t colour, int delay,
targeter *where = nullptr);
enum animation_type
{
ANIMATION_SHAKE_VIEWPORT,
ANIMATION_BANISH,
ANIMATION_ORB,
NUM_ANIMATIONS
};
class animation
{
public:
animation(): frames(10), frame_delay(50) { }
virtual ~animation() { }
virtual void init_frame(int frame)
{
UNUSED(frame);
}
virtual coord_def cell_cb(const coord_def &pos, int &colour) = 0;
int frames;
int frame_delay;
};
/**
* A crawl_view_buffer renderer callback that can be injected into
* viewwindow(), allowing the addition of new visual elements without
* adding code directly to viewwindow() itself.
*/
class view_renderer
{
public:
view_renderer() {}
virtual ~view_renderer() {}
virtual void render(crawl_view_buffer &vbuf) = 0;
};
#ifdef USE_TILE
void view_add_tile_overlay(const coord_def &gc, tileidx_t tile);
#endif
void view_add_glyph_overlay(const coord_def &gc, cglyph_t glyph);
void flash_tile(coord_def p, colour_t colour = WHITE, int delay = 50,
tileidx_t tile = 0);
void draw_ring_animation(const coord_def& center, int radius, colour_t colour,
colour_t colour_alt = BLACK, bool outward = false,
int delay = 50, tileidx_t tile = 0);
void view_clear_overlays();
void run_animation(animation_type anim, use_animation_type type,
bool cleanup = true);
void viewwindow(bool show_updates = true, bool tiles_only = false,
animation *a = nullptr, view_renderer *renderer = nullptr);
void draw_cell(screen_cell_t *cell, const coord_def &gc,
bool anim_updates, int flash_colour);
void toggle_show_terrain();
void reset_show_terrain();
void handle_terminal_resize();
|