1 #ifndef _framebuffer__hpp__included__
2 #define _framebuffer__hpp__included__
4 #include "core/window.hpp"
5 #include "core/queue.hpp"
6 #include "library/command.hpp"
7 #include "library/framebuffer.hpp"
8 #include "library/triplebuffer.hpp"
12 class subtitle_commentary
;
14 class emulator_dispatch
;
28 * Emulator frame buffer.
33 emu_framebuffer(subtitle_commentary
& _subtitles
, settingvar::group
& _settings
, memwatch_set
& _mwatch
,
34 keyboard::keyboard
& _keyboard
, emulator_dispatch
& _dispatch
, lua_state
& _lua2
, loaded_rom
& _rom
,
35 status_updater
& _supdater
, command::group
& _cmd
, input_queue
& _iqueue
);
37 * The main framebuffer.
39 framebuffer::raw main_framebuffer
;
41 * Special screen: "SYSTEM STATE CORRUPT".
43 static framebuffer::raw screen_corrupt
;
45 * The main screen to draw on.
47 framebuffer::fb
<false> main_screen
;
49 * Initialize special screens.
51 * throws std::bad_alloc: Not enough memory.
53 static void init_special_screens() throw(std::bad_alloc
);
55 * Copy framebuffer to backing store, running Lua hooks if any.
57 void redraw_framebuffer(framebuffer::raw
& torender
, bool no_lua
= false, bool spontaneous
= false);
59 * Redraw the framebuffer, reusing contents from last redraw. Runs lua hooks if last redraw ran them.
61 void redraw_framebuffer();
63 * Return last complete framebuffer.
65 framebuffer::raw
get_framebuffer() throw(std::bad_alloc
);
67 * Render framebuffer to main screen.
69 void render_framebuffer();
71 * Get the size of current framebuffer.
73 std::pair
<uint32_t, uint32_t> get_framebuffer_size();
75 * Take a screenshot to specified file.
77 void take_screenshot(const std::string
& file
) throw(std::bad_alloc
, std::runtime_error
);
79 * Kill pending requests associated with object.
81 void render_kill_request(void* obj
);
83 * Get latest screen received from core.
85 framebuffer::raw
& render_get_latest_screen();
86 void render_get_latest_screen_end();
88 void do_screenshot(command::arg_filename a
);
91 framebuffer::raw fbuf
;
92 framebuffer::queue rq
;
103 triplebuffer::triplebuffer
<render_info
> buffering
;
104 bool last_redraw_no_lua
;
105 subtitle_commentary
& subtitles
;
106 settingvar::group
& settings
;
107 memwatch_set
& mwatch
;
108 keyboard::keyboard
& keyboard
;
109 emulator_dispatch
& edispatch
;
112 status_updater
& supdater
;
115 command::_fnptr
<command::arg_filename
> screenshot
;