Skip to content

Commit d9985e6

Browse files
committed
stuff
1 parent 3744fe7 commit d9985e6

File tree

5 files changed

+23
-34
lines changed

5 files changed

+23
-34
lines changed

src/ruis/context.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2525

2626
using namespace ruis;
2727

28-
context::context(
29-
utki::shared_ref<ruis::style_provider> style_provider,
30-
utki::shared_ref<ruis::render::renderer> renderer,
31-
utki::shared_ref<ruis::updater> updater,
32-
parameters params
33-
) :
28+
context::context(parameters params) :
3429
post_to_ui_thread_function(std::move(params.post_to_ui_thread_function)),
35-
style_provider(std::move(style_provider)),
36-
renderer(std::move(renderer)),
37-
updater(std::move(updater)),
30+
style_provider(std::move(params.style_provider)),
31+
renderer(std::move(params.renderer)),
32+
updater(std::move(params.updater)),
3833
localization(std::move(params.localization)),
3934
units(std::move(params.units))
4035
{

src/ruis/context.hpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,18 @@ class context : public std::enable_shared_from_this<context>
140140

141141
struct parameters {
142142
std::function<void(std::function<void()>)> post_to_ui_thread_function;
143-
ruis::units units;
143+
utki::shared_ref<ruis::updater> updater;
144+
utki::shared_ref<ruis::render::renderer> renderer;
145+
utki::shared_ref<ruis::style_provider> style_provider;
144146
utki::shared_ref<ruis::localization> localization = utki::make_shared<ruis::localization>();
145-
// TODO: add style_provider field
147+
ruis::units units;
146148
};
147149

148150
/**
149151
* @brief Constructor.
150-
* @param style_provider - style provider to use for this context.
151-
* @param renderer - ruis renderer for this context.
152-
* @param updater - updater to use along with this context.
153152
* @param params - context parameters.
154153
*/
155-
context(
156-
utki::shared_ref<ruis::style_provider> style_provider,
157-
utki::shared_ref<ruis::render::renderer> renderer,
158-
utki::shared_ref<ruis::updater> updater,
159-
parameters params
160-
);
154+
context(parameters params);
161155

162156
context(const context&) = delete;
163157
context& operator=(const context&) = delete;

tests/harness/util/dummy_context.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ utki::shared_ref<ruis::context> make_dummy_context(){
77
auto rendering_context = utki::make_shared<ruis::render::null::context>();
88
auto common_objects = utki::make_shared<ruis::render::renderer::objects>(rendering_context);
99
return utki::make_shared<ruis::context>(
10-
utki::make_shared<ruis::style_provider>(
11-
utki::make_shared<ruis::resource_loader>(
12-
rendering_context,//
13-
common_objects
14-
)
15-
),
16-
utki::make_shared<ruis::render::renderer>(
17-
rendering_context,//
18-
rendering_context.get().make_shaders(),
19-
common_objects
20-
),
21-
utki::make_shared<ruis::updater>(),
2210
ruis::context::parameters{
2311
.post_to_ui_thread_function = [](std::function<void()>){},
12+
.updater = utki::make_shared<ruis::updater>(),
13+
.renderer = utki::make_shared<ruis::render::renderer>(
14+
rendering_context,//
15+
rendering_context.get().make_shaders(),
16+
common_objects
17+
),
18+
.style_provider = utki::make_shared<ruis::style_provider>(
19+
utki::make_shared<ruis::resource_loader>(
20+
rendering_context,//
21+
common_objects
22+
)
23+
),
2424
.units = ruis::units(
2525
ruis::real(96), //
2626
ruis::real(1)

0 commit comments

Comments
 (0)