Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - wierdgreencat

Pages: [1]
1
yes you are right the window was 2 times wider. thanks

2
General / Help to understand why only half of the screen is painted over.
« on: September 16, 2022, 01:49:56 pm »
A little more than half the screen is painted over.
but i think it should draw the whole screen.
Windows 10
MINGW W64 9.0
commit/3a3935d00569c5cf3dbd684ab10e54e8480df167

#include <SFML/Graphics.hpp>

int main()
{
  sf::RenderWindow window(sf::VideoMode({64, 32}), "SFML works!");


  sf::Texture texture;
  sf::Sprite sprite;

  if (!texture.create({64,32})) throw "";
  sprite.setTexture(texture);

  while (window.isOpen())
  {
    sf::Event event;
    while (window.pollEvent(event))
    {
      if (event.type == sf::Event::Closed)
        window.close();
    }

    uint32_t sfml_pixel_buffer[32 * 64];
    static int a= 0x00FFAADD;

    for(int i = 0; i < 32*64; ++i){
      sfml_pixel_buffer[i] = a;
    }a+= 0xFFFF;

    texture.update(reinterpret_cast<uint8_t *>(&sfml_pixel_buffer[0]));

    window.clear();
    window.draw(sprite);
    window.display();
  }

Pages: [1]