You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Task::new doesn't expect a Result, but Task::from_gpu does. I'm loading a non-image data file using serde_json; which I figured made sense to put inside a Task.
I'd initially started with Task::new because i don't need a Gpu but it doesn't expect a Result, and neither does Game.load, so I found myself needing to unwrap the Result<(), MyError> during the .map portion of task loading.
I eventually ended up using Task::using_gpu like so
with a custom Error enum providing the Froms for i.e. io::Error, serde_json::Error, and coffee::Error (converting everything into a coffee::Error::IO variant because that seemed like the only potentially relevant category of error.
On a somewhat related note, I have a config file that I'm currently loading twice because it specifies the WindowSettings size, which it's not clear to me how to only load this file during the load Task process. Maybe this doesn't make sense, given that you need an initial display size to display e.g. the progress bar. but at the same time I didn't see a way to programmatically resize the display after load either.
The text was updated successfully, but these errors were encountered:
Yes. I think we should rename the current Task::new to Task::succeed and make it take a Clone type directly. We should probably add a Task::fail too. Elm does it this way.
Thank you for sharing your use case! It helps a lot to improve the engine :D And related to your use case, we will probably have a File::read or a FileSystem abstraction in the near future (maybe with serde integration through a feature?). Now that web support is coming (#63), it will help folks to keep files decoupled from the game environment.
On a somewhat related note, I have a config file that I'm currently loading twice because it specifies the WindowSettings size, which it's not clear to me how to only load this file during the load Task process.
I would personally store the video settings on its own file, separated from the rest of the game settings. However, we probably need a way to pass attributes to Game::load from Game::run. I think it would be a nice addition.
Maybe this doesn't make sense, given that you need an initial display size to display e.g. the progress bar. but at the same time I didn't see a way to programmatically resize the display after load either.
You are right, there is no way to resize the Window programmatically currently. I would like to know some use cases before implementing it! In this particular case, I think initializing the window with the correct size is the way to go.
Task::new
doesn't expect aResult
, butTask::from_gpu
does. I'm loading a non-image data file usingserde_json
; which I figured made sense to put inside aTask
.I'd initially started with
Task::new
because i don't need aGpu
but it doesn't expect aResult
, and neither doesGame.load
, so I found myself needing to unwrap theResult<(), MyError>
during the.map
portion of task loading.I eventually ended up using
Task::using_gpu
like sowith a custom
Error
enum providing theFrom
s for i.e.io::Error
,serde_json::Error
, andcoffee::Error
(converting everything into acoffee::Error::IO
variant because that seemed like the only potentially relevant category of error.On a somewhat related note, I have a config file that I'm currently loading twice because it specifies the
WindowSettings
size, which it's not clear to me how to only load this file during theload
Task process. Maybe this doesn't make sense, given that you need an initial display size to display e.g. the progress bar. but at the same time I didn't see a way to programmatically resize the display after load either.The text was updated successfully, but these errors were encountered: