Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd amethyst_context crate #63
Conversation
nchashch
added some commits
Jun 23, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kvark
Jun 23, 2016
Member
Looks good to me. Summoning @ebkalderon , @csherratt , @Aceeri and whoever else interested!
|
Looks good to me. Summoning @ebkalderon , @csherratt , @Aceeri and whoever else interested! |
palodequeso
reviewed
Jun 23, 2016
| + .with_visibility(visibility); | ||
| + | ||
| + match display_config.min_dimensions { | ||
| + Some ((w, h)) => builder = builder.with_dimensions(w, h), |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nchashch
Jun 23, 2016
Member
It is an error, on line 51 display_config.min_dimensions should be display_config.dimensions, thanks for pointing it out!
nchashch
Jun 23, 2016
Member
It is an error, on line 51 display_config.min_dimensions should be display_config.dimensions, thanks for pointing it out!
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
palodequeso
Jun 23, 2016
Contributor
I had one small nit-pick, but I still consider myself a rust beginner, so there may be a really good reason for not doing what I suggested.
|
I had one small nit-pick, but I still consider myself a rust beginner, so there may be a really good reason for not doing what I suggested. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
+1 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
White-Oak
Jun 23, 2016
Contributor
Seems good, but should be kept in mind that there are other than GL contexts :)
|
Seems good, but should be kept in mind that there are other than GL contexts :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
palodequeso
Jun 24, 2016
Contributor
Seems good, but should be kept in mind that there are other than GL contexts :)
Agreed.
Agreed. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Aceeri
Jun 25, 2016
Member
Looks good to me, the GL context problem should probably be handled separately in the amethyst_renderer crate with some sort of Window trait over glutin/glfw/sdl/dx11/metal stuff.
|
Looks good to me, the GL context problem should probably be handled separately in the |
Aceeri
reviewed
Jun 25, 2016
| + .with_multisampling(multisampling) | ||
| + .with_visibility(visibility); | ||
| + | ||
| + match display_config.dimensions { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Aceeri
Jun 25, 2016
Member
Since the None branch never actually does something, I think it might be better to just make this a
if let Some((w, h)) = display_config.dimensions {
builder = builder.with_dimensions(w, h);
}
Aceeri
Jun 25, 2016
•
Member
Since the None branch never actually does something, I think it might be better to just make this a
if let Some((w, h)) = display_config.dimensions {
builder = builder.with_dimensions(w, h);
}
Aceeri
reviewed
Jun 26, 2016
| + struct DisplayConfig { | ||
| + pub title: String = "Amethyst game".to_string(), | ||
| + pub fullscreen: bool = false, | ||
| + pub dimensions: Option<(u32, u32)> = None, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Aceeri
Jun 26, 2016
Member
May want to change this to just (u32, u32) instead of an Option, since otherwise it would be defaulted to None and the window won't know what the default resolution is.
Aceeri
Jun 26, 2016
Member
May want to change this to just (u32, u32) instead of an Option, since otherwise it would be defaulted to None and the window won't know what the default resolution is.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nchashch
Jun 26, 2016
Member
I think it should be an Option for ergonomics reasons. If display_config.dimensions is an Option then it is possible to get a Window in fullscreen with native resolution just by passing null to display_config.dimensions field, and if it is not in fullscreen then it will just default to some arbituary dimensions.
If display_config.dimensions is not an Option then in fullscreen resolution would be set to some hard coded value that doesn't necessarily match the native resolution in case if the proper resolution is not set in the config. Which might be unexpected.
nchashch
Jun 26, 2016
•
Member
I think it should be an Option for ergonomics reasons. If display_config.dimensions is an Option then it is possible to get a Window in fullscreen with native resolution just by passing null to display_config.dimensions field, and if it is not in fullscreen then it will just default to some arbituary dimensions.
If display_config.dimensions is not an Option then in fullscreen resolution would be set to some hard coded value that doesn't necessarily match the native resolution in case if the proper resolution is not set in the config. Which might be unexpected.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Aceeri
Jun 26, 2016
Member
True, forgot that setting dimensions when in exclusive mode might create some problems.
Aceeri
Jun 26, 2016
Member
True, forgot that setting dimensions when in exclusive mode might create some problems.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Looks like everyone is happy. Merging. |
nchashch commentedJun 23, 2016
•
edited
Edited 1 time
-
nchashch
edited Jun 23, 2016 (most recent)
Add
Contextstruct which owns all global resources e.g.Window,RenderingContext,AudioContext,Logger,AssetManager,NetworkManager, etc.Contextis created fromConfig(it is an amethyst_config sturct which holds subconfigs for particular resources) andRc<RefCell<Context>>is passed to every party requiring access to the context (see examples/window.rs).Currently
Contextonly contains aWindowand aRenderingContext(struct containing device, factory, render targets and anamethyst_renderer::Renderer).Potentially it can be used for event handling (passing an
Rc<RefCell<Context>>toApplicationand polling events from it inApplcation::advance_frame).It should close #54