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

Author Topic: SFML 1.3 / nightly builds  (Read 6693 times)

0 Members and 1 Guest are viewing this topic.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
SFML 1.3 / nightly builds
« on: April 03, 2008, 08:04:36 pm »
Hello.

Q1: When should I expect v1.3?

Q2: In case the answer is "in may/june" can somebody please treat me with a nightly build of the latest SVN? I really can't get this thing to work and i really need latest features/bugfixes.

I'm using Windows, and the IDE is CodeBlocks (MinGW).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.3 / nightly builds
« Reply #1 on: April 04, 2008, 03:31:16 am »
Q1: In may / june :D

Q2: I'll try to do it for you. But why don't you just build the dynamic version ?
Laurent Gomila - SFML developer

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
SFML 1.3 / nightly builds
« Reply #2 on: April 04, 2008, 10:20:44 am »
I downloaded TortoiseSVN, checked out the SFML SVN, and then built the whole workspace in Code::Blocks.

It created 5 libraries except sfml-main, which i had to builda separately.

Then i placed the libs and includes in the right place, changed the code of my app to meet the new method names (the sprite class it much altered) and bulit the project.

This is what i got:

C:\SFML\lib\mingw\static\libsfml-graphics.a
(Sprite.o):Sprite.cpp:(.text+0x872)||
undefined reference to `_glBegin@4'|

and much more _gl**** errors. what am I doing wrong?

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
SFML 1.3 / nightly builds
« Reply #3 on: April 04, 2008, 12:27:30 pm »
You seem not to link with the OpenGL libs.

I'm not a big fan of MinGW anyway.
MinGW is imho outdated for windows development (and has some limitations on vista, as far as I can remember).
It is based on the gcc 3.4.x series and those would be even outdated on Linux.
It had a huge boost back in the days when it was one of the best (in terms of standard-compliance and speed) free c++ compilers available for windows.
But the visual c compilers are now even faster, also quite standard compliant, integrate better into windows
and since the Windows SDK is now free to download and use, I recommend using the included vc++ compiler.
I think CodeBlocks supports it as well. Or go with the VisualC++-Express editions.

You will have less problems building sfml after all.:wink:

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
SFML 1.3 / nightly builds
« Reply #4 on: April 04, 2008, 01:33:22 pm »
EDIT: I successfully compiled SFML libs under VC2008. However, when trying to compile any example i had to add the sfml-main library. Besides something is not working in my sample program.

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    // Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800,600,32), "SFML");

    // Load the sprite image from a file
    sf::Image Image;
    if (!Image.LoadFromFile("image.jpg")) return EXIT_FAILURE;

    // Create the sprite
    sf::Sprite Sprite(Image);
    App.Draw(Sprite);
    App.Display();
    (...some idle loop...)


It loads, shows the image, but there is an hourglass instead of a normal cursor. When i click on the image, it disappears and the program freezes.

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
SFML 1.3 / nightly builds
« Reply #5 on: April 04, 2008, 03:24:44 pm »
You need to call App.Display() inside the loop, otherwise no events will be received and the window will not be refreshed.
Just look how this is done in the examples.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
SFML 1.3 / nightly builds
« Reply #6 on: April 04, 2008, 03:30:14 pm »
it was inside the loop, but i simplified it to find the source of the error. There were the key bindings too but the app does not respond (even to ALT+F4) or clicking X.

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
SFML 1.3 / nightly builds
« Reply #7 on: April 04, 2008, 04:08:33 pm »
What happens if you compile and run any of the samples?

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
SFML 1.3 / nightly builds
« Reply #8 on: April 04, 2008, 05:28:20 pm »
I compared the sample and my project, and got it to work by adding this:

Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow App(sf::VideoMode::GetDesktopMode(), "SFML", sf::Style::Fullscreen);
App.UseVerticalSync(true);

sf::Image Image;
    if (!Image.LoadFromFile("image.jpg")) return EXIT_FAILURE;

    sf::Sprite Sprite(Image);
Sprite.SetCenter(1280, 960);

    while (App.IsOpened())
    {
/////////////////////////////////////////////////////START
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed) { App.Close(); break;  }
        }
/////////////////////////////////////////////////////END

float Time = App.GetFrameTime();

if (App.GetInput().IsKeyDown(sf::Key::Left))  Sprite.SetX(Sprite.GetPosition().x - Time * Sprite.GetSize().x);
        if (App.GetInput().IsKeyDown(sf::Key::Right)) Sprite.SetX(Sprite.GetPosition().x + Time * Sprite.GetSize().x);
        if (App.GetInput().IsKeyDown(sf::Key::Up))    Sprite.SetY(Sprite.GetPosition().y - Time * Sprite.GetSize().y);
        if (App.GetInput().IsKeyDown(sf::Key::Down))  Sprite.SetY(Sprite.GetPosition().y + Time * Sprite.GetSize().y);

        if (App.GetInput().IsKeyDown(sf::Key::C)) Sprite.Rotate(- 180 * Time);
        if (App.GetInput().IsKeyDown(sf::Key::V)) Sprite.Rotate(+ 180 * Time);

        if (App.GetInput().IsKeyDown(sf::Key::Z)) Sprite.SetScale(Sprite.GetScale().x * (Time + 1), Sprite.GetScale().y * (Time + 1));
        if (App.GetInput().IsKeyDown(sf::Key::X)) Sprite.SetScale(Sprite.GetScale().x / (Time + 1), Sprite.GetScale().y / (Time + 1));

        if (App.GetInput().IsKeyDown(sf::Key::Escape)) App.Close();

        App.Draw(Sprite);

        App.Display();
    }

    return EXIT_SUCCESS;
}


Before it worked without handling events, but i guess now the events, when unhandled, flood the processor or something and cause this error i've experienced.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.3 / nightly builds
« Reply #9 on: April 04, 2008, 05:37:33 pm »
[EDIT]

Sorry, I previously answered in french without even noticing that I was on the english forum :oops:

So, I think there's no problem, querying events is not required (SFML can do without it), but you need it if you don't want your window to be kind of frozen.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.3 / nightly builds
« Reply #10 on: April 05, 2008, 08:48:24 am »
Just in case, there's a MinGW build I made today here :
http://www.sfml-dev.org/temp/SFML-rev575.zip
Laurent Gomila - SFML developer

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
SFML 1.3 / nightly builds
« Reply #11 on: April 05, 2008, 02:38:30 pm »
Bless you! It works tip top.

However, i would still like to point out, that i had to modify my program and add this to the main loop:

Code: [Select]

sf::Event Event;
while (App.GetEvent(Event)) {};


Without it the program was kind of blocked. My assumption is that the unhandled events wait to be handled or something (?). Anyway, i dont know if it should be treated as a bug, but i'd just like you to know.

Thanks again for the marvellous build for MinGW!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.3 / nightly builds
« Reply #12 on: April 05, 2008, 05:37:48 pm »
Ok, I see. I think the window is frozen if you don't process its events on the OS side.
Laurent Gomila - SFML developer

 

anything