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

Pages: [1]
1
Graphics / Draw a sprite at the bottom of screen, using its own size
« on: March 02, 2021, 10:03:18 pm »
Hi guys

This is whats happening:
1. I have a spritesheet image with some textures from various elements.
2. I created a sprite based on a this spritesheet, defining the texture rect.
3. I also resized the sprite down according by ratio of the screen width.

The sprite is drawn perfectally, no problems there.

Now I want to align the sprite to the bottom of the screen,so I set its position like this:
midGroupSky2Sprite.setPosition(1, window.getSize().y -midGroupSky2Sprite.getGlobalBounds().height);

The result makes part of the sprite go offscreen at the bottom and not perfectally aligned.

I then tried this:
midGroupSky2Sprite.setPosition(1, window.getSize().y - midGroupSky2Sprite.getTextureRect().height);

The sprite is now too high.

What am I doing wrong ?


2
I've edited that cmake file,
However when I build the project, I get " This UNIX operating system is not supported by SFML library"


3
O.K I can see the problem in SFMLConfigDependencies.cmake

At the top part you have:

    # detect the OS
    if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
        set(FIND_SFML_OS_WINDOWS 1)
    elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
        set(FIND_SFML_OS_LINUX 1)
    elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
        set(FIND_SFML_OS_FREEBSD 1)
    elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
        if (DEFINED IOS)
            set(FIND_SFML_OS_IOS 1)
        else()
            set(FIND_SFML_OS_MACOSX 1)
        endif()
    endif()


And at the bottom

        if (FIND_SFML_OS_WINDOWS)
            set_property(TARGET OpenGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "OpenGL32")
        elseif(NOT FIND_SFML_OS_IOS)
            sfml_bind_dependency(TARGET OpenGL FRIENDLY_NAME "OpenGL" SEARCH_NAMES "OpenGL" "GL")
        endif()


However ${CMAKE_SYSTEM_NAME} returns CYGWIN.

Should I file for a bug ?

4
Hi

I have to move to MingW64 under cygwin.
Compiled SFML successfully and trying to compile my project now.
Received SFML found but some of its dependencies are missing (...) with all sort of missing libraries.
Installed all of them through the Cygwin package installer.
Just one more library is missing, OpenGL.
Have no idea what to install for it, I tried all sort of libraries.

Anyone ?

5
I dont know what is going on here, after a full day I tried again the following configuration and it worked, (but was different than what I did earlier).

1. Downloaded SFML, compiled with MinGW64 abd cmake and installed in \program files...\SFML\
2. in my CMake file I added find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
3. This gave me and error "Requested SFML configuration (Shared) was not found"
4. Added set(SFML_STATIC_LIBRARIES TRUE) to the cmake
5. Everything build and run well.

Can you atleast let me know what is going on (and maybe even answer my previous questions) ?

6
General discussions / Change to MinGW-W64 and everything is broken
« on: May 16, 2020, 09:25:49 pm »
Hi

I used MinGW with SFML without a problem for months now, however I added a library that require std::threads so I had to change to MinGW-W64.
Tried to recompile everything and reconfigure the enviornment, but everything got messed up and broken.
I think I'm fairly confused about whats going on, probably because my noob experience with cmake.

I would like to start from scratch, lets say from a simple hello world for SFML using MinGW-W64 (which is configured in my PATH and I can run a cout << "Hello World" with it).

Here are my questions:
1. First a general question, if I compile SFML myself, do I still need the windows DLL files (sfml-system-2.dll etc...) to be inside my executable folder? I would rather everything go inside one .exe file.

2. After I build SFML (I successfully built it to \program files...\SFML) how should I integrate it to my project CMakeLists file ? I tried all sort of things (find_package, add_subdirectory...) nothing works.

3. Can I instead just build SFML with my project? I tried adding SFML git source to my project in directory lib/SFML-2.5.1/ and in my project cmake file write add_subdirectory(...) to that directory. The hello world build but he ask for the DLL files. I also tried retrieving the DLL files and adding them to the executable directory using file(COPY...) command, and it does copy the file but my hello world program complains it does not find the DLL files (altough they are on the same directrory!)


I'm really sorry for the noob questions, but I've invested the past couple of months developing my software which uses SFML and not nothing works and i'm wasting hours on that...

Thank you !

7
Graphics / Re: RenderWindow getView doesnt return the view ?
« on: April 28, 2020, 09:32:06 pm »
O.K, Thanks !

8
Graphics / Re: RenderWindow getView doesnt return the view ?
« on: April 28, 2020, 08:09:32 pm »
Thanks for the reply.

Why do I get a copy instead of a pointer to the actual view?

9
Graphics / RenderWindow getView doesnt return the view ?
« on: April 28, 2020, 06:14:20 pm »
Hi

First, I loved SFML.
Thank you for that !


Can you tell me why this doesnt work ?

// ... before game loop
sf::View cameraView(sf::FloatRect(0, 0, GamePreferences::WINDOW_RESOLUTION_WIDTH, GamePreferences::WINDOW_RESOLUTION_HEIGHT));


// ... inside game loop

window.setView(cameraView);
handleInputEvents(&window);

// ... end of game loop method


// method handleInputEvents

void Director::handleInputEvents(sf::RenderWindow *window) {
    sf::Event event{};
    sf::View view = window->getView();

    while (window->pollEvent(event))
    {
        if (event.type == sf::Event::MouseWheelScrolled) {
            if (event.mouseWheelScroll.delta == 1)
                view->zoom(0.95f);
            else if (event.mouseWheelScroll.delta == -1)
                view->zoom(1.05f);
        }
    }
}

 

The zoom does not change.
However, if I provide cameraView to handleInputEvents as a parameter, it does work.
Also if I copy the handleInputEvents to the game loop (instead of using a method).

What am I doing wrong here ?

Pages: [1]