Add love.window.getDisplayOrientation and a love.displayrotated callback. Resolves issue #1441.

Note that this tracks screen orientation, rather than device orientation.
This commit is contained in:
Alex Szpakowski
2018-12-17 16:19:56 -04:00
parent 43ee232897
commit d4762b4612
8 changed files with 134 additions and 0 deletions
+26
View File
@@ -74,6 +74,21 @@ std::vector<std::string> Window::getConstants(MessageBoxType)
return messageBoxTypes.getNames();
}
bool Window::getConstant(const char *in, DisplayOrientation &out)
{
return orientations.find(in, out);
}
bool Window::getConstant(DisplayOrientation in, const char *&out)
{
return orientations.find(in, out);
}
std::vector<std::string> Window::getConstants(DisplayOrientation)
{
return orientations.getNames();
}
StringMap<Window::Setting, Window::SETTING_MAX_ENUM>::Entry Window::settingEntries[] =
{
{"fullscreen", SETTING_FULLSCREEN},
@@ -113,5 +128,16 @@ StringMap<Window::MessageBoxType, Window::MESSAGEBOX_MAX_ENUM>::Entry Window::me
StringMap<Window::MessageBoxType, Window::MESSAGEBOX_MAX_ENUM> Window::messageBoxTypes(Window::messageBoxTypeEntries, sizeof(Window::messageBoxTypeEntries));
StringMap<Window::DisplayOrientation, Window::ORIENTATION_MAX_ENUM>::Entry Window::orientationEntries[] =
{
{"unknown", ORIENTATION_UNKNOWN},
{"landscape", ORIENTATION_LANDSCAPE},
{"landscapeflipped", ORIENTATION_LANDSCAPE_FLIPPED},
{"portrait", ORIENTATION_PORTRAIT},
{"portraitflipped", ORIENTATION_PORTRAIT_FLIPPED},
};
StringMap<Window::DisplayOrientation, Window::ORIENTATION_MAX_ENUM> Window::orientations(Window::orientationEntries, sizeof(Window::orientationEntries));
} // window
} // love