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 ... 18 19 [20] 21 22
286
SFML projects / Re: GIPE Framework
« on: November 19, 2013, 01:45:09 pm »
By the first, i'm creating list of images that will be in texture. Just by appending of image files. Than i can select colour wich will be converted to alpha channel if image has no transparent colour. Each image can be cropped from unused transparent lines. And the resulting image can be stored in texture with information of its previuos size or forget it. Before create texture program sorts images by Order, Size, Width and Height. And detects wich of way is better. Or you can select sorting way directly. Size of texture also can be determined automatically or by user. Then you just press Generate button with green arrow.
If not all of sprites are fit in texture there will be created another one, and another, and so on... Texture is saved as one solid binary file (.tex), where compression method of each texture is selected by user.

I'm so tired... You have to learn russian! =) By the way, all text in program is loaded from external language file, so it can be easily translated to any language. Like that:
Code: [Select]
IDS_OUTPUT_FORMAT=Формат записи
IDS_RAW=Без сжатия (RGBA)
IDS_PNG=PNG (RGBA)

287
SFML projects / Re: GIPE Framework
« on: November 19, 2013, 01:22:05 pm »
Cool :)
Thank you! =)
Are you going to release it at some point?
Not now. It is too raw and undone.
Btw. I suggest to use OBS for recording your screen. It's free, best quality and doesn't have any annoying water mark. ;)
Thanks, for some reason I could not find anything good to record from screen.

288
SFML projects / Re: GIPE Framework
« on: November 19, 2013, 12:32:57 pm »

289
Graphics / Re: [SOLVED] loadFromMemory vs loadFromStream
« on: November 19, 2013, 07:58:41 am »
So, result of discussion is something like that:
(i removed some code for simplicity)

class SubStream: public sf::InputStream
{
public:

        explicit SubStream(sf::InputStream* stream, size_t begin, size_t size);
        virtual ~SubStream();

        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;

protected:

        sf::InputStream*        mStream = nullptr;
        size_t  mBegin = 0;
        size_t  mSize = 0;
        size_t  mOffset = 0;
};

SubStream::SubStream(sf::InputStream* stream, size_t begin, size_t size):
        mStream(stream),
        mBegin(begin),
        mSize(size),
        mOffset(0)
{
        mIsOk = mStream != nullptr && mSize > 0;
}



SubStream::~SubStream()
{
}



/* virtual */ sf::Int64 SubStream::read(void* data, sf::Int64 size)
{
        if (mIsOk)
        {
                sf::Int64 readed = mStream->read(data, size);

                if (readed != -1)
                {
                        mOffset += readed;
                        return readed;
                }
        }

        return -1;
}



/* virtual */ sf::Int64 SubStream::seek(sf::Int64 position)
{
        if ( (size_t) position < mSize)
        {
                mOffset = (size_t) position;
                mStream->seek(mBegin + mOffset);
                return (sf::Int64) mOffset;
        }

        return -1;
}



/* virtual */ sf::Int64 SubStream::tell()
{
        return (sf::Int64) mOffset;
}




/* virtual */ sf::Int64 SubStream::getSize()
{
        return (sf::Int64) mSize;
}
 
It works very well, and a little bit faster than use of redundant malloc/free .

290
Graphics / Re: loadFromMemory vs loadFromStream
« on: November 18, 2013, 10:00:57 am »
That's what I wanted to hear. =) Thanks to all!

291
SFML projects / Re: SFGUI (0.1.1 released)
« on: November 18, 2013, 09:28:43 am »
I commented one line in CMakeLists.txt:
# Find packages.
find_package( OpenGL REQUIRED )
#find_package( SFML 2.1 REQUIRED COMPONENTS GRAPHICS WINDOW SYSTEM )
 
I have not found another solution. After creating the project files need a little correct them manually.

292
Graphics / Re: loadFromMemory vs loadFromStream
« on: November 18, 2013, 09:19:16 am »
I think loadFromStream tries to load image from BEGIN of the input stream. If it correct behavior, so no any questions from me. But i think that loadFromStream have to read image from CURRENT position and read size of image header.  :-\

293
Graphics / Re: loadFromMemory vs loadFromStream
« on: November 17, 2013, 07:19:27 pm »
Minimal example in topic... =) Else it will be FULL example. Several images are packed in file one by one. These images can be RAW, PNG or JPEG. To read compressed data used loadFromStream - does not work, and loadFromMemory - perfectly works, where input stream is the same for each method. So i want to know, why loadFromStream can't load from stream. =)

ps Do you understand me? =(

294
Graphics / Re: loadFromMemory vs loadFromStream
« on: November 17, 2013, 06:49:54 pm »
Well, yes it's sf::InputStream based object. It support memory, file and zip archive. And this stream is well tested many times. I do not think it's fault of "input" stream. =)

295
Graphics / [SOLVED] loadFromMemory vs loadFromStream
« on: November 17, 2013, 03:14:20 pm »
I have some file where several texture images are packed. I wanted to do so
        result = texture.loadFromStream(input);
But it fails, log message is "Failed to load image from stream. Reason : Image not of any known type, or corrupt".

So i changed to
        void* data = malloc(size);
        input.read(data, size);
        texture.loadFromMemory(data, size);
        free(data);
and it works fine, but there reduntant memory allocation operations. Any thoughts how to do it better?

296
General discussions / Re: Favorite IDE
« on: November 14, 2013, 08:32:46 am »
By the way, new VS 2013 Express finally has powerful enough syntax highlighting, so it really the best from all free IDEs now. And don't forget about C++11 - it almost full there.

297
General discussions / Re: Favorite IDE
« on: November 13, 2013, 01:18:30 pm »
Visual Studio is the best. I tried all from the list except XCode. Second is Code::Blocks, but i hate it sometimes. All java-based IDE are strange mix of good ideas and awful realisation.

298
SFML projects / Re: Zombination - 2D survival zombie shooter
« on: November 09, 2013, 12:36:28 pm »
Looks very cool! =)

299
SFML projects / Re: 2d game engine done by a newbie - progress diary
« on: October 15, 2013, 05:40:57 pm »
You can unpack rars with unrar or unar on Linux, it's not a big deal.
There was a smile. May be my russian humour is not clear? =) Forget it.

300
SFML projects / Re: 2d game engine done by a newbie - progress diary
« on: October 15, 2013, 05:27:07 pm »
1. Don't include in archive data that could be regenerated. I mean local solution data, precompiled header, compiled objects. Other programmers do not need them. Real size of your project is just several kilobytes. And RAR is a good archiver, but Linux guys don't have it. =)
2. If you want to share your code - use special services for it. Bitbucket or Google.Code, for example.
3. Precompiled header is not used in your code. So turn it off.
4. Always check an index of array that your function receives. In critical places use assert macro:
assert(index < imageList.size());
It will check expression in Debug build and skip check in Release.
That's all! =)

Pages: 1 ... 18 19 [20] 21 22