///////////////////////////////////////////////////////
| 114 | |
| 115 | //////////////////////////////////////////////////////////// |
| 116 | std::unique_ptr<WindowImpl> WindowImpl::create( |
| 117 | VideoMode mode, |
| 118 | const String& title, |
| 119 | std::uint32_t style, |
| 120 | State state, |
| 121 | const ContextSettings& settings) |
| 122 | { |
| 123 | // Fullscreen style requires some tests |
| 124 | if (state == State::Fullscreen) |
| 125 | { |
| 126 | // Make sure there's not already a fullscreen window (only one is allowed) |
| 127 | if (WindowImplImpl::fullscreenWindow != nullptr) |
| 128 | { |
| 129 | err() << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl; |
| 130 | state = State::Windowed; |
| 131 | } |
| 132 | // Make sure that the chosen video mode is compatible |
| 133 | else if (!mode.isValid()) |
| 134 | { |
| 135 | err() << "The requested video mode is not available, switching to a valid mode" << std::endl; |
| 136 | assert(!VideoMode::getFullscreenModes().empty() && "No video modes available"); |
| 137 | mode = VideoMode::getFullscreenModes()[0]; |
| 138 | err() << " VideoMode: { size: { " << mode.size.x << ", " << mode.size.y |
| 139 | << " }, bitsPerPixel: " << mode.bitsPerPixel << " }" << std::endl; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // Check validity of style according to the underlying platform |
| 144 | #if defined(SFML_SYSTEM_IOS) || defined(SFML_SYSTEM_ANDROID) |
| 145 | if (state == State::Fullscreen) |
| 146 | style &= ~static_cast<std::uint32_t>(Style::Titlebar); |
| 147 | else |
| 148 | style |= Style::Titlebar; |
| 149 | #else |
| 150 | if ((style & Style::Close) || (style & Style::Resize)) |
| 151 | style |= Style::Titlebar; |
| 152 | #endif |
| 153 | |
| 154 | auto windowImpl = std::make_unique<WindowImplType>(mode, title, style, state, settings); |
| 155 | if (state == State::Fullscreen) |
| 156 | WindowImplImpl::fullscreenWindow = windowImpl.get(); |
| 157 | return windowImpl; |
| 158 | } |
| 159 | |
| 160 | |
| 161 | //////////////////////////////////////////////////////////// |