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

Author Topic: White box on startup  (Read 2060 times)

0 Members and 1 Guest are viewing this topic.

Solluxx

  • Newbie
  • *
  • Posts: 19
    • View Profile
White box on startup
« on: February 09, 2013, 03:39:14 am »
hello, probably something stupid I'm missing with this but I'm sure one of you smart people can help me out. Every time I start-up my game I get a small white box in the upper corner. It is only there for a split second, and one the game goes through a draw cycle it's gone, but it is still off-putting regardless. Basically I have my RenderWindow set to a certain video resolution, then I stretch it in 3X to get a pixel-y look. The white box is the actual video-resolution. Below I have some quick code so you can see what I mean.


#include <SFML/Graphics.hpp>
using namespace std;

int main()
{
    sf::RenderWindow window;
    window.create(sf::VideoMode(320, 240, 32), "test");
    //window.clear(sf::Color::Blue);//Thought I would try and through a clear in a number of points in the code
                                                      //Obviously, it didn't work
    window.setSize(sf::Vector2u(960,720));
    window.setPosition(sf::Vector2i(200,100));
    window.setFramerateLimit(60);
     while (window.isOpen())
     {
         sf::Event event;
         while (window.pollEvent(event))
         {
             if (event.type == sf::Event::Closed)window.close();
         }
     }
    return 0;
}
 

Thx for any quick fixes you may have
-Sam

cire

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Re: White box on startup
« Reply #1 on: February 09, 2013, 06:06:07 am »
You resize the window, but you don't update the drawing area...  Why don't you just create the window the size you want it to begin with?

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window;
    window.create(sf::VideoMode(320, 240, 32), "test");
    window.setSize(sf::Vector2u(960,720));
    window.clear();
    window.display() ;
    // ...
 

Solluxx

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: White box on startup
« Reply #2 on: February 11, 2013, 06:29:58 pm »
Wow....duh. Thanks for the help.