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

Pages: [1]
1
Window / Full screen problems on macOS Mojave
« on: March 10, 2019, 04:15:09 pm »
I'm getting a very strange issue with full screen: When turn full screen on then off again, the window is duplicated so I have two instances of the same window (but one doesn't have any render context, just a blank window).

I'm on macOS mojave building with Xcode 10. I'm aware there are some other issues in the latest SDK with openGL so I'm wondering if anyone else can confirm this issue?

2
Window / glCheck() not available in window module
« on: August 15, 2018, 04:49:50 pm »
While trying to debug https://github.com/SFML/SFML/issues/1471 I noticed that none of the gl functions in the windows module are wrapped by glCheck(). As it's defined in the graphics module this makes sense, because the window module doesn't (and shouldn't) depend on the graphics module. But I was wondering if there was a reason this couldn't be moved into the window module, so that we can error check all the gl functions there as well?

3
SFML website / Dead forum link
« on: April 11, 2018, 10:01:42 pm »
The link at the bottom of the forum for DzinerStudio isn't correct anymore, it seems they shutdown their website and someone has since obtained the domain and is hosting some NSFW content there now...

I'd suggest removing the link?

4
General / Xcode templates not working (RESOLVED)
« on: March 16, 2018, 07:51:16 pm »
I've tried testing https://github.com/SFML/SFML/pull/1384 but had some issues, and it turns out I have the same issues on the current git master anyway:

After copying the templates to the templates folder, I only have the option for the CLT template (no SFML App), and even when creating that, It doesn't build "Out the box" as I'd expect.

First error is "Build setting PRODUCT_NAME undefined", fairly trivial to fix in the build settings, but then it doesn't find any of the headers ( I have double checked and the headers are definitely in /usr/local/include as they should be

I'm using Xcode 9, on macOS 10.13


5
Graphics / sf::RenderTarget::display() not present?
« on: March 14, 2018, 12:21:33 am »
Is there a reason it's missing?

I'd like to use some polymorphism so I can switch between rendertexture and render window neatly, but currently I have to do this for the display step in clear/draw/display cycle:

       
if (dynamic_cast<sf::RenderWindow*>(m_renderTarget))
        dynamic_cast<sf::RenderWindow*>(m_renderTarget)->display();
if (dynamic_cast<sf::RenderTexture*>(m_renderTarget))
        dynamic_cast<sf::RenderTexture*>(m_renderTarget)->display();
 

Although there may be a better way, it seems logical for RenderTarget to declare the display() method?

edit: I'd also be curious why there isn't a setSize() to match getSize()?

6
SFML development / iOS development progress
« on: January 25, 2018, 10:12:51 pm »
As I've recently found myself with some free time I've been focussing on iOS stuff. I'm going to write down any tips or issues I find here, and hopefully make some progress towards proper iOS support in SFML. I'm mostly just using my SFML-DOOM project to test with, so I'd also like to gather together anyone who has a project they are currently developing for iOS, or plan to develop for iOS in the future.

SFML Installation:

Since the iOS toolchain has been added this is much simpler

cmake .. -GXcode -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/iOS.toolchain.cmake

To generate the example(s) add the usual flag -DSFML_BUILD_EXAMPLES=TRUE

then install as you would normally.

sudo cmake --build . --target install

Notes:
  • IOS_PLATFORM cmake variable is used to specify target platform: OS for a real device, SIMULATOR for the simulator
  • Currently the toolchain forces static libs. I need to research this more, but I don't think this is a requirement for every iOS version, so may want more flexibility in future
  • Make sure you don't have the desktop SFML dependencies installed in your search path, or CMake might pick them up instead, giving you a compilation error

An iOS project using SFML:

If your project is also using cmake, it's just a case of copying the SFML toolchain file and using it in your project to generate the Xcode project.

You'll need to add some extra code to your CMakeLists to generate an app bundle, and set some Xcode parameters, e.g.:

