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

Pages: [1]
1
System / Re: PhysFS archive stream - more then 4Gb files ?
« on: August 17, 2015, 09:57:41 am »
PHYSFS_readBytes

2
glTexCoord2f

3
General / Re: SFML 2.2 and GLEW
« on: February 09, 2015, 02:51:07 pm »
Visual C++ 2008 Express.

4
General / Re: SFML 2.2 and GLEW
« on: February 09, 2015, 02:01:36 pm »
Quote
Quote
You need to recompile SFML with your version of glew.
No...

Interesting, because without recompiling I have the same errors.

5
General / Re: SFML 2.2 and GLEW
« on: February 09, 2015, 12:27:44 pm »
You need to recompile SFML with your version of glew.

6
Window / Re: Unexpected GainedFocus event
« on: February 09, 2015, 10:23:09 am »
Today compiled from the master.

7
Window / Re: Unexpected GainedFocus event
« on: February 09, 2015, 09:25:43 am »
I was reminded of this problem.

I'll explain it as simply as I can.

Expected result
Code: [Select]
click outside the window LostFocus
click inside the window GainedFocus

But result is
Code: [Select]
click outside the window LostFocus and GainedFocus
click inside the window ??? nothing

8
Audio / Re: getPlayingOffset returns 0 when it shouldn't
« on: August 12, 2014, 07:04:02 am »
Quote
Switching these two lines is not the solution (it may work but it's not clean)
This way is a bit hacky but it can save memory.

Quote
You should load new data in a sf::SoundBuffer different from m_sound's current buffer.
Without any information about this limitation it is also not clear.

9
Audio / Re: getPlayingOffset returns 0 when it shouldn't
« on: August 11, 2014, 11:04:40 am »
Quote
maly whate are you trying to communicate with your code?
my code refers to the example and says "move up this line".

btw, latest source does not fix that problem.

ps. i hate english grammar.

10
Audio / Re: getPlayingOffset returns 0 when it shouldn't
« on: August 08, 2014, 07:58:10 pm »
        sf::Time time = m_sound.getPlayingOffset();
        m_currBuffer.loadFromSamples(origSamples, sampleCount, m_origBuffer.getChannelCount(), m_origBuffer.getSampleRate());
        //sf::Time time = m_sound.getPlayingOffset();

11
Window / Re: Change viewport to keep aspect ratio of scene
« on: August 01, 2014, 08:42:49 am »
when you resize the window always set a new view.

basicSettings.screenx and basicSettings.screeny doing strange offsets.
sf::View v( sf::FloatRect( sf::Vector2f( basicSettings.screenx, basicSettings.screeny ), \
                               sf::Vector2f( basicSettings.screenw, basicSettings.screenh ) ) );
try
sf::View v( sf::FloatRect( sf::Vector2f( 0, 0 ), \
                               sf::Vector2f( basicSettings.screenw, basicSettings.screenh ) ) );

example
#include <SFML/Graphics.hpp>

sf::View calcView(const sf::Vector2u &windowsize, const sf::Vector2u &designedsize)
{
    sf::FloatRect viewport(0.f, 0.f, 1.f, 1.f);

    float screenwidth = windowsize.x / static_cast<float>(designedsize.x);
    float screenheight = windowsize.y / static_cast<float>(designedsize.y);

    if(screenwidth > screenheight)
    {
        viewport.width = screenheight / screenwidth;
        viewport.left = (1.f - viewport.width) / 2.f;
    }
    else if(screenwidth < screenheight)
    {
        viewport.height = screenwidth / screenheight;
        viewport.top = (1.f - viewport.height) / 2.f;
    }

    sf::View view( sf::FloatRect( 0, 0, designedsize.x , designedsize.y ) );
    view.setViewport(viewport);

    return view;
}

int main()
{
    const sf::Vector2u designedsize(320,200);

    sf::RenderWindow app(sf::VideoMode(800, 400), "SFML window");
    app.setView(calcView(app.getSize(), designedsize));

    while (app.isOpen())
    {
        sf::Event event;
        while (app.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                app.close();
            if (event.type == sf::Event::Resized)
                app.setView(calcView(sf::Vector2u(event.size.width, event.size.height), designedsize));
        }

        app.clear();
        sf::CircleShape circle(5);
        for(int y = 0; y < designedsize.y/10; ++y)
        {
            for(int x = 0; x < designedsize.x/10; ++x)
            {
                circle.setPosition(x * 10, y * 10);
                circle.setFillColor( (x + y) & 1 ? sf::Color::Blue:sf::Color::Green);
                app.draw(circle);
            }
        }
        app.display();
    }
    return 0;
}

12
Window / Re: Change viewport to keep aspect ratio of scene
« on: July 31, 2014, 12:30:02 pm »
Something like this?
float screenwidth = windowsize.x / static_cast<float>(gamesize.x);
float screenheight = windowsize.y / static_cast<float>(gamesize.y);

sf::FloatRect viewport;
viewport.width = 1.f;
viewport.height = 1.f;

if(screenwidth > screenheight)
{
        viewport.width = screenheight / screenwidth;
        viewport.left = (1.f - viewport.width) / 2.f;
}
else if(screenwidth < screenheight)
{
        viewport.height = screenwidth / screenheight;
        viewport.top = (1.f - viewport.height) / 2.f;
}

sf::View v( sf::FloatRect( 0, 0, gamesize.x , gamesize.y ) );
v.setViewport(viewport);

13
Window / Re: Unexpected GainedFocus event
« on: June 27, 2014, 12:49:14 pm »
It just trigger GainedFocus event when losing focus.
 
My solution is add flag SWP_NOACTIVATE but I have no idea, if it's good idea.
void WindowImplWin32::setPosition(const Vector2i& position)
{
        SetWindowPos(m_handle, NULL, position.x, position.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}

void WindowImplWin32::setSize(const Vector2u& size)
{
    // SetWindowPos wants the total size of the window (including title bar and borders),
    // so we have to compute it
    RECT rectangle = {0, 0, static_cast<long>(size.x), static_cast<long>(size.y)};
    AdjustWindowRect(&rectangle, GetWindowLong(m_handle, GWL_STYLE), false);
    int width  = rectangle.right - rectangle.left;
    int height = rectangle.bottom - rectangle.top;

    SetWindowPos(m_handle, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}

14
Window / Unexpected GainedFocus event
« on: June 27, 2014, 10:59:53 am »
When I click on other window(LostFocus) setSize and setPosition gives me GainedFocus.
SFML 2.1 on Windows XP.
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::Window app(sf::VideoMode(100, 100), "SFML window");
    //sf::RenderWindow app(sf::VideoMode(100, 100), "SFML window");

    while (app.isOpen())
    {
        //app.setPosition(app.getPosition());
        app.setSize(app.getSize());

        sf::Event event;
        while (app.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                app.close();
            else if(event.type == sf::Event::LostFocus)
                std::cout << "LostFocus" << std::endl;
            else if(event.type == sf::Event::GainedFocus)
                std::cout << "GainedFocus" << std::endl;
        }
    }
    return 0;
}

Pages: [1]