Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use project path in standalone mode for client’s ressources #10

Open
Ge0 opened this issue Jul 22, 2019 · 3 comments
Open

Use project path in standalone mode for client’s ressources #10

Ge0 opened this issue Jul 22, 2019 · 3 comments

Comments

@Ge0
Copy link
Member

Ge0 commented Jul 22, 2019

Currently, the client fetches all its ressources at the current path (.). Basically, it means that at this current path should reside folders like chipset and maps (for now).

It would be way better to tell the client, when run in standalone mode (no server needed), that the project root would be elsewhere than ..

The current behaviour is explained here: https://github.com/dummymeuporg/dummyclient/blob/master/src/resource_provider.cpp

The ResourceProvider class is responsible for fetching resources.

Here:

ResourceProvider::ResourceProvider()
    : m_localProject(std::string(".")) {}

It is told that the resources shall be fetched in the current directory. So we should parametrize this setting.

There is a drawback according to the current solution though: the ResourceProvider acts as a singleton class, and it is called by a lot of components – widgets, game, and so on.

Its project has to be set by the right component, and should not be modifiable by any other component. That is, it has to be constructed with the right component. At the moment, since it is a singleton instance, its construction is not handled by any of the game component.

What we want is something like:

ResourceProvider::ResourceProvider(const std::string& projectPath)
    : m_localProject(projectPath) {}

I will be thinking about a new design soon. In between, if you have any ideas, shoot them up here.

@Burgito
Copy link
Contributor

Burgito commented Aug 9, 2019

Just to precise that the font "arial.ttf" is also concerned by this problem, thus it needs to be inside the current folder, might be good to see if we can load one default font from the system if we don't find it

@Ge0
Copy link
Member Author

Ge0 commented Aug 9, 2019

You are right! It is a lack of documentation from me.

Actually I don’t want to version such a binary file but I wonder if that’s mandatory.

@Burgito
Copy link
Contributor

Burgito commented Aug 12, 2019

Ok, documentation can be enough, or maybe just a little zip with the essential resources for the project to work ? I don't know if that should be versionned either :/

About the resource provider, considering it will always be necessary at a moment or another, why not instantiate it when we start the client ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants