forked from NaiJi/project-kyoku
Replace shared_ptr for RenderTarget with T * const
This commit is contained in:
parent
5b5b2c2aa1
commit
017f400ad9
|
@ -7,7 +7,7 @@
|
|||
|
||||
const sf::Time TIME_PER_FRAME = sf::seconds(1.f / 90.f);
|
||||
|
||||
ApplicationSFML::ApplicationSFML(const std::shared_ptr<sf::RenderWindow>& render_window) :
|
||||
ApplicationSFML::ApplicationSFML(sf::RenderWindow * const render_window) :
|
||||
_render_window(render_window)
|
||||
{
|
||||
_render_window->setFramerateLimit(60);
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
class ApplicationSFML : public Application
|
||||
{
|
||||
public:
|
||||
explicit ApplicationSFML(const std::shared_ptr<sf::RenderWindow>& _render_window);
|
||||
explicit ApplicationSFML(sf::RenderWindow * const _render_window);
|
||||
virtual void display() override;
|
||||
virtual void run() override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<sf::RenderWindow> _render_window;
|
||||
sf::RenderWindow * const _render_window;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "game/classicgame.h"
|
||||
#include "editor/classiceditor.h"
|
||||
|
||||
ClassicFactorySFML::ClassicFactorySFML(const std::shared_ptr<sf::RenderTarget>& render_target) :
|
||||
ClassicFactorySFML::ClassicFactorySFML(sf::RenderTarget * const render_target) :
|
||||
_render_target(render_target)
|
||||
{}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
class ClassicFactorySFML : public ClassicFactory
|
||||
{
|
||||
public:
|
||||
explicit ClassicFactorySFML(const std::shared_ptr<sf::RenderTarget>& render_target);
|
||||
explicit ClassicFactorySFML(sf::RenderTarget * const render_target);
|
||||
virtual std::unique_ptr<kku::Game> getGame() const override;
|
||||
virtual std::unique_ptr<kku::Editor> getEditor() const override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<sf::RenderTarget> _render_target;
|
||||
sf::RenderTarget * const _render_target;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "classicspritesfml.h"
|
||||
|
||||
ClassicSpriteSFML::ClassicSpriteSFML(const std::shared_ptr<sf::RenderTarget>& render_target,
|
||||
ClassicSpriteSFML::ClassicSpriteSFML(sf::RenderTarget * const render_target,
|
||||
const sf::RectangleShape& shape) :
|
||||
_prototype(shape),
|
||||
_shape(shape),
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
class ClassicSpriteSFML : public ClassicSprite
|
||||
{
|
||||
public:
|
||||
explicit ClassicSpriteSFML(const std::shared_ptr<sf::RenderTarget>& render_target,
|
||||
explicit ClassicSpriteSFML(sf::RenderTarget * const render_target,
|
||||
const sf::RectangleShape& shape);
|
||||
|
||||
virtual void reset() override;
|
||||
|
@ -30,5 +30,5 @@ private:
|
|||
sf::RectangleShape _shape;
|
||||
sf::RectangleShape _trail;
|
||||
|
||||
const std::shared_ptr<sf::RenderTarget> _render_target;
|
||||
sf::RenderTarget * const _render_target;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "spritefactorysfml.h"
|
||||
#include "classicspritesfml.h"
|
||||
|
||||
ClassicSpriteFactorySFML::ClassicSpriteFactorySFML(const std::shared_ptr<sf::RenderTarget>& render_target) :
|
||||
ClassicSpriteFactorySFML::ClassicSpriteFactorySFML(sf::RenderTarget * const render_target) :
|
||||
_render_target(render_target)
|
||||
{}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
class ClassicSpriteFactorySFML : public ClassicSpriteFactory
|
||||
{
|
||||
public:
|
||||
explicit ClassicSpriteFactorySFML(const std::shared_ptr<sf::RenderTarget>& render_target);
|
||||
explicit ClassicSpriteFactorySFML(sf::RenderTarget * const render_target);
|
||||
virtual std::shared_ptr<ClassicSprite> create(Type type) const override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<sf::RenderTarget> _render_target;
|
||||
sf::RenderTarget * const _render_target;
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "textsfml.h"
|
||||
#include "linesfml.h"
|
||||
|
||||
CoreFactorySFML::CoreFactorySFML(const std::shared_ptr<sf::RenderTarget>& render_target) :
|
||||
CoreFactorySFML::CoreFactorySFML(sf::RenderTarget * const render_target) :
|
||||
_render_target(render_target)
|
||||
{
|
||||
auto gui_font = std::make_unique<sf::Font>();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class CoreFactorySFML : public kku::CoreFactory
|
||||
{
|
||||
public:
|
||||
explicit CoreFactorySFML(const std::shared_ptr<sf::RenderTarget>& render_target);
|
||||
explicit CoreFactorySFML(sf::RenderTarget * const render_target);
|
||||
virtual std::shared_ptr<kku::Music> getMusic() const override;
|
||||
virtual std::shared_ptr<kku::Text> getText(kku::Font::Id id) const override;
|
||||
virtual std::shared_ptr<kku::Rectangle> getRectangle() const override;
|
||||
|
@ -17,6 +17,6 @@ public:
|
|||
virtual kku::Vector2<std::size_t> getRenderSize() const override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<sf::RenderTarget> _render_target;
|
||||
sf::RenderTarget * const _render_target;
|
||||
kku::ResourceHolder<sf::Font, kku::Font::Id> _font_holder;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "linesfml.h"
|
||||
|
||||
LineSFML::LineSFML(const std::shared_ptr<sf::RenderTarget>& render_target) :
|
||||
LineSFML::LineSFML(sf::RenderTarget * const render_target) :
|
||||
_render_target(render_target)
|
||||
{
|
||||
_vertex = sf::VertexArray(sf::LinesStrip, 2);
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
class LineSFML : public kku::Line
|
||||
{
|
||||
public:
|
||||
explicit LineSFML(const std::shared_ptr<sf::RenderTarget>& render_target);
|
||||
explicit LineSFML(sf::RenderTarget * const render_target);
|
||||
virtual void setPosition(const kku::Point& p1, const kku::Point& p2) override;
|
||||
virtual void setColor(const kku::Color& c1, const kku::Color& c2) override;
|
||||
virtual void display() override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<sf::RenderTarget> _render_target;
|
||||
sf::RenderTarget * const _render_target;
|
||||
sf::VertexArray _vertex;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "rectanglesfml.h"
|
||||
|
||||
RectangleSFML::RectangleSFML(const std::shared_ptr<sf::RenderTarget>& render_target) :
|
||||
RectangleSFML::RectangleSFML(sf::RenderTarget * const render_target) :
|
||||
_render_target(render_target)
|
||||
{}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class RectangleSFML : public kku::Rectangle
|
||||
{
|
||||
public:
|
||||
explicit RectangleSFML(const std::shared_ptr<sf::RenderTarget>& render_target);
|
||||
explicit RectangleSFML(sf::RenderTarget * const render_target);
|
||||
virtual void setRect(const kku::Area<float>& rect) override;
|
||||
virtual kku::Area<float> getRect() const override;
|
||||
|
||||
|
@ -23,6 +23,6 @@ public:
|
|||
virtual void display() override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<sf::RenderTarget> _render_target;
|
||||
sf::RenderTarget * const _render_target;
|
||||
sf::RectangleShape _rectangle;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "textsfml.h"
|
||||
|
||||
TextSFML::TextSFML(const std::shared_ptr<sf::RenderTarget>& render_target,
|
||||
TextSFML::TextSFML(sf::RenderTarget * const render_target,
|
||||
const std::shared_ptr<const sf::Font>& font) :
|
||||
_render_target(render_target)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
class TextSFML : public kku::Text
|
||||
{
|
||||
public:
|
||||
explicit TextSFML(const std::shared_ptr<sf::RenderTarget>& render_target,
|
||||
explicit TextSFML(sf::RenderTarget * const render_target,
|
||||
const std::shared_ptr<const sf::Font>& font);
|
||||
|
||||
virtual void setString(const std::string& string) override;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
ApplicationSFML app(std::make_shared<sf::RenderWindow>(sf::VideoMode{1280, 720}, "Test", sf::Style::Fullscreen));
|
||||
sf::RenderWindow window(sf::VideoMode{1280, 720}, "Test", sf::Style::Fullscreen);
|
||||
ApplicationSFML app(&window);
|
||||
if (app.init())
|
||||
app.run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue