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

Pages: [1]
1
Graphics / Trying to use sf::Color but getting an unresolved external
« on: January 27, 2010, 01:59:20 am »
Code: [Select]

1>Main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Magenta" (?Magenta@Color@sf@@2V12@B)
1>C:\Users\Kadajett\Documents\Visual Studio 2008\Projects\Cropper\Debug\Cropper.exe : fatal error LNK1120: 1 unresolved externals

2
General / Mouse and sprite distance formula always return true...
« on: December 16, 2009, 05:23:51 pm »
Now that I look at that code, it makes me want to cry a little. I am throwing it all into classes now. Since I have a basic knowledge of  SFML. I am renaming all of the variables to go along with my style. And my game is progressing very well.

3
General / Mouse and sprite distance formula always return true...
« on: December 16, 2009, 12:59:54 pm »
Sorry about the readability, I was so tired when I wrote that when I was half asleep and I was getting frustrated. Thanks for the help, it worked. Kinda angry cause I didn't see anything about that in my reading :P

I appreciate it.

4
General / Mouse and sprite distance formula always return true...
« on: December 16, 2009, 12:25:22 pm »
My fault :) I must have deleted it when I was copy pasting it to the forum

Code: [Select]
#include <SFML/Graphics.hpp>
#include <math.h>
#include <iostream>
#include <string>

using namespace std;

bool checkCollision(int x1, int x2, int y1, int y2);

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

    sf::Image Gah;
    if(!Gah.LoadFromFile("Arrow.png"))
        return 1;

    sf::Sprite sprite;
    sprite.SetImage(Gah);

    sf::Font MyFont;
    sf::String mouseX("Hello World", MyFont, 30.0 );

    sprite.SetPosition(100.0, 100.0);
    // 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();
        }

        if (checkCollision(sprite.GetPosition().x, input.GetMouseX(), sprite.GetPosition().y, input.GetMouseY()))
        {
            sprite.FlipX(true);
        }

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

        App.Draw(sprite);
        App.Draw(mouseX);
        if (checkCollision(sprite.GetPosition().x, input.GetMouseX(), sprite.GetPosition().y, input.GetMouseY()))
        {
            sprite.FlipX(true);
        }
        if (!checkCollision(sprite.GetPosition().x, input.GetMouseX(), sprite.GetPosition().y, input.GetMouseY()))
        {
            sprite.FlipX(false);
        }

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

    return EXIT_SUCCESS;
}

bool checkCollision(int x1, int x2, int y1, int y2)
{
    float dis = sqrt((float)( ((x2-x1)*(x2-x1)) + ((y2-y1)*(y2-y1))) );

    if (dis <= 150)
    {
        cout << "collide!" << endl;
        return true;
    }
    else
    {
        cout<< "not collide" << endl;
        return false;
    }

    return false;
}


5
General / Mouse and sprite distance formula always return true...
« on: December 16, 2009, 04:50:15 am »
Any Ideas?
Code: [Select]
#include <SFML/Graphics.hpp>
#include <math.h>
#include <iostream>
using namespace std;

bool checkCollision(int x1, int x2, int y1, int y2);

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

sf::Image Gah;
sf::Input input;



if(!Gah.LoadFromFile("Arrow.png"))
{return 1;}
sf::Sprite sprite;
sprite.SetImage(Gah);





sprite.SetPosition(100.0, 100.0);
    // Start game loop
    while (App.IsOpened())
    {
sf::Event Event;



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



sprite.FlipX(true);
}


        // Clear the screen (fill it with black color)
        App.Clear();
cout<< "drawing sprite"<<endl;
App.Draw(sprite);

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

    return EXIT_SUCCESS;
}



bool checkCollision(int x1, int x2, int y1, int y2)
{
float dis;

dis = sqrt((float)( ((x2-x1)*(x2-x1)) + ((y2-y1)*(y2-y1))) );

if(dis <= 30)
{
cout << "collide!" << endl;
return true;
}
if(dis >= 31)
{
cout<< "not collide" << endl;
return false;
}

return false;
}

Pages: [1]
anything