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

Pages: [1]
1
General / Re: Arkanoid tutorial errors
« on: February 09, 2014, 02:52:53 am »
Thank you! That made it work. Tutorial still confuses me, but as long as the code is working, I guess.

2
General / Re: Arkanoid tutorial errors
« on: February 09, 2014, 01:44:44 am »
Do you mean like this?

RenderWindow window{ VideoMode{ windowWidth, windowHeight }, "Arkanoid - 1" };

If so, yes, and it didn't work. It gave the same errors.

3
General / Re: Arkanoid tutorial errors
« on: February 08, 2014, 10:57:20 pm »
That works, as does simply replacing the windowWidth and windowHeight with 800 and 600 respectively in the original line. I still am not sure why using the const values causes an error on my machine, though.

4
General / Arkanoid tutorial errors
« on: February 08, 2014, 10:11:04 pm »
I recently decided to dive into game development using SFML, and thought that the Arkanoid clone tutorial would be a good place to start. However, I keep on getting errors in the code, and even downloading the source gives me these same errors.

The code as I have it is:

#ifdef SFML_STATIC
#pragma comment(lib, "glew.lib")
#pragma comment(lib, "freetype.lib")
#pragma comment(lib, "jpeg.lib")
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "gdi32.lib")  
#endif // SFML_STATIC

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

using namespace std;
using namespace sf;

const int windowWidth{ 800 }, windowHeight{ 600 };

int main()
{
        RenderWindow window{ { windowWidth, windowHeight }, "Arkanoid - 1" };
        window.setFramerateLimit(60);

        while (true)
        {
                window.clear(Color::Black);

                if (Keyboard::isKeyPressed(Keyboard::Key::Escape)) break;

                window.display();
        }

        return 0;
}

The errors I received from the VS2013 are :
  • 1: Line 16 - int should be preceded by a ;
  • 2: Line 16 - missing type specifier, int assumed
  • 3: Line 20 - Element '1' - conversion from 'initializer-list' to 'sf::VideoMode' requires a narrowing conversion
  • 4: Line 20 - same, but from 'int' to 'unsigned int'
  • 5: Line 20 - same as 4, but applying to Element '2'

I was able to fix the two errors for line sixteen (the const expr) by changing it to simply a const. I would like to know how to keep from having to do this, however.

Line 20 in my code (in case it doesn't show up) is the RenderWindow line, in case that helps.

Thank you!

Pages: [1]