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

Author Topic: Help to understand why only half of the screen is painted over.  (Read 1112 times)

0 Members and 1 Guest are viewing this topic.

wierdgreencat

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
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();
  }
« Last Edit: September 19, 2022, 01:05:51 pm by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Help to understand why only half of the screen is painted over.
« Reply #1 on: September 19, 2022, 01:06:45 pm »
Is the window actually 64 pixel wide?

Lots of OS/Window Manage will have a minimum size for a window.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wierdgreencat

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Help to understand why only half of the screen is painted over.
« Reply #2 on: September 19, 2022, 02:55:27 pm »
yes you are right the window was 2 times wider. thanks
« Last Edit: September 19, 2022, 03:29:00 pm by wierdgreencat »

 

anything