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

Pages: 1 ... 6 7 [8] 9 10 ... 12
106
Graphics / SFML 2.0: GetFrameTime
« on: May 25, 2011, 08:59:44 pm »
Hi,
I've updated SFML 2.0 to the latest snapshot today and for some reason whenever I use GetFrameTime it's returning me 15.0 while I'm limiting the frames to 60.
I've confirmed that the frames are limited to 60 with Fraps but the function seems to return a strange value. Were there any changes on this function lately? I can't find anything on the documentation.

Also EnableVerticalSync doesn't seem to work anymore. The frames fire up to 5000 when I'm using it and GetFrameTime returns 0.

Everything worked fine before I've updated so I don't know what could be wrong. Compiled with VS10 and CodeBlock's MinGW and both act like this.

Thanks in advance for any input.

107
Graphics / Stack around the variable "MyFont" was corrupted.
« on: May 19, 2011, 08:40:34 am »
Quote from: "OniLink10"
Do NOT use the default font. Last I checked, it's completely broken and results in errors. It might just be a specific version of SFML, though.
That's odd. Isn't it just a copy of the Arial font? Should I always provide a font file instead? Sorry for the thread-hijacking, just curious.

108
General discussions / vertical sync
« on: April 22, 2011, 07:08:17 pm »
Sorry for bumping this topic.
Just wanted to say that I tested on an old Dell Optiplex GX270 with an Intel onboard graphics chip and the problem persists.  

So I guess the problem is caused be Intel's crappy drivers, I think.

109
General / sf::Image problem with STL vector
« on: April 15, 2011, 01:54:49 pm »
If you're trying to manage/store your drawbles (Sprites, text, etc), I would suggest you to read this:
[SFML Wiki]LAYER

It's in french but even if you can't read it, the code is very simple to understand and use :wink:

110
General / SFML Installation issue
« on: April 12, 2011, 02:37:21 am »
Are you mixing C++ CLI (CLR Project) with native C++ by any chance? Make sure you use the .NET libraries if so or just use native C++.

111
General / Quick reference question.
« on: April 10, 2011, 07:23:03 pm »
Thanks for the quick reply :), I've fixed the title just then.

Don't worry about the "c" prefixes, I only tend to use them on simplified code but I'll stop from now on! Thanks!

112
General / Quick reference question.
« on: April 10, 2011, 07:10:52 pm »
Hello, I'm having a bit of trouble thinking of a way to pass an sf::RenderWindow object to another class.

In the main I have object "Window"
Code: [Select]
int main
{
sf::RenderWindow Window(sf::VideoMode(1024,768,32),"Default");
[...]
}


And I want to pass this object to a class "cTest".
I tried it like this:
Code: [Select]
class cTest
{
sf::RenderWindow& m_Window;
cTest(sf::RenderWindow& Window):m_Window(Window);
};



Final Code:
Code: [Select]
class cTest
{
sf::RenderWindow& m_Window;
cTest(sf::RenderWindow& Window):m_Window(Window);
};

int main
{
sf::RenderWindow Window(sf::VideoMode(1024,768,32),"Default");
[...]
        cTest otest(Window);
        [...]
}


I does seem too work but I can't stop shaking the feel that this isn't the correct way to do this. Could someone enlighten me please?

Thanks in advance  :)

113
General / Visual C++ 2008- Can't compile for release
« on: April 02, 2011, 09:12:07 am »
Is the second screenshot correct? You're trying to compile in Release but in the screenshot, the active configuration you're changing is Debug (Top-Left corner).

114
General / SFML2 and VS2008 warning: LNK4098
« on: March 31, 2011, 07:47:57 pm »
Hi, sorry for bumping such an old topic but I have the exact same problem but with Visual Studio 2010.

I've recompiled everything, used Multi-threaded DLL when compiling SFML Release Static and I'm using the same settings on my project. Still I get the warning.

Anyone have any ideas? Thanks in advance  :)

115
General / Program lagging all of the sudden?
« on: March 24, 2011, 02:05:48 pm »
Could it be that you're using SetFrameLimit() and UseVerticalSync(true) at the same time?

116
General / GetInput() trouble
« on: March 24, 2011, 02:03:27 pm »
Didn't even remember there was a min() and max(). I'll go with that solution, thanks for the help  :wink:

117
General / GetInput() trouble
« on: March 23, 2011, 03:17:17 pm »
Thanks for the quick reply,
I'm not very sure if I understood the solution well.

