SFML community forums
Help => General => Topic started by: Kamaitachi on March 08, 2011, 07:29:05 pm
-
How can I create a sf:RenderWindow and set VideoMode after that?
-
What does "create a RenderWindow" mean, without a video mode? If you want to have a sf::RenderWindow instance and later create the window, you can use the default constructor and the Create function.
-
And how can I change the size of the window with Create()? Could you make a example, please?
-
window.Create(sf::VideoMode(width, height), title);
-
Just that? :P I Okay, thank you very much.
-
I know this is kinda stupid and all, but I still figure it out: Why isn't the following code working?
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
class Field
{
int Farray[2][2];
sf::RenderWindow App(sf::VideoMode(100, 100, 32), "SFML");
public:
Field(int x, int y) {App.Create(sf::VideoMode(x, y), "SFML");};
void FEvent();
void FDisplay (int, int, int);
};
void Field::FEvent ()
{
}
void Field::FDisplay (int pos1, int pos2, int pl)
{
}
int main()
{
Field F(315, 315);
}
It says that "App was not declared in this scope"...
-
You can't call a constructor in a class declaration.
class Field
{
int Farray[2][2];
sf::RenderWindow App;
public:
Field(int x, int y) {App.Create(sf::VideoMode(x, y), "SFML");};
void FEvent();
void FDisplay (int, int, int);
};
-
Uhm. Now I am getting a lot of undefined references, from "Undefined reference to sf::Window::Close()" to "Undefined reference to sf::RenderWindow::RenderWindow()", using your code...
-
You must link to sfml-window and sfml-graphics.
-
*facepalm* I am an idiot! I thought I did that but... oh well. Anyway, thank you very much! You have been very helpful. Thank you!