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

Pages: [1]
1
General / Re: Draw at wrong position
« on: December 21, 2016, 09:35:29 pm »
Thank you for your replies. I already tried the binaries from http://www.sfml-dev.org/download/sfml/2.4.1/. Unfortunately, it didn't work. I have been able to compile the green circle example linked with SFML2.4.1, but the application crashed when launched. I think it is a problem with dependencies.

Yes, of course, I can compile SFML from the source codes (for those who tease me about my programming skills, have a look at my most significant accomplishments : http://5lair.free.fr or www.lucidarme.me ;-) ). I try to keep my development computer clean and avoid installing too much packages. SFML needs a lot of dependencies. I'll do it after the holidays on another computer.

By the way, maybe the binaries v2.4.1 for Ubuntu 16.04 may interrest other developers ? How to share ? I'm also thinking in contributing in the dev : in my opinion, multi-display support is a severe lack in SFML ... I think this missing functionality prevent the development of professional apps.

2
General / Re: Draw at wrong position
« on: December 19, 2016, 08:34:43 am »
Maybe we should remove the S at the beginning of SFML  ;)

Anyway, thank you very much for your quick and relevant answers.

3
General / Re: Draw at wrong position
« on: December 18, 2016, 10:36:05 pm »
Argh ... can't compile with sfml 2.4.1 :
g++ main.o -o sfml-app -L/home/philippe/SFML-2.4.1/lib -lsfml-graphics -lsfml-window -lsfml-system
main.o: In function `main':
main.cpp:(.text+0x18c): undefined reference to `sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)'
collect2: error: ld returned 1 exit status
 
Can't figure out why loadFromFile is not linked. A conflict with the already installed SFML 2.3.2 ?

4
General / Re: Draw at wrong position
« on: December 18, 2016, 07:42:20 pm »
Let say dozen of pixels. I investigated to understand. The problem comes from the window size. I added the following lines in my code :
    std::cout << "desktopMode = \t" << desktopMode.width << "x" << desktopMode.height << " px" << std::endl;
    std::cout << "window.getSize = \t" << window.getSize().x << "x" << window.getSize().y << " px" << std::endl;
 

Same code executed twice provides the following output (remember I'm working in full screen).

Starting /home/philippe/sources/sfml_tutorial/part_003/bin/part_003...
desktopMode =    1920x1080 px
window.getSize =    1855x1056 px
/home/philippe/sources/sfml_tutorial/part_003/bin/part_003 exited with code 0

Starting /home/philippe/sources/sfml_tutorial/part_003/bin/part_003...
desktopMode =    1920x1080 px
window.getSize =    1920x1080 px
/home/philippe/sources/sfml_tutorial/part_003/bin/part_003 exited with code 0

Hum hum ... strange ... Any idea ?

5
General / Draw at wrong position
« on: December 18, 2016, 07:08:04 pm »
Hi, not sure I'm at the right place ! I wrote the following code that should draw a line in the middle of the window. But the line is not always in the middle, sometime yes, sometine shifted to the right. I tried two different computers, but the problem appeared on both. Same problem also appeared with sprites. I'm working with Ubuntu 16.04, I compiled with Qt and SFML 2.3.2 (Ubuntu 16.04 repository). I really hope I made something wrong, and this problem is not a SFML bug. Here is my source code:

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

int main()
{
    // _____________________
    // ::: Create window :::
   
    // Create a window with the same pixel depth as the desktop
    sf::VideoMode desktopMode = sf::VideoMode::getDesktopMode();
   
    sf::RenderWindow window(sf::VideoMode(  desktopMode.width,
                                            desktopMode.height,
                                            desktopMode.bitsPerPixel),
                            "SFML part 3",
                            sf::Style::Fullscreen);
   
    // Enable vertical sync. (vsync)
    window.setVerticalSyncEnabled (true);
   
    sf::Vertex line[] =
    {
        sf::Vertex(sf::Vector2f(desktopMode.width/2, 0)),
        sf::Vertex(sf::Vector2f(desktopMode.width/2, desktopMode.height))
    };
   
    // _________________
    // ::: Main loop :::
   
   
    sf::Clock timer;
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close the window if a key is pressed or if requested
            if (event.type == sf::Event::Closed) window.close();
            if (event.type == sf::Event::KeyPressed) window.close();
        }
       
        // Clear the window and apply grey background
        window.clear( sf::Color(127,127,127));
        window.draw(line, 2, sf::Lines);
       
        // Update display and wait for vsync
        window.display();              
    }
    return 0;
}


 

Pages: [1]