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

Pages: [1]
1
General discussions / Re: SFML in Android Studio Example
« on: August 31, 2017, 06:09:10 pm »
Looks great! Thanks!

2
Feature requests / iOS: Keyboard functions not implemented
« on: August 13, 2017, 04:53:41 am »
For iOS, Window/iOS/InputImpl.mm's isKeyPressed function always returns false, with a "not applicable" comment. However, since the iOS Simulator in Xcode lets you use the hardware keyboard that's plugged in to your Mac, it would be useful if this function worked properly for testing purposes. Most people programming with SFML for iOS are likely to be using the simulator to test, and it's very useful to test things by simply binding them to a keyboard key instead of setting an action to a temporary gui button or touch movement. On top of this, the simulator natively has an option that enables the hardware keyboard, which makes it confusing if SFML's just doesn't seem to be working for keyboard input when testing for iOS. On top of this, if I'm not mistaken, these are the functions we would want to use if an external keyboard was plugged in to an actual iOS device (like a wireless keyboard with an iPad). I think it would be a good idea to enable the hardware keyboard for iOS.

3
SFML website / Re: Typo in "SFML and Xcode (Mac OS X) tutorial
« on: August 09, 2017, 02:30:42 pm »
Good to know thanks!

4
SFML wiki / Re: Tutorial: SFML for iOS
« on: August 09, 2017, 02:27:12 pm »
Thanks! One thing that needs to be improved though is figuring out how to compile the libraries for 64-bit iOS. Right now by default the cmake script makes an Xcode project which only compiles the libs for 32-bit, and that's why we need to add $(ARCHS_STANDARD_32_BIT). This works for the simulator, but unfortunately for releasing to the app store Apple requires 64-bit apps. If anyone figures this out please feel free to update the wiki :)

5
Audio / Re: #include bug in ALCheck.hpp for iOS
« on: August 08, 2017, 09:56:32 pm »
I was thinking of how hard it must be for a newcomer with less experience to debug all the obsucre errors he might encounter, especially since Xcode is super finicky about which options it wants for it to compile. Would it also be useful if I added a wiki entry on how to make an Xcode project for iOS with SFML from scratch, detailed step by step? It would help give SFML visibility as it's a shame many don't realize it can work on iOS.
Please do so! :)

Here it is: https://github.com/SFML/SFML/wiki/Tutorial%3A-SFML-for-iOS

6
SFML wiki / Tutorial: SFML for iOS
« on: August 08, 2017, 09:28:11 pm »
I've made a very lengthy and in-depth step by step tutorial on how to build SFML for iOS which should address every single one of the little issues people could have with CMake, SFML, or Xcode when trying to compile for iOS. Hopefully this should attract more people who want to use SFML for mobile development!

Link here: https://github.com/SFML/SFML/wiki/Tutorial:-SFML-for-iOS

-Misha

7
SFML website / Typo in "SFML and Xcode (Mac OS X) tutorial
« on: August 08, 2017, 04:25:24 pm »
In the "System Requirements" section of the tutorial, one of the bullet points is "An 64-bit Intel Mac with Lion or later (10.7+)" instead of "A 64-bit Intel Mac with Lion or later (10.7+)". It probably creeped in there when someone must have added the "64-bit" precision.

8
Audio / Re: #include bug in ALCheck.hpp for iOS
« on: August 08, 2017, 08:06:52 am »
Nope, it works perfectly fine with that fix. I'll do a pull request when I get around to it. I managed to compile SFML for iOS with the limited info on the forum, and I was thinking of how hard it must be for a newcomer with less experience to debug all the obsucre errors he might encounter, especially since Xcode is super finicky about which options it wants for it to compile. Would it also be useful if I added a wiki entry on how to make an Xcode project for iOS with SFML from scratch, detailed step by step? It would help give SFML visibility as it's a shame many don't realize it can work on iOS.

9
Audio / #include bug in ALCheck.hpp for iOS
« on: August 08, 2017, 12:43:15 am »
I believe there is a problem with Audio/ALCheck.hpp when compiling the libs for iOS after building with CMake. Xcode complains that there is no OpenAl/al.h that can be found, at line 33. The only way I got it to work was to rename as follows:
Code: [Select]
#ifdef SFML_SYSTEM_IOS
    #include <OpenAl/al.h>
    #include <OpenAl/alc.h>
#else
Renamed to:
Code: [Select]
#ifdef SFML_SYSTEM_IOS
    #include <AL/al.h>
    #include <AL/alc.h>
