|
|
|
|
@ -19,8 +19,14 @@ ControlUI::ControlUI(sf::RenderWindow& presenter, sf::RenderWindow& controller) |
|
|
|
|
{ |
|
|
|
|
$gui.position(0, 0, CONTROL_WIDTH, CONTROL_HEIGHT); |
|
|
|
|
$gui.layout( |
|
|
|
|
"[status|*%(200,100)current|_]" |
|
|
|
|
"[docs|*%(200,100)preview|_]" |
|
|
|
|
"[status|*%(200,400)current|_]" |
|
|
|
|
"[title0|_|_]" |
|
|
|
|
"[title1|_|_]" |
|
|
|
|
"[title2|_|_]" |
|
|
|
|
"[title3|*%(200,400)preview|_]" |
|
|
|
|
"[title4|_|_]" |
|
|
|
|
"[title5|_|_]" |
|
|
|
|
"[help|_|_]" |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -28,8 +34,10 @@ void ControlUI::init() { |
|
|
|
|
auto status_id = $gui.entity("status"); |
|
|
|
|
$gui.set<guecs::Text>(status_id, {L""}); |
|
|
|
|
|
|
|
|
|
auto docs_id = $gui.entity("docs"); |
|
|
|
|
$gui.set<guecs::Text>(docs_id, {L"F: fullscreen\nA: win left\nD: win right\nQ: quit"}); |
|
|
|
|
auto docs_id = $gui.entity("help"); |
|
|
|
|
$gui.set<guecs::Text>(docs_id, { |
|
|
|
|
.content=L"F: fullscreen\nA: win left\nD: win right\nQ: quit", |
|
|
|
|
.size=20}); |
|
|
|
|
|
|
|
|
|
auto current = $gui.entity("current"); |
|
|
|
|
$gui.set<guecs::Rectangle>(current, {}); |
|
|
|
|
@ -43,6 +51,11 @@ void ControlUI::init() { |
|
|
|
|
.color={180, 180, 180, 255} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
for(int i = 0; i < 6; i++) { |
|
|
|
|
auto id = $gui.entity("title", i); |
|
|
|
|
$gui.set<guecs::Rectangle>(id, {.color=guecs::THEME.TRANSPARENT}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$gui.init(); |
|
|
|
|
|
|
|
|
|
// warning! must come after init so the thing is there
|
|
|
|
|
@ -72,6 +85,19 @@ void ControlUI::render(sf::RenderWindow& window, SlideDeck& deck) { |
|
|
|
|
render_slide("preview", deck.slide_at(preview)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ControlUI::full_screen(bool do_it) { |
|
|
|
|
if(do_it) { |
|
|
|
|
$presenter.setSize($window_size); |
|
|
|
|
$presenter.setMouseCursorVisible(false); |
|
|
|
|
} else { |
|
|
|
|
$presenter.setSize({$window_size.x/2, $window_size.y/2}); |
|
|
|
|
$presenter.setMouseCursorVisible(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$full_screen = do_it; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ControlUI::handle_events(std::shared_ptr<SlidesUI> slides, const sf::Event& event) { |
|
|
|
|
dbc::check($status != nullptr, "handle_events called before init?!"); |
|
|
|
|
|
|
|
|
|
@ -97,15 +123,7 @@ void ControlUI::handle_events(std::shared_ptr<SlidesUI> slides, const sf::Event& |
|
|
|
|
$controller.close(); |
|
|
|
|
break; |
|
|
|
|
case KEY::F: |
|
|
|
|
if($full_screen) { |
|
|
|
|
$presenter.setSize({$window_size.x/2, $window_size.y/2}); |
|
|
|
|
$presenter.setMouseCursorVisible(true); |
|
|
|
|
} else { |
|
|
|
|
$presenter.setSize($window_size); |
|
|
|
|
$presenter.setMouseCursorVisible(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$full_screen = !$full_screen; |
|
|
|
|
full_screen(!$full_screen); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
slides->handle_events($controller, event); |
|
|
|
|
|