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 - nikosl21

Pages: [1]
1
Window / Re: Sprite not displayed in the correct position
« on: September 05, 2012, 11:15:11 pm »
i finally found some time and installed the new version ( sfml2 ) . Everything seems to work fine !

2
Window / Re: Sprite not displayed in the correct position
« on: August 26, 2012, 03:33:35 pm »
I use sfml 1.6 and ubuntu ... i knew what the code snippet was for but i 'd forgotten to add it ..when i saw the wrong placement of the sprite i added it and the problem was fixed but i don't know why ... A complete and simple example in which the same "problem" appears

int main()
{
        // Create the main rendering window
        sf::RenderWindow main_win;
        main_win.Create(sf::VideoMode(1280,1024, 32), "Example");

        sf::Image s;
        if(s.LoadFromFile("src/images/game_start.png") != true)
                std::cerr<<"could not open image";

        sf::Sprite game_start;
        game_start.SetImage(s);
        game_start.SetPosition(0.f, 0.f);

        sf::Event currentEvent;

        while(main_win.IsOpened())
        {
                while (main_win.GetEvent(currentEvent))
                {
                        if (currentEvent.Type == sf::Event::Closed)
                                main_win.Close();
                }
                main_win.Clear(sf::Color(255,0,0));
                main_win.Draw(game_start);
                main_win.Display();
        }
        return EXIT_SUCCESS;
}
 

3
Window / Sprite not displayed in the correct position
« on: August 26, 2012, 01:48:52 pm »
When i try to draw a sprite placed in (0,0) inside my gameloop , it isn't drawn properly (but few pixels above and out of app window , i can only  see a part of it ) unless i add these lines before calling window.draw(my_sprite)

while (main_window.GetEvent(currentEvent))
         {
            if (currentEvent.Type == sf::Event::Closed)
               game_state=Exiting;
         }

Does anyone know why it might be happening?

Pages: [1]