1 #ifndef _framebuffer__hpp__included__
2 #define _framebuffer__hpp__included__
4 #include "core/window.hpp"
5 #include "library/command.hpp"
6 #include "library/framebuffer.hpp"
7 #include "library/triplebuffer.hpp"
11 class subtitle_commentary
;
13 class emulator_dispatch
;
27 * Emulator frame buffer.
32 emu_framebuffer(subtitle_commentary
& _subtitles
, settingvar::group
& _settings
, memwatch_set
& _mwatch
,
33 keyboard::keyboard
& _keyboard
, emulator_dispatch
& _dispatch
, lua_state
& _lua2
, loaded_rom
& _rom
,
34 status_updater
& _supdater
, command::group
& _cmd
);
36 * The main framebuffer.
38 framebuffer::raw main_framebuffer
;
40 * Special screen: "SYSTEM STATE CORRUPT".
42 static framebuffer::raw screen_corrupt
;
44 * The main screen to draw on.
46 framebuffer::fb
<false> main_screen
;
48 * Initialize special screens.
50 * throws std::bad_alloc: Not enough memory.
52 static void init_special_screens() throw(std::bad_alloc
);
54 * Copy framebuffer to backing store, running Lua hooks if any.
56 void redraw_framebuffer(framebuffer::raw
& torender
, bool no_lua
= false, bool spontaneous
= false);
58 * Redraw the framebuffer, reusing contents from last redraw. Runs lua hooks if last redraw ran them.
60 void redraw_framebuffer();
62 * Return last complete framebuffer.
64 framebuffer::raw
get_framebuffer() throw(std::bad_alloc
);
66 * Render framebuffer to main screen.
68 void render_framebuffer();
70 * Get the size of current framebuffer.
72 std::pair
<uint32_t, uint32_t> get_framebuffer_size();
74 * Take a screenshot to specified file.
76 void take_screenshot(const std::string
& file
) throw(std::bad_alloc
, std::runtime_error
);
78 * Kill pending requests associated with object.
80 void render_kill_request(void* obj
);
82 * Get latest screen received from core.
84 framebuffer::raw
& render_get_latest_screen();
85 void render_get_latest_screen_end();
87 void do_screenshot(command::arg_filename a
);
90 framebuffer::raw fbuf
;
91 framebuffer::queue rq
;
102 triplebuffer::triplebuffer
<render_info
> buffering
;
103 bool last_redraw_no_lua
;
104 subtitle_commentary
& subtitles
;
105 settingvar::group
& settings
;
106 memwatch_set
& mwatch
;
107 keyboard::keyboard
& keyboard
;
108 emulator_dispatch
& edispatch
;
111 status_updater
& supdater
;
113 command::_fnptr
<command::arg_filename
> screenshot
;