// gamewindow.hpp
#include <SFML/Graphics.hpp>
#include <string>
#include <cstdint>
class GameWindow : public sf::RenderWindow
{
public:
GameWindow(const uint32_t&, const uint32_t&, const std::string&);
void toggleFullscreen();
static const ResolutionSetting w640h480,
w1600h900,
w1920h1080,
w2560h1440;
private:
class ResolutionSetting
{
public:
ResolutionSetting(const uint32_t& width, const uint32_t& height)
: res(width, height) {}
private:
sf::Vector2u res;
};
std::string _title;
uint32_t _width;
uint32_t _height;
};
私はResolutionSetting
クラスがGameWindow
内private
クラスとして定義されGameWindow
クラス内のパブリックResolutionSetting
オブジェクトを初期化しようとしています。私が言ったメンバーの型定義は、このようなタイプが指定されている場合など、外部のクラススコープ(からアクセスできないときしかし、これはケースが含まれていない、クラスのstatic
const
メンバーを初期化する方法の詳細thisポストを見てきましたクラスのstatic constメンバーを初期化します。メンバーはプライベートタイプですか?
アクセスルールはprivate
)。
これらのオブジェクトをどのように初期化するのですか?
const GameWindow::ResolutionSetting GameWindow::w640h480(640, 480);
または
const GameWindow::ResolutionSetting GameWindow::w640h480 = GameWindow::ResolutionSetting(640, 480);
で十分:でしょうか? (私がResolutionSetting
にアクセスできないと考えられる問題を修正できると仮定して)。