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 - 2ant

Pages: [1]
1
General / Re: Need help compiling/building
« on: February 25, 2015, 10:25:19 pm »
Thank you for your answer exploit3r,

If reading the faq answered my questions i wouldn't have posted here.

I tried a nighly build of sfgui and it didn't work for sfml 2.2.

I don't have an ext lib folder, i tried redoing the codeblocks step but no option work now.

I'll go ask on the sfgui forum


2
General / Need help compiling/building [UNSOLVED]
« on: February 25, 2015, 07:11:27 pm »
Hi,i would like to use sfml with sfgui.
If i understand correctly the last version of sfgui require me to build sfml from the git files first.

I manage to compile SFML-master with cmake gui with no errors.
I built the sfml project file with codeblocks and i chose install .

I dl glew-1.12.0-win32 and SFGUI-0.2.3-source.

I get this when i clic configure:



I indicate the glew include and glew library and i clic configure again and i get this:



I indicate the sfml folder that codeblocks created and i get this:



I am not very familiar with cmake so i don't know what to do now.

Should i rebuild sfml ? Is there any precompiled sfgui libs that can work with sfml 2.2 or sfml git ?

Please help the debutant that i am.

3
Graphics / Re: collisions with mouse
« on: February 24, 2015, 08:07:30 pm »
I think i found what you need :

http://www.sfml-dev.org/tutorials/2.2/graphics-transform.php

In the bouding box section there is this :

// get the bounding box of the entity
sf::FloatRect boundingBox = entity.getGlobalBounds();

// check collision with a point
sf::Vector2f point = ...;
if (boundingBox.contains(point))
{
    // collision!
}

Make the "point" contain your mouse coordinates and i will work ( i think :) )

4
Graphics / Re: Little questions/issue about view.move [SOLVED]
« on: February 24, 2015, 05:17:06 pm »
Thank you Laurent !

I don't even remember why i did it this way  ::)

while (window.pollEvent(event))
            {
                switch (event.type)
                {
                    case sf::Event::Closed:
                        window.close();
                        break;

                    case sf::Event::KeyPressed:
                        {
                            if (event.key.code == sf::Keyboard::S)
                                {
                                    view.move(0, -32);
                                }
                            else if (event.key.code == sf::Keyboard::X)
                                {
                                    view.move(0, 32);
                                }
                            else if (event.key.code == sf::Keyboard::W)
                                {
                                    view.move(-32, 0);
                                }
                            else if (event.key.code == sf::Keyboard::C)
                                {
                                    view.move(32, 0);
                                }

5
Graphics / Re: Little questions/issue about view.move
« on: February 24, 2015, 04:27:02 pm »
Thank you for your fast answer, i forgot to post the "event" lines :

I have this:

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

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
                {
                    view.move(0, -32);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::X))
                {
                    view.move(0, 32);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
                {
                    view.move(-32, 0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::C))
                {
                    view.move(32, 0);
                    title += " XX";
                    window.setTitle(title);
                }
 

I added this:
title += " XX";
window.setTitle(title);
And it briefly show four X each time the camera moves.

Should i post my entire (not so long) code ?

6
Graphics / Little questions/issue about view.move [SOLVED]
« on: February 24, 2015, 03:33:29 pm »
Hi,i'm learning both c++ and sfml and i did a simple camera movement with 4 keyboard keys.

sf::View view(sf::FloatRect(0, 0, 640, 360));

window.setView(view);

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))//move the camera up
                {
                    view.move(0, -32);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::X))//move the camera down
                {
                    view.move(0, 32);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))//move the camera left
                {
                    view.move(-32, 0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::C))//move the camera right
                {
                    view.move(32, 0);
                }
 

My problem is that the camera move double the distance.

example : view.move(32, 0) will make the view/camera move 64 pixels to the right and not 32.

Is that normal ?
Why ?

7
General / Re: Need a tiny little bit of help
« on: February 20, 2015, 10:26:47 pm »
Thank you very much Gan for your fast answer  :)

I am beginner in both c++ and sfml and i had no idea this was possible, guess i have a lot more to learn

I am testing each thing i will need for a game and for now i can check the position of my cursor directly.



How do i mark this thread as SOLVED ?

8
General / Need a tiny little bit of help [Solved]
« on: February 20, 2015, 10:08:44 pm »
Hi, currently i display the position of a sprite in the titlebar for monitoring purposewith this code:

sf::Vector2f positioncurseur = curseur.getPosition();

std::string cursx = std::to_string ( positioncurseur.x );
std::string cursy = std::to_string ( positioncurseur.y );

title += cursx;
title += " ";
title += cursy;

It works well and give me this :



It annoy me since it is for a t-rpg with a grid so no decimals are needed.

Is it possible to remove the zeroes and the dot without too many lines of code ?

9
Window / Re: Cursor position in title bar
« on: October 09, 2014, 07:53:44 am »
SOLVED

10
Window / Re: Cursor position in title bar
« on: October 08, 2014, 09:22:00 pm »
That solved it.

I feel dumb, i need to continue to learn c++

code with comments :

    sf::Vector2i position = sf::Mouse::getPosition(window); // get the position of the cursor inside the window

        string title ( "SFML ");//create a string with "sfml" writtent in it

        std::string posx = std::to_string ( position.x );//convert the x coordinate from int to string
        std::string posy = std::to_string ( position.y );//convert the y coordinate from int to string

        title += posx;//add the x coordinate after "sfml" in the title string
        title += " ";//add a space in the title string
        title += posy;//add the y coordinate after the space in the title string

        window.setTitle(title);//set the title of the window to what is written in the title string

Thank you very much Laurent for your answer and for your work SFML is awesome !


11
Window / Re: Cursor position in title bar
« on: October 08, 2014, 08:43:39 pm »
Thank you for your very usefull answers Strelok and Nexus,

i have done this

sf::Vector2i position = sf::Mouse::getPosition(window);

    string title ( "SFML ");

    std::string posx = std::to_string ( position.x );
    std::string posy = std::to_string ( position.y );

    title += posx;
    title += posy;

    sf::Window::setTitle(title);

but i get this error (i'm using codeblocks):

error: cannot call member function 'void sf::Window::setTitle(const sf::String&)' without object

I don't know what to do to fix it .

12
Window / Cursor position in title bar
« on: October 08, 2014, 06:42:52 pm »
Hi everyone, i'm new at using c++ and sfml.

I need to display the cursor position in the title bar next to the title.

I tried this :

sf::Vector2i position = sf::Mouse::getPosition(window);

    sf::String title ;

    title += position.x;
    title += position.y;

    sf::Window::setTitle(title);

My problem is that position.x and position.y give a int and i need to put them in a sf::String.

Can someone help me fix this.

Do you know another way to do it ?

Pages: [1]
anything