mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user