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

Pages: 1 ... 9 10 [11] 12 13 ... 22
151
General discussions / Re: Android and iOS ports available for testing
« on: September 14, 2014, 07:45:04 pm »
Main problem is to load sfml-activity. May be little loader on Java will help.
Secondary problem, for me, there is bug with activity->internal(external)DataPath, it always NULL. This bug was fixed since 3.0.
Little hack for it, but i can't test it because main problem is not solved. =)
std::string GetInternalDataPath()
{
        priv::ActivityStates* states = priv::getActivity(NULL);
        Lock(states->mutex);
        const char* path = states->activity->internalDataPath;
       
        if (!path)
        {
                JNIEnv* jni;
                states->activity->vm->AttachCurrentThread(&jni, NULL);

                jclass activityClass = jni->GetObjectClass(states->activity->clazz);
                jmethodID getFilesDir = jni->GetMethodID(activityClass, "getFilesDir", "()Ljava/io/File;");
                jobject fileObject = jni->CallObjectMethod(states->activity->clazz, getFilesDir);
                jclass fileClass = jni->GetObjectClass(fileObject);
                jmethodID getAbsolutePath = jni->GetMethodID(fileClass, "getAbsolutePath", "()Ljava/lang/String;");
                jobject pathObject = jni->CallObjectMethod(fileObject, getAbsolutePath);
                path = jni->GetStringUTFChars((jstring)pathObject, NULL);

                jni->DeleteLocalRef(pathObject);
                jni->DeleteLocalRef(fileClass);
                jni->DeleteLocalRef(fileObject);
                jni->DeleteLocalRef(activityClass);

                states->activity->vm->DetachCurrentThread();
        }
       
        return path ? std::string(path) : "";
}

152
General discussions / Re: Android and iOS ports available for testing
« on: September 14, 2014, 07:23:20 pm »
Hmm, 2.3.x does not work now. And i'm not sure that it worked before. The same build perfectly works on several 4.x.x devices.

E/AndroidRuntime(18584): FATAL EXCEPTION: main
E/AndroidRuntime(18584): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.familyxoft.croger/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to find native library: sfml-activity
E/AndroidRuntime(18584):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
 

153
General discussions / Re: Congratilations with Programmers day!
« on: September 13, 2014, 09:40:59 pm »
Let me also quote Google Translate for those who don't speak/read Russian (like me):

Quote from: Google Translate
And you're on a holiday, Zema

:D
I think it's very bad try.
By the way, "Zema" is pronounced like "zyoma" - slang,  - земляк, соотечественник. Google Translate says that "compatriot" - is a good variant. =)

154
General discussions / Re: Congratilations with Programmers day!
« on: September 13, 2014, 08:34:50 pm »
И тебя с праздником, зёма. =)

155
General discussions / Re: Android and iOS ports available for testing
« on: September 12, 2014, 06:37:02 pm »
2. Crash upon pressing the "Home" button. AlexAUT and ChronicRat, how did you work around it?
I have no crash with Home, but i'm catching LostFocus and whole app is paused untill GainFocus raised. Tested on 4.2.2 and 2.3.6

156
SFML website / Re: SFML and WXWIDGETS integration
« on: September 11, 2014, 02:36:36 pm »
Yes.

157
General discussions / Re: Android and iOS ports available for testing
« on: September 11, 2014, 10:43:02 am »
I'm not sure about your bug, but may be... All my problems with fonts were with "loadFromFile" or stream's bug. Now i'm using "loadFromStream" only and have no problems with any language.

158
General discussions / Re: Android and iOS ports available for testing
« on: September 10, 2014, 07:35:02 pm »
Little hack for assets' streaming and it works:

I inserted this in Err.hpp:
#if defined(SFML_SYSTEM_ANDROID)

#include <string>

class AAsset;

namespace sf
{

SFML_SYSTEM_API AAsset* GetAsset(const std::string& filename, int assetMode = 0 /* AASSET_MODE_UNKNOWN */);

} // namespace sf

#endif

Err.cpp
#if defined(SFML_SYSTEM_ANDROID)  
        #include <SFML/System/Android/Activity.hpp>
        #include <SFML/System/Lock.hpp>
        #include <android/configuration.h>
#endif

....
// in sf namespace

#if defined(SFML_SYSTEM_ANDROID)

AAsset* GetAsset(const std::string& filename, int assetMode /* AASSET_MODE_UNKNOWN */)
{
        priv::ActivityStates* states = priv::getActivity(NULL);
        Lock(states->mutex);
        return AAssetManager_open(states->activity->assetManager, filename.c_str(), assetMode);
}