if(APPLE)

    # Set some details for the app bundle. Without these my xcode crashes when debugging ios :S
    set(MACOSX_BUNDLE_IDENTIFIERcom.sfml.boop.SFML-APP)
    set(MACOSX_BUNDLE_NAME SFML-APP)

    set_source_files_properties( ${CMAKE_SOURCE_DIR}/apple/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
    set_source_files_properties( ${CMAKE_SOURCE_DIR}/assets PROPERTIES MACOSX_PACKAGE_LOCATION Resources )

    #Include resources when creating executable
    add_executable(SFML-DOOM MACOSX_BUNDLE ${INCLUDE} ${SOURCE} ${CMAKE_SOURCE_DIR}/apple/icon.icns
    ${CMAKE_SOURCE_DIR}/assets)

    # Set the app bundle icon
    set_target_properties( SFML-DOOM PROPERTIES MACOSX_BUNDLE_ICON_FILE icon.icns )
endif()
 

Notes:
  • Make sure to use the same IOS_PLATFORM as you did when building SFML
  • Make sure you have included SFML/Main.hpp in your main file, and make sure main function signature has no parameters (i.e. must be int main())
  • No Shaders!

Outstanding issues/PR's (Please help test if you can!)

If you follow https://github.com/jonnyptn/sfml-doom I'll update that as I go along.

If anybody has an existing SFML project using cmake and are curious about an iOS build, feel free to mention it in here as I could use as many test projects as possible.

Version support:

These are the platforms and Xcode versions I've tested on, if you've had success with any others please comment here so I can add to the list:

iOS:
  • 9.3
  • 11.2

Xcode:
  • 9

7
Window / iOS incorrect window size on reorientation
« on: January 25, 2018, 06:40:49 am »
It looks like the Resized event is reporting the previous window size when the screen orientation is changed.

Debug output here shows the value from the Resized event, graphic is just a 320x200 sprite, and I'm not transforming either the sprite or the view at any point: https://www.youtube.com/watch?v=cJ2af72hiDo


I've tested this on iOS 11 and 9, and I'm using Xcode 9 on macOS 10.13. Has anybody else got this working successfully?

Example code (Not the one used in above video, but has same outcome for me)
 sf::RenderWindow window(sf::VideoMode(),"SFML Doesn't work :(");
   
    sf::RectangleShape shape;
    shape.setFillColor(sf::Color::Red);
   
    while(window.isOpen())
    {
        sf::Event ev;
        while(window.pollEvent(ev))
        {
            if (ev.type == sf::Event::Resized)
            {
                std::cout << std::to_string(ev.size.width) + "," + std::to_string(ev.size.height) << std::endl;
                shape.setSize(sf::Vector2f(ev.size.width,ev.size.height));
            }
        }
        window.clear();
        window.draw(shape);
        window.display();
    }

 

8
SFML game jam / More?
« on: February 24, 2017, 01:40:30 pm »
Once again it seems dead in the water. It seems the main issue always seems to be lack of time for someone to manage it, whilst also maintaining the custom webstite etc.

I'd propose using something "out the box" such as itch.io or gamejolt, so there's almost no maintenance needed, and also the opportunity to reach a wider audience.

Out of the two suggestions I'd prefer itch.io, as the website feels a bit nicer, and the jams on there seem to have significantly more participation/entries than the ones on Gamejolt (of course open to suggestions if anybody can recommend other services)

Thoughts?

9
SFML projects / Voronoi Generator
« on: January 16, 2017, 10:39:11 pm »
As part of a game I've been working on I've adapted a library for generating voronoi cells to work with sfml:



The original source, and the person who gets all the credit for the smart stuff can be found here: https://github.com/mdally/Voronoi

and the branch with the mods for SFML can be found here: https://github.com/JonnyPtn/Voronoi/tree/sfVoronoi

At the time of writing it's working on Windows, Linux and MacOS. Because I can't cmake too well, there's two CMakeLists.txt - one for the lib in the root folder, and one for an example app in the "examples" folder.

Currently it's only the example app using SFML, and the internals still remain pretty much untouched, but I'll be modifying it to use more SFML stuff for the internals too.

10
SFML projects / SFML DOOM
« on: April 22, 2016, 09:25:21 pm »
DOOM, with SFML!

I was surprised to see nobody had done  this yet, so I've hacked apart the DOOM source to use SFML!

  • Uses SFML for window, events, audio, networking and graphics
  • Should be straightforward to build on any platform SFML supports
  • You can use controller or keyboard and mouse for input
  • Toggle fullscreen with ctrl+f
  • Uses the original software renderer and timidity for software audio synthesising
  • I've played with the shareware, DOOM and DOOM2 wads, as well as the E1M8b wad which John Romero recently released

http://www.youtube.com/watch?v=3DyMV-IM2oM

Multiplayer works with the original command line params ("-net"), but I've only managed to get it to work on the local network.

If you have any questions or feedback fire away!

Source and release here: https://github.com/JonnyPtn/SFML-DOOM

11
SFML projects / SnakeFML
« on: February 15, 2016, 09:03:21 pm »
Yes, it's another snake clone...

Just a little project myself and a few guys from the #SFML IRC channel have been playing around with.

Source: https://github.com/JonnyPtn/SnakeFML

Windows playable demo: https://www.dropbox.com/s/yi70nbghpwhbfky/SnakeFML.zip?dl=0

Features:
  • 360 degree movement
  • Curvy body for extra snakey-ness
  • Random snake colours
  • Multiple mice
  • Local high score
  • SFML face
  • Arrows or A/D to turn left/right

Not presenting this as a finished/polished article, just thought I'd get peoples impressions. I'm fully aware there's still plenty that could be done/improved.

Shout out to:
  • Koji (Kojay)
  • Lapinozz
  • Nyrox
  • Select_This
  • Xylr
  • The rest of the #sfml reprobates



12
Feature requests / Re-check if sound device becomes available after failing
« on: November 03, 2015, 12:05:58 pm »
Not sure whether this is considered a bug or not, but I'm having an issue with how SFML handles audio when the device is temporarily unavailable. If the device is unavailable when the first Sound/Music instance is created, but then becomes available later on (or even straight away after that) sounds will still never work.

Here's an example to reproduce:

#include <SFML\Graphics.hpp>
#include <SFML\Audio.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);

        //first music instance, this is where the device is initialised
        //disable sound device for this line
        sf::Music firstMusic;

        //second music instance,
        //make sure device is enabled from here onwards
        sf::Music secondMusic;

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                        if (event.type == sf::Event::KeyPressed)
                        {
                                if (event.key.code == sf::Keyboard::Space)
                                {
                                        //re-open the sound and play
                                        secondMusic.openFromFile("test.wav");
                                        secondMusic.play();
                                }
                        }
                }

                window.clear();
                window.draw(shape);
                window.display();
        }

        return 0;
}
 

