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

Pages: [1] 2 3 ... 10
1
General / Re: Taking a Screenshot (Issue)
« on: March 31, 2016, 06:40:58 am »
If you want to take the screenshot instantly, it probably shouldn't be dependent on whether Generate_Item is true (and it is dependent in the code you supplied.)

3
General discussions / Re: A new logo for SFML
« on: April 23, 2013, 08:10:44 pm »
I'm not a big fan of the wavy arrow.  To me, it looks like SFML printed over a road, path or ribbon with the arrow indicating the direction it should be traveled or (in the case of the ribbon) pulled.

4
General discussions / Re: A new logo for SFML
« on: April 22, 2013, 03:26:14 pm »
I was intrigued by the arrow idea, but I thought there should be a little more movement.


5
General / Re: How can I create a drag and drop function?
« on: March 09, 2013, 11:33:10 am »
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

//Glboal variables, functions, classes

//C++ program entry point
int main()
{
    //Creating the window
    sf::RenderWindow window(sf::VideoMode(1280, 800), "SFML Game");

    //Settign the framerate limit to 60 FPS
    window.setFramerateLimit(60);

    window.setKeyRepeatEnabled(false);

    //Variable that keeps the game loop running
    bool play = true;

    //Event object holding all events
    sf::Event event;

    //States for button/events
    bool mouseClicked = false;
    bool mouseInsideRect = false;
    bool dragging = false ;

    sf::Vector2f mouseRectOffset ;

    //Variables
    int mouseX = 0;
    int mouseY = 0;

    //Images

    //Render shapes
    //Rectangle Shape
    sf::RectangleShape rect;
    rect.setSize(sf::Vector2f(200, 200));
    rect.setPosition(640, 400);
    rect.setFillColor(sf::Color::White);
    rect.setOrigin(100, 100);

    //Font

    //Text


    //Game loop
    while (play == true)
    {
        //EVENTS
        while (window.pollEvent(event))
        {
            //LMB Pressed
            if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left)
            {
                mouseClicked = true;

                if ( rect.getGlobalBounds().contains(event.mouseButton.x, event.mouseButton.y) )
                {
                    dragging = true ;
                    mouseRectOffset.x = event.mouseButton.x - rect.getGlobalBounds().left - rect.getOrigin().x ;
                    mouseRectOffset.y = event.mouseButton.y - rect.getGlobalBounds().top - rect.getOrigin().y ;
                }
            }

            //LMB released
            if (event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left)
            {
                mouseClicked = false;
                dragging = false ;
            }

            //Mouse Moved in window
            if (event.type == sf::Event::MouseMoved)
            {
                mouseX = event.mouseMove.x;
                mouseY = event.mouseMove.y;
            }

            //Event type is window closed
            if (event.type == sf::Event::Closed)
            {
                //Set play to false in order to stop the game loop
                play = false;
            }
        }

        //LOGIC

        if (dragging == true)
        {
            rect.setPosition(mouseX - mouseRectOffset.x, mouseY - mouseRectOffset.y);
        }

        //RENDERING
        window.clear();

        window.draw(rect);

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

    //Clean up and close the window
    window.close();

    //Close the program
    return 0;
}

6
General / Re: sf::View / sf::Shape Glitch
« on: February 28, 2013, 05:57:59 am »
I don't see the behavior you describe when I run this code.

7
Graphics / Re: sf::Text disappearing characters [SFML 2.0]
« on: February 25, 2013, 08:03:30 pm »
Quote
That did not help... Part of the additional information is that the font is not the problem, unless I'm reading that wrong. Yes, there is always 6 messages, but the first one is obviously the first call to addChat

I didn't say that the font was the problem.  What I intended to convey was: "I changed the font, so don't blindly copy this without changing it back to something appropriate for your environment."  It was just a heads up.

8
Graphics / Re: sf::Text disappearing characters [SFML 2.0]
« on: February 25, 2013, 08:01:54 am »
Yes, I'm sure that I'm not drawing it on a black background. If you took the time to check the additional information you would see that I'm able to see the first message without having characters missing >.>

If you took the time to actually post working compilable code that exhibits the problem...
but I actually did take the time to check the additional information.  Unfortunately it isn't clear.

