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

Pages: 1 2 3 [4] 5 6 7
46
In 1.6 you could directly check for released keys using
sf::Event::KeyReleased
atleast, I would assume that was what it did?

And yes I know that sf::Clock is meant to be built upon, I was merely trying to find a reason as to why I should use sf::Clock, instead of constructing my own using timeGetTime(), since I prefer a clock where I can access the start time directly, should that be necessary.
Now that binary so kindly supplied me with the information that sf::Clock should be more accurate than timeGetTime(), I will be building a clock class with an internal sf::Clock.

EDIT: One other feature which I feel that a clock needs is the ability to not only return elapsed time but also current time. That's what basically makes sf::clock not a completely perfect choice for me.

47
Alright. Kind of seems like a two steps forward one step back approach to input but I should be able to fashion something for my needs.
What are you trying to do? Maybe there's a better way of handling things.
I merely meant that since the code needed to check for a key being released was implemented in 1.6 it seems like a rather odd design decision to remove that inherent feature.

As to the answer to my clock question, do you mean something like this
No sf::Clock is not designed for a parent class. You can use an sf::Clock internally. For example you have the functions Start() and Check(). In the Start() function your querying the clock for a time and save it into a sf::Time, now whenever Check() is called you can compaire the save time with the current clock time and the difference makes the runtime. Implementing Stop(), Pause() and Resume() won't be much harder. ;)

Also, is sf::clock more accurate than timeGetTime? Else I'll just stick with my old clock I suppose, since it's been accurate enough sofar.
I don't really remember what SFML uses internally but I think for POSIX system it's using timeGetTime, so it will be equal, but using your own function calls to OS APIs will make your class non-portable and since you already got a nice layer with sf::Clock it's also not very logical to use your own calls. ;)

Well yes, but sf::clock is fairly useless on it's own except for very rudimentary timing tasks. That's why I will most likely be constructing my own stopwatch.

48
I use C++ 2008
There's no such thing as C++ 2008. There's C++98, C++03 and C++11. ;)
Also you essentially don't need to use Thor but you could take a look at its source code and if you think the code does fit your needs you can just copy it. ;)

Meant Visual C++ 2008, which as far as I know does not use C++ 11

49
What do you exactly want to achieve? If you need a pausable clock, you can take a look at thor::StopWatch in my library Thor, which works for SFML 2.

By the way, please open separate threads for separate topics.

I use C++ 2008 which is why I do not use Thor, and I have no plans of doing so in the near future.
I would open seperate threads, yet I felt that it was unnecesary to flood the general board with 5 different topics which all pertained to the transition between 1.6 and 2.0.

50
Alright. Kind of seems like a two steps forward one step back approach to input but I should be able to fashion something for my needs.

As to the answer to my clock question, do you mean something like this

class Stopclock : public sf::clock
private:
sf::Time start_time
Stopclock::Stopclock()
{
start_time = this->getElapsedTime()
}
 
or is there a better way to do it?
Also, is sf::clock more accurate than timeGetTime? Else I'll just stick with my old clock I suppose, since it's been accurate enough sofar.

51
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 18, 2012, 10:00:17 am »
Aye, but can you differentiate between different keys being released or pressed simultaneously?

Also, I've begun delving in the new sf::clock code.
In 1.6 I constructed my own stopwatch clock, since sf::clock doesn't offer that, however I used float, which doesn't have all the precision I need.

Therefore, I was just wondering is there any way that you can get m_startTime directly, or do you have to create your own at initialization? I am hesitant to do that, since I generally use timeGetTime, and I'm not sure whether it is as accurate as the default m_startTime value that it gets in the sf::Clock ctor.

52
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 18, 2012, 09:17:01 am »
Ok so I am using a fairly standard looped switch statement to poll/get events, how do I check for released keys?

It looks like this
                        while(App.pollEvent(Event))
                        {
                                switch(Event.Type)
                                {
                                case sf::Event::Closed:
                                        App.Close();
                                        break;
                                case sf::Event::EventType::KeyPressed:
                                        switch(sf::Keyboard::isKeyPressed)
                                        {
                                        case sf::Keyboard::isKeyPressed(sf::Keyboard::Left):
                                                theEye.move(-PlayerMove,0);
                                                break;
                                        case sf::Keyboard::isKeyPressed(sf::Keyboard::Right):
                                                theEye.move(PlayerMove,0);
                                        case sf::Keyboard::Escape:
                                                App.Close();
                                                break;
                                        case sf::Keyboard::isKeyPressed(sf::Keyboard::Space):
                                                 startingposition = Jump(pYVel,pJumped,ptheEye, ElapsedTime);
                                                 break;
                                        }
                                case sf::EventType::KeyReleased:
                                        switch(sf::Event::)
                                        {
                                        case sf::Keyboard::Left:
                                        case sf::Keyboard::Right:
                                                break;
                                        case sf::Key::Down:
                                                YReduceVelocity = 1;
                                                break;
                                        }
                                        break;
                        }
                }

The last portion is unfinished because I don't understand how to check for released keys.

EDIT: Just thought of something, could you case a false return? something like case !sf::Key::Down?
Trying that now.

53
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 18, 2012, 08:51:02 am »
Alright I will. Thank you for the helpful reply :)

EDIT: How do you check for a released key?
Since sf::Keyboard::"key" returns a bool on whether it is pressed or not, how do you check for a released key as opposed to a key which was never pressed?

54
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 11:40:46 pm »
Time for next question :D

Why was getFrameTime removed? Feature bloat? Is there any good way to get the frame time?

EDIT: Can sf::RenderWindow::pollEvent in 2.0 be used in a similar way to sf::RenderWindow::GetInput from 1.6?
EDIT2: Nope it cannot I saw now. How should you handle inputs in 2.0?

55
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 11:08:22 pm »
Aight, I'll get to making my own then :D

56
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 10:59:25 pm »
So was Randomizer completely removed in 2.0? I can always construct my own randomizer, but if SFML already has one I see no reason to make my own instead of adding to the existing one.

57
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 01:53:31 am »
Ah yea, I see your point.

Still, now you have to change 2 values, instead of just calling a single function.
But I'm no expert on the inner workings of either Laurents mind or SFML, so I'll just accept the new classes as they are :)

58
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 01:36:58 am »
New question! :D
Is there any specific reason as to why sf::rect.offset() was removed from 2.0?

EDIT: Also, why the removal of Right and Bottom coordinates in a rect?

59
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 12:54:45 am »
Ya, sorry wrote wrong :) I meant GetSize, anyhow, thank you very much for the clarification.

60
General / Re: sfml 1.6 sprite::GetSize equivalent?
« on: August 17, 2012, 12:24:21 am »
Aye, but it returns a rect whereas GetPosition returns a vector :P
Also localbounds returns the size, right? Whereas globalbounds return the size and position and rotation?

Thanks for the fast reply :)

EDIT: Sorry, meant GetSize

Pages: 1 2 3 [4] 5 6 7