#else

By doing this, Xcode was able to successfully compile the libraries. I later used them in an iOS project and I can confirm that audio worked fine. This is only a change that affects ALCheck.hpp for iOS, as it is nested inside the #ifdef SFML_SYSTEM_IOS.

10
Graphics / Re: Using map.emplace with sf::Shader
« on: May 03, 2017, 11:01:56 pm »
But shouldn't SFML allow support for std::move with sf::Shader? Or is this not possible?

11
Graphics / Re: Using map.emplace with sf::Shader
« on: May 03, 2017, 11:00:46 pm »
Doesn't just this:
m_shaders[rName];
create the shader in the map, ready to use?

Unfortunately not, it needs an assignment operator after it (=), which itself would need to call the copy constructor of the sf::Shader.

No, sorry, I'm wrong. It works! Thanks a lot :)

12
Graphics / Re: Using map.emplace with sf::Shader
« on: May 03, 2017, 10:59:55 pm »
Doesn't just this:
m_shaders[rName];
create the shader in the map, ready to use?

Unfortunately not, it needs an assignment operator after it (=), which itself would need to call the copy constructor of the sf::Shader.

13
Graphics / Re: Using map.emplace with sf::Shader
« on: May 03, 2017, 10:53:35 pm »
You're still copying.

I think you want:
m_shaders.emplace(rName);

That isn't valid syntax; it's an std::map/std::unordered_map

14
Graphics / Re: Using map.emplace with sf::Shader
« on: May 03, 2017, 10:41:02 pm »
I tried this and it doesn't compile either.
/// Otherwise, load the Shader
    m_shaders.emplace(rName, sf::Shader());
    if (!m_shaders.at(rName).loadFromFile(ResourcePath() + rFilename, type))
    {
        std::cout << "ResourceManager error: Could not load Shader: \"" << rName << "\".\n";
        m_shaders.erase(rName);
        return m_shaders.at("ADDDEFAULTSHADER");
    }
    return m_shaders.at(rName);
 

To confirm that this isn't just a problem with my implementation in this case, I used an sf::Texture instead, which compiled successfully:
/// Otherwise, load the Shader
    m_textures.emplace(rName, sf::Texture());
    if (!m_shaders.at(rName).loadFromFile(ResourcePath() + rFilename, type))
    {
        std::cout << "ResourceManager error: Could not load Shader: \"" << rName << "\".\n";
        m_shaders.erase(rName);
        return m_shaders.at("ADDDEFAULTSHADER");
    }
    return m_shaders.at(rName);
 

Correct me if I'm wrong, but wouldn't the sf::Shader need a move constructor, which would let us do std::move to place it in an STL container? We could then use it like this (which currently doesn't work because of sf::NonCopyable):
/// Otherwise, load the Shader
    sf::Shader shader;
    if (!shader.loadFromFile(ResourcePath() + rFilename, type))
    {
        std::cout << "ResourceManager error: Could not load Shader: \"" << rName << "\".\n";
        return m_shaders.at("ADDDEFAULTSHADER");
    }
    m_shaders.emplace(rName, std::move(shader));
    return m_shaders.at(rName);
 

15
Graphics / Using map.emplace with sf::Shader
« on: May 03, 2017, 09:48:44 pm »
Hello,

I'm currently making a resource manager with which I can load, unload, or get a reference to a textures/fonts/soundbuffers/shaders. The problem is with the shaders: I can't seem to add them to an STL container (in my case, an std::unordered_map) because of the sf::NonCopyable. Even if I use .emplace(key, shader), my compiler doesn't accept it. How should I go about this?

Here is my current code:

const sf::Shader& ResourceManager::LoadShader(const std::string &rName, const std::string &rFilename, sf::Shader::Type type)
{
    // If a Shader is already loaded at the specified key, return the existing Shader
    std::unordered_map<std::string, sf::Shader>::const_iterator it = m_shaders.find(rName);
    if (it != m_shaders.cend())
    {
        return it->second;
    }
    // Otherwise, load the Shader
    sf::Shader shader;
    if (!shader.loadFromFile(rFilename, type))
    {
        std::cout << "ResourceManager error: Could not load Shader: \"" << rName << "\".\n";
        return m_shaders.at("ADDDEFAULTSHADER");
    }
    m_shaders.emplace(rName, shader); // Compiler error here because of deleted copy constructor
    return m_shaders.at(rName);
}
 

Thanks in advance!

Pages: [1]
anything