-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c25962d
commit f1c029d
Showing
34 changed files
with
1,523 additions
and
718 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
set(HEADERS | ||
App.h) | ||
App.h | ||
MainWindow.h) | ||
|
||
set(SOURCE | ||
App.cpp | ||
MainWindow.cpp | ||
main.cpp) | ||
|
||
add_executable(play-glfw ${SOURCE} ${HEADERS}) | ||
target_link_libraries(play-glfw tlApp tlGL GLFW) | ||
target_link_libraries(play-glfw tlGLFWApp) | ||
set_target_properties(play-glfw PROPERTIES FOLDER examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2021-2023 Darby Johnston | ||
// All rights reserved. | ||
|
||
#include "MainWindow.h" | ||
|
||
#include <tlUI/ButtonGroup.h> | ||
#include <tlUI/RowLayout.h> | ||
#include <tlUI/ScrollArea.h> | ||
#include <tlUI/TimelineViewport.h> | ||
#include <tlUI/TimelineWidget.h> | ||
#include <tlUI/ToolButton.h> | ||
|
||
namespace tl | ||
{ | ||
namespace examples | ||
{ | ||
namespace play_glfw | ||
{ | ||
struct MainWindow::Private | ||
{ | ||
std::shared_ptr<ui::TimelineViewport> timelineViewport; | ||
std::shared_ptr<ui::TimelineWidget> timelineWidget; | ||
std::shared_ptr<ui::ButtonGroup> playbackButtonGroup; | ||
std::shared_ptr<ui::RowLayout> layout; | ||
std::shared_ptr<observer::ValueObserver<timeline::Playback> > playbackObserver; | ||
}; | ||
|
||
void MainWindow::_init( | ||
const std::shared_ptr<timeline::TimelinePlayer>& timelinePlayer, | ||
const std::shared_ptr<system::Context>& context) | ||
{ | ||
IWidget::_init("MainWindow", context); | ||
TLRENDER_P(); | ||
|
||
setBackgroundRole(ui::ColorRole::Window); | ||
|
||
p.timelineViewport = ui::TimelineViewport::create(context); | ||
p.timelineViewport->setTimelinePlayers({ timelinePlayer }); | ||
|
||
p.timelineWidget = ui::TimelineWidget::create(context); | ||
p.timelineWidget->setTimelinePlayer(timelinePlayer); | ||
|
||
auto stopButton = ui::ToolButton::create(context); | ||
stopButton->setIcon("PlaybackStop"); | ||
auto forwardButton = ui::ToolButton::create(context); | ||
forwardButton->setIcon("PlaybackForward"); | ||
auto reverseButton = ui::ToolButton::create(context); | ||
reverseButton->setIcon("PlaybackReverse"); | ||
p.playbackButtonGroup = ui::ButtonGroup::create(ui::ButtonGroupType::Radio, context); | ||
p.playbackButtonGroup->addButton(stopButton); | ||
p.playbackButtonGroup->addButton(forwardButton); | ||
p.playbackButtonGroup->addButton(reverseButton); | ||
|
||
p.layout = ui::VerticalLayout::create(context, shared_from_this()); | ||
p.layout->setSpacingRole(ui::SizeRole::None); | ||
p.timelineViewport->setParent(p.layout); | ||
p.timelineWidget->setParent(p.layout); | ||
auto hLayout = ui::HorizontalLayout::create(context, p.layout); | ||
hLayout->setMarginRole(ui::SizeRole::MarginSmall); | ||
hLayout->setSpacingRole(ui::SizeRole::SpacingTool); | ||
reverseButton->setParent(hLayout); | ||
stopButton->setParent(hLayout); | ||
forwardButton->setParent(hLayout); | ||
|
||
p.playbackObserver = observer::ValueObserver<timeline::Playback>::create( | ||
timelinePlayer->observePlayback(), | ||
[this](timeline::Playback value) | ||
{ | ||
_p->playbackButtonGroup->setChecked(static_cast<int>(value), true); | ||
}); | ||
|
||
p.playbackButtonGroup->setCheckedCallback( | ||
[timelinePlayer](int index, bool value) | ||
{ | ||
timelinePlayer->setPlayback(static_cast<timeline::Playback>(index)); | ||
}); | ||
} | ||
|
||
MainWindow::MainWindow() : | ||
_p(new Private) | ||
{} | ||
|
||
MainWindow::~MainWindow() | ||
{} | ||
|
||
std::shared_ptr<MainWindow> MainWindow::create( | ||
const std::shared_ptr<timeline::TimelinePlayer>& timelinePlayer, | ||
const std::shared_ptr<system::Context>& context) | ||
{ | ||
auto out = std::shared_ptr<MainWindow>(new MainWindow); | ||
out->_init(timelinePlayer, context); | ||
return out; | ||
} | ||
|
||
void MainWindow::setGeometry(const math::BBox2i& value) | ||
{ | ||
IWidget::setGeometry(value); | ||
_p->layout->setGeometry(value); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2021-2023 Darby Johnston | ||
// All rights reserved. | ||
|
||
#include <tlUI/IWidget.h> | ||
|
||
#include <tlTimeline/TimelinePlayer.h> | ||
|
||
namespace tl | ||
{ | ||
namespace examples | ||
{ | ||
namespace play_glfw | ||
{ | ||
//! Main window. | ||
class MainWindow : public ui::IWidget | ||
{ | ||
TLRENDER_NON_COPYABLE(MainWindow); | ||
|
||
protected: | ||
void _init( | ||
const std::shared_ptr<timeline::TimelinePlayer>&, | ||
const std::shared_ptr<system::Context>&); | ||
|
||
MainWindow(); | ||
|
||
public: | ||
~MainWindow(); | ||
|
||
static std::shared_ptr<MainWindow> create( | ||
const std::shared_ptr<timeline::TimelinePlayer>&, | ||
const std::shared_ptr<system::Context>&); | ||
|
||
void setGeometry(const math::BBox2i&) override; | ||
|
||
private: | ||
TLRENDER_PRIVATE(); | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.