What do you mean by first message?  There are 6 messages at all times.  If you can only see the top one which is printed in red (which one might assume you would call the "first" message), then it's a reasonable question to ask.

The following works perfectly fine for me (Note that if this is copy and pasted, you will likely need to change the font that's loaded:)

#include <SFML/Graphics.hpp>
#include <string>

sf::Text chatHistory[6] ;
sf::Font chatFont ;

void addChat(std::string username,int rights,std::string message) ;
void drawChat(sf::RenderWindow& window) ;
void chatInit() ;

std::string simulatedInput[] =
{
    "Abracadabra!",
    "I love m&ms!",
    "No, skittles are the best.",
    "Don't make me laugh.",
    "Wouldn't dream of it.",
    "I heard you dream about your mom.",
    "Nah.  It's your mom I dream about.",
    "You must mean you have a nightmare.",
    "Are you kidding?  Your mom is hot.",
};

const unsigned inputSize = sizeof(simulatedInput) / sizeof(simulatedInput[0]) ;
unsigned inputIndex = 0 ;

int main()
{
    sf::RenderWindow window( sf::VideoMode(800, 600), "sf::Text test" ) ;

    chatInit() ;

    while ( window.isOpen() )
    {
        sf::Event event ;
        while ( window.pollEvent(event) )
        {
            if ( event.type == sf::Event::Closed )
                window.close() ;

            if ( event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::Return )
            {
                addChat("cire", 0, simulatedInput[inputIndex]) ;
                inputIndex = (inputIndex+1) % inputSize ;
            }

        }

        window.clear(sf::Color::Blue) ;
        drawChat(window) ;
        window.display() ;
    }

}

void drawChat(sf::RenderWindow& window) {
    for(int i=0;i<=5;i++) {
        window.draw(chatHistory[i]);
    }
}

void chatInit() {
    chatFont.loadFromFile("sketchflow.ttf");
    for(int i=0;i<=5;i++) {
        chatHistory[i].setFont(chatFont);
        chatHistory[i].setColor(sf::Color::Black);
        chatHistory[i].setCharacterSize(16);
        chatHistory[i].setString("a");
        chatHistory[i].setPosition(25,i*25+20);
    }
    addChat("SERVER",1,"Welcome to the server!");
}


void addChat(std::string username,int rights,std::string message) {
    std::string chat;
    if(rights>0) {
        chat="[ADMIN] "+username+": "+message;
    }
    else {
        chat=username+": "+message;
    }
    std::string tempChat[6];
   
    for(int i=0;i<=5;i++) {
        tempChat[i]=chatHistory[i].getString();
    }
    chatHistory[0].setColor(sf::Color::Red);
    chatHistory[0].setString(chat);
    chatHistory[1].setString(tempChat[0]);
    chatHistory[2].setString(tempChat[1]);
    chatHistory[3].setString(tempChat[2]);
    chatHistory[4].setString(tempChat[3]);
    chatHistory[5].setString(tempChat[4]);
}


9
Graphics / Re: sf::Text disappearing characters [SFML 2.0]
« on: February 25, 2013, 06:50:57 am »
Any chance you're trying to draw that black text on a black background?

10
General / Re: Strangest sf::sleep bug
« on: February 19, 2013, 08:16:31 am »
It would seem that it does.

Some interesting info here.

13
Graphics / Re: White box on startup
« on: February 09, 2013, 06:06:07 am »
You resize the window, but you don't update the drawing area...  Why don't you just create the window the size you want it to begin with?

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window;
    window.create(sf::VideoMode(320, 240, 32), "test");
    window.setSize(sf::Vector2u(960,720));
    window.clear();
    window.display() ;
    // ...
 

14
return spriteImage.getTexture()->getSize().x / amountOfFramesX ;

getTexture
returns a pointer (as the error message indicates.)

15
General discussions / Re: A new logo for SFML
« on: February 03, 2013, 10:01:25 pm »
A little more screwing around!



I just noticed that the SFML + clover should be shunted to the left a bit.  I'll have to do that sometime in the near future.

"Multimedia" is just too damn long.  I'm not sure I'm a fan of spelling it out, anyway, but I thought I'd see what it looked like.

Pages: [1] 2 3 ... 10