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

Pages: [1]
1
General / Re: Intellisense and .chm File Problems
« on: May 01, 2013, 09:54:55 pm »
Ok I can view the .chm file now it turns out that I had to uncheck the "Always ask...when opening this file..." option in the dialog box. Thanks for the info guys.

2
General / Re: Intellisense and .chm File Problems
« on: May 01, 2013, 01:32:43 am »
Ah, I see. What about the .chm file?

3
General / Intellisense and .chm File Problems
« on: May 01, 2013, 12:54:04 am »
When using the Visual C++ 11 (2012) - 32 bit download of SFML for Visual Studio 2012 I get intellisense problems. Sometimes it will say "XML comment contains invalid XML: Whitespace is not allowed at this location." Most of the time it looks like this for example:



I don't think I should be seeing all this \brief, \param, \return business because I never seen that before. Also when I launch the sfml.chm file that comes with the download and try to click on a class nothing shows up, there is just a large white space. This led me to believe I may have deleted or somehow corrupted some XML file that contains the documentation so I re-downloaded SFML but nothing changed.

Am I the only with these problems? Are there solutions?

Thanks

4
Window / Re: Best Game Loop for an Input Manager
« on: January 20, 2013, 02:10:48 am »
If you want to deal with events, you might keep a vector of keys pressed per loop iteration and check that vector when the function is called -- obviously it would need to be cleared at the beginning of the next iteration.  Otherwise, you might actually check to see if the key is currently pressed, which seems to be what krzat is recommending.

Thank you cire! I've implemented this brilliant solution and it works as expected.  :)

5
Window / Re: Best Game Loop for an Input Manager
« on: January 19, 2013, 10:50:51 pm »
You only keep track of the last event that was processed, so for isKeyPressed to return true, that would have to be last event processed, which is.. unlikely.

Oh, I see that would make since, and explains why updating the state inside the poll event loop worked. Thank you very much, but now I need to figure out how to solve this problem.

I wouldn't expect a function named isKeyPressed to use events.

What are you saying? That I should rename the function or that I should not use events?



From what I now know off the top of my head I thought to just change while(window.pollEvent()) to if(window.pollEvent()) and that seems to fix this problem as expected, but does this make things less efficient? Every single example of a game loop I've seen always uses while(window.pollEvent()) and google doesn't have anything on this topic.

6
Window / Best Game Loop for an Input Manager
« on: January 19, 2013, 06:49:02 pm »
So from what I understand (please correct me if I'm wrong) in SMFL 2.0 you should use sf::Event::KeyPressed and sf::Event::KeyReleased when dealing with single key presses and releases, but if you want continuous input you should use the sf::Keyboard::isKeyPressed function. So in my input manager class I have done so for a single key press:

InputManager.h
class InputManager
{
public:
        static bool IsKeyPressed(const sf::Keyboard::Key key);
       
        static sf::Event event;
};

InputManager.cpp
sf::Event InputManager::event;

bool InputManager::IsKeyPressed(const sf::Keyboard::Key key)
{
        return event.type == sf::Event::KeyPressed && event.key.code == key ? true : false;
}

The static event member is being updated in a game loop labeled "here" like so:

StateManager.cpp
void StateManager::GameLoop()
{
        while(window.isOpen())
        {
                sf::Event event;
                while(window.pollEvent(event))
                {
                        InputManager::event = event; //here
                        //states[0]->Update(); //here 2

                        switch (event.type)
                        {
                                case sf::Event::Closed:
                                        window.close();
                                        break;
                                default:
                                        break;
                        }
                }

                for(size_t i = 0; i < states.size(); i++)
                {
                        states[i]->Update();

                        window.clear();
                        states[i]->Draw(window);
                        window.display();
                }
        }
}

Then anywhere I wan't to use input I can put this inside a state:

void SomeState::Update()
{
        if(InputManager::IsKeyPressed(sf::Keyboard::Key::Space))
        {
                //...
        }
}

The problem is that this doesn't work, the InputManager::IsKeyPressed function never returns true. However if I uncomment the code you saw above labeled "here 2" then the function executes fine. I don't know why it doesn't work updating the state after the poll event loop and I was hoping you guys could explain why. Another problem with this method is that once the event object leaves the poll event loop and there are no more events to be polled then the event object will never be resigned so the InputManager::IsKeyPressed function will return what ever it was previously.

I don't think updating the states inside the poll event loop is efficient so what is the best way to structure this game loop to fix the problems I'm having? Also why doesn't the event object work outside the poll event loop?

Thanks.

7
Graphics / Re: Can't Create sf::Text Object
« on: January 07, 2013, 07:30:09 pm »
Yeah, I must have spelled that wrong because I couldn't copy and past.

Well I went to there website and installed what I believe to be is the most up to date driver for me (at least that's what the AMD Driver Autodetect said). I restarted my computer, ran the application again and I got the same errors and 1.1 is still what it prints.

Am I screwed or is there some way to update OpenGL on my machine or is that up to the manufacturer of the graphics?

Picture if that helps? http://i.imgur.com/wLWIb.png

8
Graphics / Can't Create sf::Text Object
« on: January 06, 2013, 11:29:55 pm »
So I wanted to create a sf::Text object so I went to the documentation (2.0) and the second overload of the constructor is this:
Text (const String &string, const Font &font=Font::getDefaultFont(), unsigned int characterSize=30)
But when I go to create the object in visual studio the intellisense gives me this:
Text(cont sf::String &string, const sf::Font &font, unisigned int characterSize = 30U)
See in visual studio I have to give it a font but the documentation says I don't. Just thought I would point that out no big deal.

So I simply threw this code together:
sf::Font font;
font.loadFromFile("arial.ttf");
sf::Text text("Some Text", font);
 
I then ran the application and inside the console window this is printed a total of 3 times:
An internal OpenGL call failed in Texture.cpp (146) : GL_INVALID_ENUM, an unacceptable value has been specified for an enumerated argument
An internal OpenGL call failed in Texture.cpp (147) : GL_INVALID_ENUM, an unacceptable value has been specified for an enumerated argument

Now from this thread the admin says and I quote "This error implies that you have a crappy graphics card (or drivers) that don't support OpenGL 1.2. Is that true?" Indeed this is true for me. Running this code prints 1.1 out:
sf::ContextSettings settings = window.getSettings();
std::cout << settings.majorVersion << "." << settings.minorVersion << std::endl;
So I guess my graphics card only supports OpenGL 1.1 and windows says that my driver for it is up to date. The thread then ends and how to resolve the problem is not there.

My question is what does this leave me with? Can I not use features of SFML 2 that use OpenGL 1.2? Do I have to buy a better graphics card? In XNA I could switch some variable and it worked for crappy graphics cards does SMFL 2 have something like that?

How do I resolve this problem?

I'm running Microsoft Visual Studio Express 2012 for Windows Desktop on a 64 bit machine with Windows 8 using SFML 2.0 built with cmake (I just fallowed this tutorial). I don't even have a dedicated graphics card this is what the Device Manager says: ATI Radeon HD 3200 Graphics (Microsoft Corperation - WDDM v1.1).

Thanks.

9
General / Game Samples
« on: December 26, 2012, 08:22:14 pm »
Are there any SFML game samples that I can see the source code to? The best I've seen is eXpl0it3r's small game engine (https://github.com/eXpl0it3r/SmallGameEngine) but its too small. I'm looking for full game samples.

Thanks

Pages: [1]