#endif
 

Asset stream derived from sf::InputStream:
#ifndef __GIPE_ASSET_STREAM_H__
#define __GIPE_ASSET_STREAM_H__

class AAsset;

class AssetStream: public GipeStream::IInputStream // it's a little extended sf::InputStream
{
public:

        explicit AssetStream() = default;
        explicit AssetStream(const FileNameType& name);
        virtual ~AssetStream();

        void close();
        bool open(const FileNameType& filename);

        virtual sf::Int64 read(void* data, sf::Int64 size) override;
        virtual sf::Int64 seek(sf::Int64 position) override;
        virtual sf::Int64 tell() override;
        virtual sf::Int64 getSize() override;

        AssetStream(AssetStream& other) = delete;
        void operator=(const AssetStream&) = delete;

        AssetStream(AssetStream&& other);

private:

        AAsset*         mAsset = nullptr;
};



#endif // __GIPE_ASSET_STREAM_H__
 

#include "pch.h"
#include "filesystem/assetstream.h"
#include <android/asset_manager.h>


AssetStream::AssetStream(const FileNameType& name):
        GipeStream::IInputStream(name)
{
        mIsOk = open(name);
}



AssetStream::AssetStream(AssetStream&& other):
        IInputStream(std::move(other)),
        mAsset(std::move(other.mAsset))
{
        other.mAsset = nullptr;
}



AssetStream::~AssetStream()
{
        close();
}



void AssetStream::close()
{
        if (mAsset)
        {
                AAsset_close(mAsset);
                mAsset = nullptr;
        }
}



bool AssetStream::open(const FileNameType& filename)
{
        close();
        mIsOk = false;
        AAsset* file = sf::GetAsset(filename.c_str(), AASSET_MODE_STREAMING);

        if (file)
        {
                mAsset = file;
                mIsOk = true;
        }

        return mIsOk;
}



/* override */ sf::Int64 AssetStream::read(void* data, sf::Int64 size)
{
        return mIsOk ? (sf::Int64) AAsset_read(mAsset, data, size) : -1;
}



/* override */ sf::Int64 AssetStream::seek(sf::Int64 position)
{
        return mIsOk ? AAsset_seek(mAsset, position, SEEK_SET) : -1;
}



/* override */ sf::Int64 AssetStream::tell()
{
        return mIsOk ? AAsset_seek(mAsset, 0, SEEK_CUR) : -1;
}



/* override */ sf::Int64 AssetStream::getSize()
{
        return mIsOk ? AAsset_getLength(mAsset) : -1;
}
 

159
General discussions / Re: CLion - A new IDE from JetBrains
« on: September 10, 2014, 05:43:41 pm »
Well, i  read more about CLion, and i think i'll try it at least. =)

160
General discussions / Re: CLion - A new IDE from JetBrains
« on: September 10, 2014, 01:47:09 pm »
Just started learning c++
So you have to use common IDE, Visual Studio is the simplest of them.

161
General discussions / Re: CLion - A new IDE from JetBrains
« on: September 09, 2014, 07:46:34 pm »
I think there is no need to type IMHO after every message, because it's enabled by default to all of us. =) Better way is to warn others that something is NOT your own opinion.

162
General discussions / Re: CLion - A new IDE from JetBrains
« on: September 08, 2014, 09:38:17 pm »
YAJBIDEt =)
I'm sorry, but java-based IDE are extremly overengineered and slow.

163
General discussions / Re: Using SFML just as a pure GUI tool
« on: August 29, 2014, 07:37:37 pm »
Please post something more relevant to the discussion instead of just two words that don't mean that much.
These two words mean all. =)
But if you wish, SFML surely can be used to creation usual application, like the assembler can be used to create games. For example, some users likes light colour theme, some users - dark. In case of using wxWidgets(Qt, etc) application looks like the user want. And the most important - speed of developing such application (based on GUI library) will be faster, much faster, very much faster.

164
General discussions / Re: Using SFML just as a pure GUI tool
« on: August 29, 2014, 02:10:01 pm »
Bad idea.

165
General discussions / Re: Android and iOS ports available for testing
« on: August 26, 2014, 09:32:11 pm »
Just remember that "exit(0)" won't run any destructors...
Yes, I know. =) But I would never have thought of using "exit" to quit app. I just forget about it. Now I can place my games at stores.  8)

Pages: 1 ... 9 10 [11] 12 13 ... 22
anything