1
Audio / Re: getting libopenal32.a for static compilation
« on: December 11, 2025, 04:25:47 pm »
your detailed reply is appreciated. Thank you for your time
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.
sf::RenderWindow mWindow(sf::VideoMode(640, 480), "SFML Application");
private:
sf::RenderWindow mWindow;
sf::CircleShape mPlayer;
mPlayer.setRadius(40.f);worked, while similar initializing the first member
mWindow(sf::VideoMode(640, 480), "SFML Application");generated an error
no match for call to '(sf::RenderWindow) (sf::VideoMode, const chat[17])'Why didn't it work and why it required calling "create", while similar declared mPlayer worked without "create"?
Game::Game()The other functions copied from the book:
{
sf::RenderWindow mWindow(sf::VideoMode(640, 480), "SFML Application");
//{mWindow(sf::VideoMode(640, 480), "SFML Application"); this cause error no match for call to '(sf::RenderWindow) (sf::VideoMode, const chat[17])'
mPlayer.setRadius(40.f);
mPlayer.setPosition(100.f, 100.f);
mPlayer.setFillColor(sf::Color::Cyan);
};
void Game::run()It compiles and runs with no errors yet it just flashes for a split second that 640x480 window with white background and no circle.
{
while (mWindow.isOpen())
{
processEvents();
update();
render();
}
}
void Game::processEvents()
{
sf::Event event;
while (mWindow.pollEvent(event))
{
if (event.type == sf::Event::Closed)
mWindow.close();
}
}
void Game::update()
{
}
void Game::render()
{
mWindow.clear();
mWindow.draw(mPlayer);
mWindow.display();
}
int main()
{
Game game;
game.run();
return 0;
}
class Game
{
public:
Game();
void run();
private:
void processEvents();
void update();
void render();
private:
sf::RenderWindow mWindow;
sf::CircleShape mPlayer;
};
Game::Game()I learned C++ in 1998 using "How to programm C++" by H.M. and P.J. Deitel and this syntax puzzles me. Is this a new version C++ or just slip of pen? Anyway, as is it would not compile.
: mWindow(sf::VideoMode(640, 480), "SFML Application")
, mPlayer()
{
mPlayer.setRadius(40.f);
mPlayer.setPosition(100.f, 100.f);
mPlayer.setFillColor(sf::Color::Cyan);
}