| 105 | } |
| 106 | |
| 107 | SampleApp::SampleApp() : |
| 108 | m_window( sf::VideoMode( { 1024, 768 }, 32 ), "SFGUI test", sf::Style::Default, sf::State::Windowed, sf::ContextSettings{ 16, 0, 0, 2, 1 } ), |
| 109 | m_desktop(), |
| 110 | m_custom_draw_display_list( 0 ), |
| 111 | m_background_texture( sf::Vector2u( 1024, 768 ) ) |
| 112 | { |
| 113 | std::vector<std::uint8_t> pixels( 1024 * 768 * 4 ); |
| 114 | |
| 115 | std::uint8_t pixel_value = 139; |
| 116 | |
| 117 | for( std::size_t index = 0; index < 1024 * 768; ++index ) { |
| 118 | pixel_value = static_cast<std::uint8_t>( pixel_value ^ ( index + 809 ) ); |
| 119 | pixel_value = static_cast<std::uint8_t>( pixel_value << ( index % 11 ) ); |
| 120 | pixel_value = static_cast<std::uint8_t>( pixel_value * 233 ); |
| 121 | |
| 122 | pixels[ index * 4 + 0 ] = static_cast<std::uint8_t>( pixel_value % 16 + 72 ); // R |
| 123 | |
| 124 | pixel_value ^= static_cast<std::uint8_t>( index ); |
| 125 | pixel_value = static_cast<std::uint8_t>( pixel_value * 23 ); |
| 126 | |
| 127 | pixels[ index * 4 + 1 ] = static_cast<std::uint8_t>( pixel_value % 16 + 72 ); // G |
| 128 | |
| 129 | pixel_value ^= static_cast<std::uint8_t>( index ); |
| 130 | pixel_value = static_cast<std::uint8_t>( pixel_value * 193 ); |
| 131 | |
| 132 | pixels[ index * 4 + 2 ] = static_cast<std::uint8_t>( pixel_value % 16 + 72 ); // B |
| 133 | |
| 134 | pixels[ index * 4 + 3 ] = 255; // A |
| 135 | } |
| 136 | |
| 137 | m_background_texture.update( pixels.data() ); |
| 138 | |
| 139 | m_background_sprite.emplace( m_background_texture ); |
| 140 | } |
| 141 | |
| 142 | SampleApp::~SampleApp() { |
| 143 | if( m_custom_draw_display_list ) { |
nothing calls this directly
no outgoing calls
no test coverage detected