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

Pages: [1]
1
Graphics / Comparing Coordinates
« on: August 28, 2009, 02:43:18 pm »
Quote from: "Devil0150"
You want to stop ur sprite from going out of the screen when moving, is that right? If thats what you want, u could use something like this.

Code: [Select]
if (mySprite.GetPosition().y > myWindow.GetWidth())
    {
          // sprite stops moving
     }

If thats not what you wanted, tell me with what u want to compare the sprite coordinates.

Edit: Tell me where are you from and maybe I can speak ur language.


oh yeah that's it.
exactly what i needed :D
thanks a lot.
but now i have another question =)
while i was working with SDL, there were a
function which starts an animation of a sprite.
do u know the same in sfml?
ps:i am from germany ;)

Ancient

2
Graphics / Comparing Coordinates
« on: August 27, 2009, 06:33:28 pm »
Quote from: "Devil0150"
I dont understand very well what you are asking, but if you want to find the coordinates of ur sprite, you can use the GetPosition function.


ty at first. yeah youm are right i didn't know to
write that in english but that what you have written is a good idea.
But i need something to compare the position.i think .GetPosition
does only give out the pos. with 'return MyPosition'.
now u understand my question?


Ancient :wink:

3
Graphics / Comparing Coordinates
« on: August 27, 2009, 06:23:44 pm »
Hello Commnutiy ;)

I have another problem today and
it would be really gentil if u help me. :D

i wated to code a background and a sprite on it.no prob.
but now, i need to compare the coordinates so that the
sprite isnt able to go over the background.u understand?
the background has a size and if the player go over the map
he will maybe try to go over this size.

i looked in the docs  but there are only functions to flip or
to set the sprite.setting would be useful if i know the coords.
pls help.


Ancient

4
Graphics / New prob with sprite loading
« on: August 22, 2009, 02:37:12 pm »
I got it!

thanks to you Hiura : You were right.
I put it into the wrong directory so that he couldnt find
it.
thanks guys....






best wishes Ancient

5
Graphics / New prob with sprite loading
« on: August 22, 2009, 01:21:33 pm »
Quote from: "eleinvisible"
I'm just wondering why there isn't a ! in
Code: [Select]
if (Image.LoadFromFile("Brot.png"))
    return EXIT_FAILURE;
... that would mean it returns fail even if it loads fine?


i tryed some ideas but nothing work
here is antoher code->same mistakes

i took it from the thread above so,
dont wonder :D
Code: [Select]

#include <SFML/Graphics.hpp>

using namespace sf;

int main(int argc, char *argv[])
{
    RenderWindow App(VideoMode(800,600,32), "Test", Style::Titlebar);
    App.Clear(Color(255,255,255));

    Image i_one;
    if( !i_one.LoadFromFile("rabe.jpg") )
        return EXIT_FAILURE;
    Sprite s_one(i_one);

    Image i_two;
    if( !i_two.LoadFromFile("rabe.jpg") )
        return EXIT_FAILURE;
    Sprite s_two(i_two);

    App.Draw(s_one);
    App.Draw(s_two);
    App.Display();
    Sleep(1.0f);
    App.Close();

    return EXIT_SUCCESS;
}


while im compiling i get warnings like that:
Code: [Select]

||Info: resolving vtable for sf::Spriteby linking to __imp___ZTVN2sf6SpriteE |
||warning: auto-importing has been activated without --enable-auto-import specified on the command line.|
||=== Build finished: 0 errors, 1 warnings ===|

does someone know what that means?



Ancient

6
Graphics / New prob with sprite loading
« on: August 21, 2009, 03:52:27 pm »
Quote from: "Hiura"
das Brot = bread  :wink:


ok everyone makes mistakes
but please help me to find the reason for the error





Ancient

7
Graphics / New prob with sprite loading
« on: August 21, 2009, 02:51:47 pm »
Quote from: "Laurent"
Quote
Code: [Select]
"Brot.png"

Isn't it "bred.png" from your screenshot?


yes
i changed it becuase i thought u would
understand it much better in english than in german  :lol:
but it's the same.Also, if i change it,
the problem stays...

and u see, the font wont work either


Ancient

8
Graphics / New prob with sprite loading
« on: August 20, 2009, 05:35:07 pm »
Quote from: "Laurent"
Looks like your working directory is not the directory containing the exe.


of course it is



Code: [Select]

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Ancients Program");

    sf::Image Image;
    if (Image.LoadFromFile("Brot.png"))
    return EXIT_FAILURE;
    sf::Sprite Sprite(Image);

    sf::Font Arial;
    if (!Arial.LoadFromFile("Times.ttf"))
        return EXIT_FAILURE;
        sf::String Text("Ancient was here", Arial, 50);

    while (App.IsOpened())
    {

        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if(!Image.LoadFromFile("Brot.JPG"))
            {
            }
            if (Event.Key.Code == sf::Key::Escape)
                {
                    App.Close();
                }
            if (Event.Type == sf::Event::Closed)
                    App.Close();

        }

        App.Clear(sf::Color(200, 0 , 0, 100));

        App.Draw(Sprite);

        App.Draw(Text);

        App.Display();
    }

    return EXIT_SUCCESS;
}

9
Graphics / New prob with sprite loading
« on: August 20, 2009, 04:07:41 pm »
hi again.

my problem is, that i wanted to open and load a sprite.
but now, he gives me an error-message:

Failed to load image "bred.png". Reason : Unable to open file.

the sprite is there were the *.exe is.
and another error ewhile i was trying to get some text:

Failed to load font "Times.ttf" <cannot open ressource>

pls help

Ancient

10
Graphics / Problem with SFML-compiling
« on: August 13, 2009, 08:20:51 pm »
ty Laurent

it works.
i thought it could work without window, because
in the tutorial it sais:
SFML/Window.hpp is no more explicitly requiered, as it is already included by the graphics package.




Ancient

11
Graphics / Problem with SFML-compiling
« on: August 13, 2009, 07:36:36 pm »
helllo community!

i wanted to work a bit with the sfml.
So I downloaded the files and worked
a bit with the tuts.

But now i have the problem,when i try
to compile a program, he gives out some error-messages.

Code: [Select]

C:\C++\SFML\main.cpp|7|undefined reference to `__imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsmRKNS_14WindowSettingsE'|
C:\C++\SFML\main.cpp|22|undefined reference to `__imp___ZN2sf5ColorC1Ehhhh'|
C:\C++\SFML\main.cpp|22|undefined reference to `__imp___ZN2sf12RenderTarget5ClearERKNS_5ColorE'|
C:\C++\SFML\main.cpp|28|undefined reference to `sf::RenderWindow::~RenderWindow()'|
C:\C++\SFML\main.cpp|28|undefined reference to `sf::RenderWindow::~RenderWindow()'|
||=== Build finished: 5 errors, 0 warnings ===|


And the Code:
Code: [Select]

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

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


please help

Ancient

Pages: [1]