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

Pages: 1 [2]
16
General / Re: String to movement help
« on: August 01, 2014, 11:35:46 am »
Hello,
What you can do is to compute the next position from your route and go towards this position on each frame.

(click to show/hide)

17
Window / Re: Change viewport to keep aspect ratio of scene
« on: August 01, 2014, 10:45:01 am »
Here is how I would do it.
I hope it helps.

sf::View calcView(const sf::Vector2f& windowSize, float minRatio, float maxRatio)
{
    sf::Vector2f viewSize = windowSize;

    // clip ratio
    float ratio = viewSize.x / viewSize.y;
    if(ratio < minRatio) // too high
        viewSize.y = viewSize.x / minRatio;
    else if(ratio > maxRatio) // too wide
        viewSize.x = viewSize.y * maxRatio;

    sf::View view(sf::FloatRect(sf::Vector2f(), viewSize));

    sf::FloatRect viewport((windowSize - viewSize) / 2.f, viewSize);
    viewport.left /= windowSize.x;
    viewport.top /= windowSize.y;
    viewport.width /= windowSize.x;
    viewport.height /= windowSize.y;
    view.setViewport(viewport);

    return view;
}

18
Audio / Re: Trouble loading audio from memory.
« on: March 05, 2014, 07:50:55 pm »
Hello,

In your getMusic function,
Quote
if(musicBuffer[i])
{
    /* initialize */
}

Didn't you mean this ?
if(!musicBuffer[i])
(notice the negation '!')

19
Network / Re: downloading image for sfml resource use
« on: November 12, 2013, 09:22:18 pm »
You have to set http host target and only give the URI to the request constructor.
Have a look at the documentation

This code should work. Notice I use a reference to response body so it is not copied in a new string.
#include <SFML/Network.hpp>
#include <fstream>

int main(){
    sf::Http http("i1297.photobucket.com");
    sf::Http::Request req("/albums/ag23/metulburr/walker_zpsbd2d34be.png");
    sf::Http::Response image_res = http.sendRequest(req);

    const std::string& body = image_res.getBody();
    std::ofstream file("tux.png", std::ios::binary);
    file.write(body.c_str(), body.size());
}

20
General discussions / Re: SFML Game Jam
« on: August 01, 2013, 11:46:49 am »
Quote
The jam will start 15 UTC August 2nd  and end 72 hours later on August 4th.
To my understanding, there is only 48 hours between August 2nd and August 4th.
Did I missed something ?

21
Graphics / Re: SFML text class not working
« on: March 14, 2013, 10:02:58 pm »
Hi,
It makes me notice that the documentation for sf::Text needs an update.
The usage example is outdated. See this line.

22
Graphics / Re: sf::Text not appearing on the screen v2
« on: January 06, 2013, 09:19:09 pm »
I suggest that you add a draw method to the Player class and draw the debugText there.
The problem here is that you draw the debugText in Player::upate and then clear the screen in PlayState::draw so the debugText is cleared.

23
Graphics / Re: Having trouble drawing zombies
« on: November 19, 2012, 07:55:00 pm »
what about :
    player = player->createPlayer();
(in PlayState constructor)

player is uninitialized !

24
SFML projects / Re: SFML-Sidescroller: Version 0.07 released!
« on: November 10, 2012, 03:00:13 pm »
The only thing that is left uncleared is a better security mechanism for "browser hacking" ;)

I tried it, and I did it without effort.
With a packet capture tool, I got the HTTP request to do and it worked with Firefox.

You should at least check that the user-agent is libsfml-network/2.x and the from field is user@sfml-dev.org. It would prevent "browser hacking" but not hacking with a http requester tool.

I also noticed that a negative time is accepted by the server.

25
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 03:09:24 pm »
You did it well.
I don't understand why you still have this issue.
I hope someone else can help.

26
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 02:56:12 pm »
What code did you add exactly ?

27
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 02:06:11 pm »
You have to limit framerate.
You can use setFramerateLimit or setVerticalSyncEnabled.

Pages: 1 [2]
anything