cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.28k stars 939 forks source link

MSW: Decoupling App from Platform #2308

Closed richardeakin closed 1 year ago

richardeakin commented 1 year ago

A while back, we refactored app::Platform out of the main App (AppBasic, AppMsw, AppLinux, etc) so that you can use that functionality in an app-less environment. In my case, I'm not even building the cpps for those app classes as I experiment with combining cinder and Diligent Engine (here), and in trying this I see that PlatformMsw still relies on an app in a couple places:

1) getOpenFilePath(), getSaveFilePath() and getFolderPath() methods were relying on AppImplMsw. This is straightforward to fix by moving the implementations to PlatformMsw.cpp 2) PlatformMsw::refreshDisplays() is calling the AppBase signals for when displays change. I'm not yet sure what to do about this, to me it seems like if it requires AppBase than this method should live on the App. Or the signals should be living on the Platform.. open to discussion about this before I proceed.

Lastly, I updated the ImageFileBasic app to build as x64 since we no longer support 32-bit builds on windows.

richardeakin commented 1 year ago

After some discussion, opted to solve 2) by changing PlatformMsw::refreshDisplays() to:

void refreshDisplays( std::vector<DisplayRef> *connectedDisplays, std::vector<DisplayRef> *changedDisplays, std::vector<DisplayRef> *disconnectedDisplays );

Then the AppMswImplBasic calls that and emits any signals back to the app layer on display changes.