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

Pages: [1]
1
General / Failed to change to fullscreen
« on: June 30, 2009, 10:23:15 pm »
I thought it might be my code so I opened up one of the tutorials and used that code and it still happens:
Code: [Select]

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


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Load the sprite image from a file
    sf::Image Image;
    if (!Image.LoadFromFile("sprite.tga"))
        return EXIT_FAILURE;

    // Create the sprite
    sf::Sprite Sprite(Image);

    // Change its properties
    Sprite.SetColor(sf::Color(0, 255, 255, 128));
    Sprite.SetPosition(200.f, 100.f);
    Sprite.SetScale(2.f, 2.f);

    // 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();
        }

        // Get elapsed time
        float ElapsedTime = App.GetFrameTime();

        // Move the sprite
        if (App.GetInput().IsKeyDown(sf::Key::Left))  Sprite.Move(-100 * ElapsedTime, 0);
        if (App.GetInput().IsKeyDown(sf::Key::Right)) Sprite.Move( 100 * ElapsedTime, 0);
        if (App.GetInput().IsKeyDown(sf::Key::Up))    Sprite.Move(0, -100 * ElapsedTime);
        if (App.GetInput().IsKeyDown(sf::Key::Down))  Sprite.Move(0,  100 * ElapsedTime);

        // Rotate the sprite
        if (App.GetInput().IsKeyDown(sf::Key::Add))      Sprite.Rotate(- 100 * ElapsedTime);
        if (App.GetInput().IsKeyDown(sf::Key::Subtract)) Sprite.Rotate(+ 100 * ElapsedTime);

        // Clear screen
        App.Clear();

        // Display sprite in our window
        App.Draw(Sprite);

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

    return EXIT_SUCCESS;
}

2
General / Failed to change to fullscreen
« on: June 30, 2009, 07:11:35 pm »
The latest version didnt change anything. :(

3
General / Failed to change to fullscreen
« on: June 30, 2009, 07:55:47 am »
Nope, this is a laptop and I have nothing plugged in at all.

4
General / Failed to change to fullscreen
« on: June 30, 2009, 06:39:13 am »
64 bit Vista.  I have about 10 different little demos I had created a few months ago using SFML and they all worked fine but now each one fails to go into fullscreen and instead it just has a title bar at the top without any buttons.

Here is the only code I thought that would be relevant:
Code: [Select]

sf::VideoMode mode;
mode = sf::VideoMode::GetMode(0);
sf::RenderWindow game(mode, "Gamma", sf::Style::Fullscreen);


If you would like to see the entire source for one of them ill post it.  By the way this isnt the newest version of SFML, its from sometime around early January I believe.

5
General / Failed to change to fullscreen
« on: June 29, 2009, 08:26:17 am »
I havnt touched my projects using SFML in a months and I went to compile one and everything went fine, but my error log said "Failed to change display mode to fullscreen" and its in windowed mode.  Whats up? Last time I checked the code ran in fullscreen just fine..

help anyone?

6
Graphics / Help with using Rect
« on: January 16, 2009, 08:28:52 pm »
Thanks a lot!  I got it working.
But just for the record, Contains doesnt take a Vector2f, it takes 2 ints.

7
Graphics / Help with using Rect
« on: January 16, 2009, 08:25:47 am »
Did you mean for that link to be a youtube video of Mirrors Edge? lol..
EDIT: Ok I see you fixed the link, thanks!  Would you mind applying that to my code because ive shown many variations of my code as it has progressed and I would like to see how you mean to use it.  thanks!

8
Graphics / Help with using Rect
« on: January 16, 2009, 08:01:10 am »
I decided to dive in and make my own crude pixel-inside-sprite check.

Here is how I am checking if the mouse's coords are within the sprite.  I also show how I setup a few tiles (which are stored in an array of sprites).

Code: [Select]

tiles[0].SetPosition(0.0f, 400.0f);
tiles[0].SetRotation(45.0f);
tiles[1].SetPosition(48.0f, 400.0f-48.0f); //puts the 2nd tile by the 1st with
tiles[1].SetRotation(45.0f);                   //some space inbetween.

for(int i = 0; i < 36; i++)
{
    if(mouseX >= tiles[i].GetPosition().x)
        if(mouseX <= (tiles[i].GetSize().x + tiles[i].GetPosition().x))
     if(mouseY >= tiles[i].GetPosition().y)
       if(mouseY <= (tiles[i].GetSize().y + tiles[i].GetPosition().y))
     game.Draw(tiles[i]);
}


Im guessing that this isnt working because of the sprites being rotated.
But can someone please give me a solution!  There has to be a means to do this lol.  All I want to do is when the mouse is over a tile, then its going to highlight it, just like in a chess or checkers program.

EDIT:  Yep it is because of the tiles being rotated 45 degrees.  I undid this and it works perfectly.  Now can someone just help me figure out how to accomodate for the 45 degree rotation?

9
Graphics / Help with using Rect
« on: January 16, 2009, 06:59:27 am »
Im still not really sure why my code above didnt work, is it because it uses relative coordinates when im expecting it to use global coordinates (which I dont see a purpose for it to be limited to relative..that makes it useless as far as I can tell!)

But I found some code for collision testing under the French Wiki's Code Source section (no I dont know French but it was the only resource I could find since its still unclear why my above method wont work.)

Now I am once again having a similar problem.
Code: [Select]

mouseX = game.GetInput().GetMouseX();
mouseY = game.GetInput().GetMouseY();

for(int i = 0; i < 36; i++)
{
if(!tiles[i].GetSubRect().Contains(mouseX, mouseY))
game.Draw(tiles[i]);
}


If a mouse is over a tile, as a test I was expecting it to just not be drawn.  But NO MATTER WHAT, that Contains method returns TRUE.

Can someone please tell me what I am doing wrong?
Thanks

10
Graphics / Help with using Rect
« on: January 15, 2009, 11:30:30 pm »
Im trying to check collision between two sprites so I am doing:
Code: [Select]

rectA = player.GetSubRect();
rectB = portal.GetSubRect();
cout << rectA.Intersects(rectB);


Where rectA and rectB are IntRects.  No matter what Intersects is returning true.  Am I going about this the wrong way?

11
Graphics / Equivalent to SetColorKey?
« on: January 14, 2009, 08:44:26 am »
What is SFML's equivalent to SDL's SetColorKey?

It lets you pick what color should be translucent in the image.
Thanks

Pages: [1]
anything