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

Pages: [1]
1
Hi,
I'm try to use sfml-network on Mac. Everything is compile fine and work ok until when i use method sendRequest, after this I have

sfmlNetwork(13838,0x7fff7de66960) malloc: *** error for object 0x7fff7e1e0860: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
(lldb)
 


Code:
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include "ResourcePath.hpp"
#include <iostream>

int main (int argc, const char * argv[])
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Texture texture;
    if (!texture.loadFromFile(resourcePath() + "cute_image.jpg"))
        return EXIT_FAILURE;
    sf::Sprite sprite(texture);

    // Create a graphical text to display
    sf::Font font;
    if (!font.loadFromFile(resourcePath() + "sansation.ttf"))
        return EXIT_FAILURE;
    sf::Text text("Hello SFML", font, 50);
    text.setColor(sf::Color::Black);
   
    sf::Http http;
    http.setHost("http://s1t.ubergridgame.net");
   
    // Prepare a request to get the 'features.php' page
    sf::Http::Request request("index.php");
   
    // Send the request
   
    http.sendRequest(request);
    sf::Http::Response response;
   
    // Check the status code and display the result
    sf::Http::Response::Status status = response.getStatus();
    if (status == sf::Http::Response::Ok)
    {
        std::cout << response.getBody() << std::endl;
    }
    else
    {
        std::cout << "Error " << status << std::endl;
    }

    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
                // Close window : exit
                if (event.type == sf::Event::Closed)
                        window.close();
           
                // Escape pressed : exit
                if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
                        window.close();
        }

        // Clear screen
        window.clear();
       
        // Draw the sprite
        window.draw(sprite);
       
        // Draw the string
        window.draw(text);

        // Update the window
        window.display();
    }

        return EXIT_SUCCESS;
}

 

Any tips for me ?

2
Graphics / Re: [SFML 2.0 RC] probably a bug - Sprite::setPosition
« on: May 20, 2012, 10:34:12 am »
Sorry, understood.

Prox

PS: I'll update this post when I create a sample.

3
Graphics / Re: [SFML 2.0 RC] probably a bug - Sprite::setPosition
« on: May 20, 2012, 10:21:04 am »
I've just sent a PM to you with link to source code.

Prox

4
Graphics / Re: [SFML 2.0 RC] probably a bug - Sprite::setPosition
« on: May 20, 2012, 09:41:56 am »
The code
float move = delta*speed;
int y = 0;
for(it=grid.begin(); it != grid.end(); it++){
        y = (*it)->sprite.getPosition().y;
        (*it)->sprite.setPosition(0, y+move);
        //y = (*it)->sprite.getPosition().y;
        //(*it)->sprite.move(0, move);

}
 

EDIT: I can share a Mac bundle if need.

5
Graphics / [SFML 2.0 RC] probably a bug - Sprite::setPosition
« on: May 20, 2012, 09:30:52 am »
Hi everyone,
Yesterday, I've been started moving my project to SFML 2.0 RC  and I found big issue for me. When I want to change a position with combination Sprite::getPosition() and Sprite::getSetPosition(float, float), the sprite changes the scale, but if i use Sprite::move(float, float) there is no issue with scale. Any suggestions?

Prox

PS: I use Mac os x 10.7.4

Pages: [1]