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.


Topics - nefx

Pages: [1]
1
Window / How to position the text on (0, 0)?
« on: June 19, 2011, 04:41:46 pm »
I use sfml 2 and I try to center the text in my button. However it seems text has a vertical margin so even if position is (0, 0) it starts at (0,10) or something like that and it doesn't look right.

Here is the example. Any help?
Code: [Select]

#include <iostream>
#include <SFML/Graphics.hpp>

int main()
{
   sf::RenderWindow  window(sf::VideoMode( 800, 600 ), "Test" );
 
   sf::Text     text( "Test!" );  

   window.Clear();

   window.Draw(text );
   
   window.Display();

   system("pause");

   return 0;
}

2
Window / [SFML2] Event Resized
« on: June 17, 2011, 08:22:46 am »
Here is the code from tutorial modified to handle window event resized.
Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");

    // Start main loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.PollEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Resize window : set new size
            if (Event.Type == sf::Event::Resized)
                App.SetSize(Event.Size.Width, Event.Size.Height);
        }

        // Display window on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


Closing the window works fine however if I try to resize it keeps jumping between new and old size - looping in event loop. I don't know if it is my fault or a bug, any help appreciated!

Pages: [1]