| 308 | } |
| 309 | |
| 310 | std::optional<Edge> tryLoadEdge() |
| 311 | { |
| 312 | // Create the off-screen surface |
| 313 | sf::RenderTexture surface; |
| 314 | if (!surface.resize({800, 600})) |
| 315 | return std::nullopt; |
| 316 | |
| 317 | surface.setSmooth(true); |
| 318 | |
| 319 | // Load the background texture |
| 320 | sf::Texture backgroundTexture; |
| 321 | if (!backgroundTexture.loadFromFile("resources/sfml.png")) |
| 322 | return std::nullopt; |
| 323 | |
| 324 | backgroundTexture.setSmooth(true); |
| 325 | |
| 326 | // Load the entity texture |
| 327 | sf::Texture entityTexture; |
| 328 | if (!entityTexture.loadFromFile("resources/devices.png")) |
| 329 | return std::nullopt; |
| 330 | |
| 331 | entityTexture.setSmooth(true); |
| 332 | |
| 333 | // Load the shader |
| 334 | sf::Shader shader; |
| 335 | if (!shader.loadFromFile("resources/edge.frag", sf::Shader::Type::Fragment)) |
| 336 | return std::nullopt; |
| 337 | |
| 338 | shader.setUniform("texture", sf::Shader::CurrentTexture); |
| 339 | |
| 340 | return std::make_optional<Edge>(std::move(surface), std::move(backgroundTexture), std::move(entityTexture), std::move(shader)); |
| 341 | } |
| 342 | |
| 343 | std::optional<Geometry> tryLoadGeometry() |
| 344 | { |
no test coverage detected