If you stick a break point on the first and second music declarations, and make sure your sound playback device is disabled when the first one is executed, then enabled when the second is executed, you'll see the sound will never play. Ideally it would be good if it could check the status of the device at some point (When loading a sound/music? or even when playing them?) and try to open it again if it failed. I've had a look through the changes and I think it might have been something in this commit where the global device was changed:

https://github.com/SFML/SFML/commit/0ad401cc97e5577f594066d3c993daca803572e8


I tested the same thing using SFML 2.1 and as far as I can tell the behavior's the same

But I'm no expert so I'm hoping someone here might know a bit more.

Thanks!

Edit: This is happening on some released games (on a very specific platform) which is why I'm asking (I can see how it would seem a strange request otherwise!) where every few dozen start ups the sound device fails for an unknown reason, but it's usually available again straight after, however the sound will never return until the game has been closed and opened again.

13
Graphics / Smoothing Shapes on a rendertexture
« on: June 26, 2014, 01:01:48 pm »
Hello all,

I work with/for the user slotdev and I've only been using SFML and C++ for about a year now, so I'll apologize in advance for any silly mistakes, but here's my problem...

As we make games which need to be run at multiple different resolutions, depending on the hardware, we've previously had plenty of issues with artifacts appearing around sprites due to scaling. I came up for a fix for this by using an sf::RenderTexture as a sort of buffer which would essentially 'flatten' all the sprites at native resolution before scaling the RenderTexture and drawing it to the window. This worked perfectly in terms of removing the artifacts, but has causes some issues with sf::shapes...

We use sf::TriangleStrip to draw lines between winning symbol combinations, which could be at several positions in the window. Initially any section of the line which wasn't horizontal/vertical would look jagged, so we set antialiasing on in the window's contextsettings which solved that problem, however, now the shapes are getting drawn to the RenderTexture (which is set smooth, i might add), they are not smoothed by the window antialiasing so look jagged again.

does anyone know of a possible solution for this?

Here is some sample code which reproduces the problem:

#include <SFML\Graphics.hpp>

int main()
{
        //create the window
        sf::RenderWindow window(sf::VideoMode(500, 500), "Shape",sf::Style::Default,sf::ContextSettings(0,0,4));

        //create the shape
    sf::RectangleShape shape(sf::Vector2f(200,200));
    shape.setFillColor(sf::Color::Green);
        shape.setRotation(0);
        shape.setOrigin(100,100);
        shape.setPosition(250,250);

        //rendertexture stuff
        sf::RenderTexture windowTexture;
        windowTexture.create(500,500);
        windowTexture.setSmooth(true);
        sf::Sprite windowSprite;
        windowSprite.setTexture(windowTexture.getTexture());
        bool useRenderTexture=true;

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
                        if (event.type == sf::Event::KeyPressed)
                        {
                                switch (event.key.code)
                                {
                                        //rotate left
                                case sf::Keyboard::Left:
                                        shape.rotate(-5);
                                        break;
                                        //rotate right
                                case sf::Keyboard::Right:
                                        shape.rotate(5);
                                        break;
                                        //set window antialiasing OFF
                                case sf::Keyboard::Num1:
                                        window.create(sf::VideoMode(500, 500), "Shape",sf::Style::Default,sf::ContextSettings(0,0,0));
                                        break;
                                        //set window antialiasing ON
                                case sf::Keyboard::Num2:
                                        window.create(sf::VideoMode(500, 500), "Shape",sf::Style::Default,sf::ContextSettings(0,0,4));
                                        break;
                                        //toggle the use of the rendertexture
                                case sf::Keyboard::R:
                                        useRenderTexture=!useRenderTexture;
                                        break;
                                }
                        }
        }
                if(useRenderTexture)
                {
                        windowTexture.clear(sf::Color::Black);
                        windowTexture.draw(shape);
                        windowTexture.display();
                }

                window.clear(sf::Color::Black);
                if(useRenderTexture)
                        window.draw(windowSprite);
                else
                        window.draw(shape);
        window.display();
    }

    return 0;
}

to reproduce the problem, just push left/right to rotate the square slightly, then use 'R' to toggle the rendertexture on/off, and '1' or '2' to set the window antialiasing off/on.

Thanks in advance

Pages: [1]
anything