Storyscreen part user interface. More...
#include <render.hpp>
Public Types | |
enum | RESULT { NEXT, BACK, QUIT } |
Storyscreen result. More... | |
Public Member Functions | |
part_ui (part &p, CVideo &video, gui::button &next_button, gui::button &back_button, gui::button &play_button) | |
Constructor. More... | |
RESULT | show () |
Render and display the storyscreen, process and return user input. More... | |
virtual void | handle_event (const SDL_Event &) |
virtual void | handle_window_event (const SDL_Event &event) |
Public Member Functions inherited from events::sdl_handler | |
virtual void | process_event () |
virtual void | draw () |
virtual void | volatile_draw () |
virtual void | volatile_undraw () |
virtual bool | requires_event_focus (const SDL_Event *=nullptr) const |
virtual void | process_help_string (int, int) |
virtual void | process_tooltip_string (int, int) |
virtual void | join () |
virtual void | join (context &c) |
virtual void | join_same (sdl_handler *parent) |
virtual void | leave () |
virtual void | join_global () |
virtual void | leave_global () |
Private Member Functions | |
void | prepare_background () |
Constructor implementation details. More... | |
void | prepare_geometry () |
Constructor implementation details. More... | |
void | prepare_floating_images () |
Constructor implementation details. More... | |
void | render_background () |
void | render_title_box () |
void | render_story_box () |
void | render_story_box_borders (SDL_Rect &) |
bool | handle_interface () |
Returns true if the user did an action. More... | |
bool | render_floating_images () |
Renders all floating images in sequence. More... | |
void | wait_for_input () |
Private Attributes | |
part & | p_ |
CVideo & | video_ |
CKey | keys_ |
gui::button & | next_button_ |
gui::button & | back_button_ |
gui::button & | play_button_ |
bool | dirty_ |
RESULT | ret_ |
bool | skip_ |
bool | last_key_ |
double | x_scale_factor_ |
double | y_scale_factor_ |
SDL_Rect | base_rect_ |
surface | background_ |
std::vector < floating_image::render_input > | imgs_ |
bool | has_background_ |
int | text_x_ |
int | text_y_ |
int | buttons_x_ |
int | buttons_y_ |
Additional Inherited Members | |
Protected Member Functions inherited from events::sdl_handler | |
sdl_handler (const bool auto_join=true) | |
virtual | ~sdl_handler () |
virtual std::vector < sdl_handler * > | handler_members () |
Storyscreen part user interface.
This works on the assumption, like the old one, that the screen cannot be resized while we are at this. More specifically, it is assumed that the screen dimensions remain constant between the constructor call, and the destruction of the objects.
Definition at line 43 of file render.hpp.
Storyscreen result.
Enumerator | |
---|---|
NEXT |
The user pressed the go-next button. |
BACK |
The user pressed the go-back button. |
QUIT |
The user selected quit. |
Definition at line 47 of file render.hpp.
storyscreen::part_ui::part_ui | ( | part & | p, |
CVideo & | video, | ||
gui::button & | next_button, | ||
gui::button & | back_button, | ||
gui::button & | play_button | ||
) |
Constructor.
p | A storyscreen::part with the required information and parameters. |
disp | Display. |
next_button | Next button. Shouldn't be destroyed before the part_ui object. |
Definition at line 88 of file render.cpp.
|
virtual |
Implements events::sdl_handler.
Definition at line 992 of file render.cpp.
References dirty_, events::sdl_handler::draw(), and DRAW_ALL_EVENT.
|
private |
Returns true if the user did an action.
Modifies ret_, skip_, and last_key_ accordingly.
Definition at line 923 of file render.cpp.
References BACK, back_button_, CVideo::flip(), keys_, last_key_, NEXT, next_button_, play_button_, gui::button::pressed(), events::pump(), QUIT, events::raise_draw_event(), events::raise_process_event(), gui::button::release(), ret_, skip_, and video_.
Referenced by render_floating_images(), render_story_box(), and wait_for_input().
|
virtual |
Implements events::sdl_handler.
Definition at line 1001 of file render.cpp.
References dirty_, prepare_background(), prepare_floating_images(), and prepare_geometry().
|
private |
Constructor implementation details.
Definition at line 118 of file render.cpp.
References ASSERT_LOG, surface::assign(), background_, base_rect_, blit_surface(), create_neutral_surface(), sdl::create_rect(), storyscreen::part::get_background_layers(), image::get_image(), CVideo::getx(), CVideo::gety(), GPU_WRAP_REPEAT, has_background_, make_neutral_surface(), surface::null(), p_, scale_surface(), tile_surface(), video_, x_scale_factor_, and y_scale_factor_.
Referenced by handle_window_event(), and show().
|
private |
Constructor implementation details.
Definition at line 301 of file render.cpp.
References base_rect_, storyscreen::part::get_floating_images(), imgs_, p_, x_scale_factor_, and y_scale_factor_.
Referenced by handle_window_event(), and show().
|
private |
Constructor implementation details.
Definition at line 269 of file render.cpp.
References back_button_, storyscreen::part::BLOCK_MIDDLE, storyscreen::part::BLOCK_TOP, buttons_x_, buttons_y_, CVideo::getx(), CVideo::gety(), next_button_, p_, play_button_, gui::widget::set_location(), storyscreen::part::story_text_location(), text_x_, text_y_, video_, and gui::widget::width().
Referenced by handle_window_event(), and show().
|
private |
Definition at line 309 of file render.cpp.
References background_, sdl::draw_solid_tinted_rectangle(), CVideo::getSurface(), CVideo::getx(), CVideo::gety(), render_title_box(), sdl_blit(), and video_.
Referenced by render_floating_images(), and render_story_box().
|
private |
Renders all floating images in sequence.
Definition at line 320 of file render.cpp.
References CVideo::delay(), storyscreen::floating_image::display_delay(), CVideo::flip(), storyscreen::part::get_floating_images(), CVideo::getSurface(), handle_interface(), i, storyscreen::floating_image::render_input::image, imgs_, last_key_, p_, events::raise_draw_event(), storyscreen::floating_image::render_input::rect, render_background(), sdl_blit(), skip_, update_rect(), and video_.
Referenced by render_story_box().
|
private |
Definition at line 625 of file render.cpp.
References back_button_, CVideo::blit_surface(), storyscreen::part::BLOCK_MIDDLE, storyscreen::part::BLOCK_TOP, buttons_x_, sdl::create_rect(), CVideo::delay(), dirty_, sdl::draw_solid_tinted_rectangle(), ERR_NG, sdl::fill_rect(), CVideo::flip(), CVideo::getSurface(), CVideo::getx(), CVideo::gety(), handle_interface(), gui::widget::hide(), imgs_, last_key_, LOG_NG, next_button_, surface::null(), p_, play_button_, font::ttext::render(), render_background(), render_floating_images(), render_story_box_borders(), render_title_box(), screen_area(), font::ttext::set_font_size(), font::ttext::set_font_style(), font::ttext::set_foreground_color(), font::ttext::set_maximum_height(), font::ttext::set_maximum_width(), font::ttext::set_text(), storyscreen::part::show_title(), skip_, storyscreen::part::story_text_location(), font::ttext::STYLE_NORMAL, storyscreen::part::text(), text_x_, text_y_, update_rect(), video_, and wait_for_input().
Referenced by show().
|
private |
Definition at line 537 of file render.cpp.
References CVideo::blit_surface(), storyscreen::part::BLOCK_BOTTOM, storyscreen::part::BLOCK_MIDDLE, storyscreen::part::BLOCK_TOP, image::get_image(), has_background_, surface::null(), p_, scale_surface(), screen_area(), storyscreen::part::story_text_location(), video_, and WARN_NG.
Referenced by render_story_box().
|
private |
Definition at line 388 of file render.cpp.
References back_button_, base_rect_, CVideo::blit_surface(), sdl::create_rect(), sdl::draw_solid_tinted_rectangle(), ERR_NG, sdl::fill_rect(), CVideo::getSurface(), gui::widget::hide(), next_button_, surface::null(), p_, play_button_, font::ttext::render(), font::ttext::set_font_size(), font::ttext::set_font_style(), font::ttext::set_foreground_color(), font::ttext::set_maximum_height(), font::ttext::set_maximum_width(), font::ttext::set_text(), font::ttext::STYLE_NORMAL, storyscreen::part::TEXT_CENTERED, storyscreen::part::TEXT_RIGHT, storyscreen::part::title(), storyscreen::part::title_text_alignment(), update_rect(), and video_.
Referenced by render_background(), and render_story_box().
part_ui::RESULT storyscreen::part_ui::show | ( | ) |
Render and display the storyscreen, process and return user input.
Definition at line 965 of file render.cpp.
References ERR_NG, events::sdl_handler::join(), events::sdl_handler::leave(), storyscreen::part::music(), p_, sound::play_music_repeatedly(), sound::play_sound(), prepare_background(), prepare_floating_images(), prepare_geometry(), render_story_box(), ret_, and storyscreen::part::sound().
Referenced by storyscreen::controller::show().
|
private |
Definition at line 912 of file render.cpp.
References CVideo::delay(), handle_interface(), last_key_, LOG_NG, and skip_.
Referenced by render_story_box().
|
private |
Definition at line 77 of file render.hpp.
Referenced by handle_interface(), prepare_geometry(), render_story_box(), and render_title_box().
|
private |
Definition at line 96 of file render.hpp.
Referenced by prepare_background(), and render_background().
|
private |
Definition at line 90 of file render.hpp.
Referenced by prepare_background(), prepare_floating_images(), and render_title_box().
|
private |
Definition at line 101 of file render.hpp.
Referenced by prepare_geometry(), and render_story_box().
|
private |
Definition at line 101 of file render.hpp.
Referenced by prepare_geometry().
|
private |
Definition at line 80 of file render.hpp.
Referenced by handle_event(), handle_window_event(), and render_story_box().
|
private |
Definition at line 99 of file render.hpp.
Referenced by prepare_background(), and render_story_box_borders().
|
private |
Definition at line 98 of file render.hpp.
Referenced by prepare_floating_images(), render_floating_images(), and render_story_box().
|
private |
Definition at line 74 of file render.hpp.
Referenced by handle_interface().
|
private |
Definition at line 83 of file render.hpp.
Referenced by handle_interface(), render_floating_images(), render_story_box(), and wait_for_input().
|
private |
Definition at line 76 of file render.hpp.
Referenced by handle_interface(), prepare_geometry(), render_story_box(), and render_title_box().
|
private |
Definition at line 72 of file render.hpp.
Referenced by prepare_background(), prepare_floating_images(), prepare_geometry(), render_floating_images(), render_story_box(), render_story_box_borders(), render_title_box(), and show().
|
private |
Definition at line 78 of file render.hpp.
Referenced by handle_interface(), prepare_geometry(), render_story_box(), and render_title_box().
|
private |
Definition at line 82 of file render.hpp.
Referenced by handle_interface(), and show().
|
private |
Definition at line 83 of file render.hpp.
Referenced by handle_interface(), render_floating_images(), render_story_box(), and wait_for_input().
|
private |
Definition at line 101 of file render.hpp.
Referenced by prepare_geometry(), and render_story_box().
|
private |
Definition at line 101 of file render.hpp.
Referenced by prepare_geometry(), and render_story_box().
|
private |
Definition at line 73 of file render.hpp.
Referenced by handle_interface(), prepare_background(), prepare_geometry(), render_background(), render_floating_images(), render_story_box(), render_story_box_borders(), and render_title_box().
|
private |
Definition at line 85 of file render.hpp.
Referenced by prepare_background(), and prepare_floating_images().
|
private |
Definition at line 86 of file render.hpp.
Referenced by prepare_background(), and prepare_floating_images().