I tried the following:
Code: [Select]
void NewPlayer::ProcessInputs(sf::RenderWindow &Target)
{
    sf::Vector2f m_movespeed(0.f, 0.f);

    if(Target.GetInput().IsKeyDown(sf::Key::Down))
        if(splayer.GetPosition().y < 730.0)
            m_movespeed.y += 5.f;

    if(Target.GetInput().IsKeyDown(sf::Key::Up))
        if(splayer.GetPosition().y > 40.0)
            m_movespeed.y -= 5.f;

    if(Target.GetInput().IsKeyDown(sf::Key::Left))
        if(splayer.GetPosition().x > 240.0)
            m_movespeed.x -= 5.f;

    if(Target.GetInput().IsKeyDown(sf::Key::Right))
        if(splayer.GetPosition().x < 780.0)
            m_movespeed.x += 5.f;

        splayer.Move(m_movespeed.x,m_movespeed.y);
}


But the problem is still there. Sorry I'm being thick here but what am I doing wrong?
Thanks in advance

EDIT: I think I got it working:
Code: [Select]
void NewPlayer::ProcessInputs(sf::RenderWindow &Target)
{
    sf::Vector2f m_movespeed(0.f, 0.f);

    if(Target.GetInput().IsKeyDown(sf::Key::Down))
    {
        if(splayer.GetPosition().y < 730.0)
            m_movespeed.y = 5.f;
        else
            m_movespeed.y = 0.f;
    }

    if(Target.GetInput().IsKeyDown(sf::Key::Up))
    {
        if(splayer.GetPosition().y > 40.0)
            m_movespeed.y = -5.f;
        else
            m_movespeed.y = 0.f;
    }

    if(Target.GetInput().IsKeyDown(sf::Key::Right))
    {
        if(splayer.GetPosition().x < 780.0)
            m_movespeed.x = 5.f;
        else
            m_movespeed.x = 0.f;
    }

    if(Target.GetInput().IsKeyDown(sf::Key::Left))
    {
        if(splayer.GetPosition().x > 240.0)
            m_movespeed.x = -5.f;
        else
            m_movespeed.x = 0.f;
    }
   
    splayer.Move(m_movespeed.x,m_movespeed.y);
}


But I'm getting that feel that the code is excessively long for something so simple.
Thanks for the help   :)

118
General / GetInput() trouble
« on: March 23, 2011, 05:02:30 am »
Hello,
I have the following code that allows a sprite to move (in this case the main player's sprite) using the default arrow keys:

Code: [Select]
void NewPlayer::ProcessInputs(sf::RenderWindow &Target)
{
    //The code follows:
    //If an arrow key is pressed
    //If the sprite if bellow or above the axis value required
    //Move the sprite

    //UP
    if(Target.GetInput().IsKeyDown(sf::Key::Up))
        if(splayer.GetPosition().y > 40.0)
            splayer.Move(0,-m_movespeed);

    //DOWN
    if(Target.GetInput().IsKeyDown(sf::Key::Down))
        if(splayer.GetPosition().y < 730.0)
            splayer.Move(0,m_movespeed);

    //LEFT
    if(Target.GetInput().IsKeyDown(sf::Key::Left))
        if(splayer.GetPosition().x > 240)
            splayer.Move(-m_movespeed,0);

    //RIGHT
    if(Target.GetInput().IsKeyDown(sf::Key::Right))
        if(splayer.GetPosition().x < 780.0)
            splayer.Move(m_movespeed,0);

}


However it's glitching me a bit.
If the sprite reaches the top of the screen and if i keep pressing UP, the sprite doesn't move, good!
However if I keep pressing UP and then press DOWN at the same time, the sprite nudges down a bit and doesn't move until I release UP.
The only problem here is that little nudge. Even though it's just a small movement, it feels really strange during gameplay.
EDIT: (The same thing happens with Left and Right Keys)

Here's a picture to understand better what happens:

Left: Just Pressing UP
Right: Pressing UP and DOWN

What could I change in my code to fix this?
Thanks in advance

119
General / VS2010 Installation - Rebuilding Freezes !
« on: March 20, 2011, 12:34:42 am »
Hey, you'll need to recompile the library

Try giving a look at this video and you should be good:

120
General discussions / vertical sync
« on: March 19, 2011, 10:39:22 pm »
Wouldn't that have the same effect as SetFrameTime(60)?
That's I'm using currently but I'd like to understand where the problem is.

EDIT: Actually, disregard that. I tested it and got a lot smoother movements. Thanks for the tip! Still going to search for another laptop to confirm if it's a driver problem.

Pages: 1 ... 6 7 [8] 9 10 ... 12
anything