Skip to content

Commit

Permalink
Rename Drawables to Renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
elnormous committed May 23, 2017
1 parent 7ca54fa commit 38a1b20
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 94 deletions.
6 changes: 3 additions & 3 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ SOURCES=$(ROOT_DIR)/../ouzel/animators/Animator.cpp \
$(ROOT_DIR)/../ouzel/scene/Camera.cpp \
$(ROOT_DIR)/../ouzel/scene/Component.cpp \
$(ROOT_DIR)/../ouzel/scene/Layer.cpp \
$(ROOT_DIR)/../ouzel/scene/MeshDrawable.cpp \
$(ROOT_DIR)/../ouzel/scene/MeshRenderer.cpp \
$(ROOT_DIR)/../ouzel/scene/Node.cpp \
$(ROOT_DIR)/../ouzel/scene/NodeContainer.cpp \
$(ROOT_DIR)/../ouzel/scene/ParticleDefinition.cpp \
$(ROOT_DIR)/../ouzel/scene/ParticleSystem.cpp \
$(ROOT_DIR)/../ouzel/scene/Scene.cpp \
$(ROOT_DIR)/../ouzel/scene/SceneManager.cpp \
$(ROOT_DIR)/../ouzel/scene/ShapeDrawable.cpp \
$(ROOT_DIR)/../ouzel/scene/ShapeRenderer.cpp \
$(ROOT_DIR)/../ouzel/scene/SoundListener.cpp \
$(ROOT_DIR)/../ouzel/scene/SoundPlayer.cpp \
$(ROOT_DIR)/../ouzel/scene/Sprite.cpp \
$(ROOT_DIR)/../ouzel/scene/SpriteFrame.cpp \
$(ROOT_DIR)/../ouzel/scene/TextDrawable.cpp \
$(ROOT_DIR)/../ouzel/scene/TextRenderer.cpp \
$(ROOT_DIR)/../ouzel/utils/Log.cpp \
$(ROOT_DIR)/../ouzel/utils/OBF.cpp \
$(ROOT_DIR)/../ouzel/utils/Utils.cpp
Expand Down
6 changes: 3 additions & 3 deletions build/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ LOCAL_SRC_FILES :=../../ouzel/animators/Animator.cpp \
../../ouzel/scene/Camera.cpp \
../../ouzel/scene/Component.cpp \
../../ouzel/scene/Layer.cpp \
../../ouzel/scene/MeshDrawable.cpp \
../../ouzel/scene/MeshRenderer.cpp \
../../ouzel/scene/Node.cpp \
../../ouzel/scene/NodeContainer.cpp \
../../ouzel/scene/ParticleDefinition.cpp \
../../ouzel/scene/ParticleSystem.cpp \
../../ouzel/scene/Scene.cpp \
../../ouzel/scene/SceneManager.cpp \
../../ouzel/scene/ShapeDrawable.cpp \
../../ouzel/scene/ShapeRenderer.cpp \
../../ouzel/scene/SoundListener.cpp \
../../ouzel/scene/SoundPlayer.cpp \
../../ouzel/scene/Sprite.cpp \
../../ouzel/scene/SpriteFrame.cpp \
../../ouzel/scene/TextDrawable.cpp \
../../ouzel/scene/TextRenderer.cpp \
../../ouzel/utils/Log.cpp \
../../ouzel/utils/OBF.cpp \
../../ouzel/utils/Utils.cpp
Expand Down
96 changes: 48 additions & 48 deletions build/ouzel.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions ouzel/gui/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
#include <functional>
#include "Button.h"
#include "core/Engine.h"
#include "scene/Sprite.h"
#include "events/EventHandler.h"
#include "events/EventDispatcher.h"
#include "scene/Layer.h"
#include "scene/Camera.h"
#include "Label.h"
#include "scene/TextDrawable.h"

namespace ouzel
{
Expand Down Expand Up @@ -81,7 +79,7 @@ namespace ouzel

if (!label.empty())
{
labelDrawable.reset(new scene::TextDrawable(font, true, label));
labelDrawable.reset(new scene::TextRenderer(font, true, label));
labelDrawable->setColor(labelColor);
addComponent(labelDrawable.get());
}
Expand Down
6 changes: 3 additions & 3 deletions ouzel/gui/Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <functional>
#include "gui/Widget.h"
#include "scene/Sprite.h"
#include "scene/TextDrawable.h"
#include "scene/TextRenderer.h"
#include "events/Event.h"
#include "events/EventHandler.h"
#include "math/Color.h"
Expand Down Expand Up @@ -36,7 +36,7 @@ namespace ouzel
scene::Sprite* getSelectedSprite() const { return selectedSprite.get(); }
scene::Sprite* getPressedSprite() const { return pressedSprite.get(); }
scene::Sprite* getDisabledSprite() const { return disabledSprite.get(); }
scene::TextDrawable* getLabelDrawable() const { return labelDrawable.get(); }
scene::TextRenderer* getLabelDrawable() const { return labelDrawable.get(); }

protected:
virtual void setSelected(bool newSelected) override;
Expand All @@ -49,7 +49,7 @@ namespace ouzel
std::unique_ptr<scene::Sprite> selectedSprite;
std::unique_ptr<scene::Sprite> pressedSprite;
std::unique_ptr<scene::Sprite> disabledSprite;
std::unique_ptr<scene::TextDrawable> labelDrawable;
std::unique_ptr<scene::TextRenderer> labelDrawable;

EventHandler eventHandler;

Expand Down
2 changes: 1 addition & 1 deletion ouzel/gui/Label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ouzel
Color color,
const Vector2& textAnchor):
text(aText),
labelDrawable(std::make_shared<scene::TextDrawable>(fontFile, true, text, color, textAnchor))
labelDrawable(std::make_shared<scene::TextRenderer>(fontFile, true, text, color, textAnchor))
{
addComponent(labelDrawable.get());
labelDrawable->setText(text);
Expand Down
6 changes: 3 additions & 3 deletions ouzel/gui/Label.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <string>
#include "gui/Widget.h"
#include "math/Color.h"
#include "scene/TextDrawable.h"
#include "scene/TextRenderer.h"

namespace ouzel
{
Expand All @@ -24,11 +24,11 @@ namespace ouzel
virtual void setText(const std::string& newText);
virtual const std::string& getText() const { return text; }

const std::shared_ptr<scene::TextDrawable>& getLabelDrawable() { return labelDrawable; }
const std::shared_ptr<scene::TextRenderer>& getLabelDrawable() { return labelDrawable; }

protected:
std::string text;
std::shared_ptr<scene::TextDrawable> labelDrawable;
std::shared_ptr<scene::TextRenderer> labelDrawable;
};
} // namespace gui
} // namespace ouzel
6 changes: 3 additions & 3 deletions ouzel/ouzel.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@
#include "scene/Camera.h"
#include "scene/Component.h"
#include "scene/Layer.h"
#include "scene/MeshDrawable.h"
#include "scene/MeshRenderer.h"
#include "scene/Node.h"
#include "scene/ParticleSystem.h"
#include "scene/Scene.h"
#include "scene/SceneManager.h"
#include "scene/ShapeDrawable.h"
#include "scene/ShapeRenderer.h"
#include "scene/SoundListener.h"
#include "scene/SoundPlayer.h"
#include "scene/Sprite.h"
#include "scene/TextDrawable.h"
#include "scene/TextRenderer.h"
#include "utils/Log.h"
#include "utils/OBF.h"
#include "utils/Utils.h"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.

#include "MeshDrawable.h"
#include "MeshRenderer.h"

namespace ouzel
{
Expand Down
2 changes: 1 addition & 1 deletion ouzel/scene/MeshDrawable.h → ouzel/scene/MeshRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ouzel
{
namespace scene
{
class MeshDrawable: public Component
class MeshRenderer: public Component
{
public:
};
Expand Down
20 changes: 10 additions & 10 deletions ouzel/scene/ShapeDrawable.cpp → ouzel/scene/ShapeRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.

#include "ShapeDrawable.h"
#include "ShapeRenderer.h"
#include "core/Engine.h"
#include "graphics/Renderer.h"
#include "graphics/MeshBufferResource.h"
Expand All @@ -13,7 +13,7 @@ namespace ouzel
{
namespace scene
{
ShapeDrawable::ShapeDrawable()
ShapeRenderer::ShapeRenderer()
{
shader = sharedEngine->getCache()->getShader(graphics::SHADER_COLOR);
blendState = sharedEngine->getCache()->getBlendState(graphics::BLEND_ALPHA);
Expand All @@ -28,7 +28,7 @@ namespace ouzel
meshBuffer->init(sizeof(uint16_t), indexBuffer, ouzel::graphics::VertexPC::ATTRIBUTES, vertexBuffer);
}

void ShapeDrawable::draw(const Matrix4& transformMatrix,
void ShapeRenderer::draw(const Matrix4& transformMatrix,
const Color& drawColor,
const Matrix4& renderViewProjection,
const std::shared_ptr<graphics::Texture>& renderTarget,
Expand Down Expand Up @@ -87,7 +87,7 @@ namespace ouzel
}
}

void ShapeDrawable::clear()
void ShapeRenderer::clear()
{
boundingBox.reset();

Expand All @@ -98,7 +98,7 @@ namespace ouzel
dirty = true;
}

void ShapeDrawable::line(const Vector2& start, const Vector2& finish, const Color& color, float thickness)
void ShapeRenderer::line(const Vector2& start, const Vector2& finish, const Color& color, float thickness)
{
if (thickness <= 0.0f) return;

Expand Down Expand Up @@ -149,7 +149,7 @@ namespace ouzel
dirty = true;
}

void ShapeDrawable::circle(const Vector2& position,
void ShapeRenderer::circle(const Vector2& position,
float radius,
const Color& color,
bool fill,
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace ouzel
dirty = true;
}

void ShapeDrawable::rectangle(const Rectangle& rectangle,
void ShapeRenderer::rectangle(const Rectangle& rectangle,
const Color& color,
bool fill,
float thickness)
Expand Down Expand Up @@ -334,7 +334,7 @@ namespace ouzel
dirty = true;
}

void ShapeDrawable::triangle(const Vector2 (&positions)[3],
void ShapeRenderer::triangle(const Vector2 (&positions)[3],
const Color& color,
bool fill,
float thickness)
Expand Down Expand Up @@ -370,7 +370,7 @@ namespace ouzel
dirty = true;
}

void ShapeDrawable::polygon(const std::vector<Vector2>& edges,
void ShapeRenderer::polygon(const std::vector<Vector2>& edges,
const Color& color,
bool fill,
float thickness)
Expand Down Expand Up @@ -430,7 +430,7 @@ namespace ouzel
return ret;
}

void ShapeDrawable::curve(const std::vector<Vector2>& controlPoints,
void ShapeRenderer::curve(const std::vector<Vector2>& controlPoints,
const Color& color,
uint32_t segments,
float thickness)
Expand Down
4 changes: 2 additions & 2 deletions ouzel/scene/ShapeDrawable.h → ouzel/scene/ShapeRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ namespace ouzel
{
namespace scene
{
class ShapeDrawable: public Component
class ShapeRenderer: public Component
{
public:
ShapeDrawable();
ShapeRenderer();

virtual void draw(const Matrix4& transformMatrix,
const Color& drawColor,
Expand Down
18 changes: 9 additions & 9 deletions ouzel/scene/TextDrawable.cpp → ouzel/scene/TextRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.

#include "TextDrawable.h"
#include "TextRenderer.h"
#include "core/Engine.h"
#include "graphics/Renderer.h"
#include "scene/Camera.h"
Expand All @@ -12,7 +12,7 @@ namespace ouzel
{
namespace scene
{
TextDrawable::TextDrawable(const std::string& fontFile,
TextRenderer::TextRenderer(const std::string& fontFile,
bool aMipmaps,
const std::string& aText,
Color aColor,
Expand Down Expand Up @@ -41,29 +41,29 @@ namespace ouzel
updateText();
}

void TextDrawable::setFont(const std::string& fontFile)
void TextRenderer::setFont(const std::string& fontFile)
{
font = sharedEngine->getCache()->getBMFont(fontFile);
texture = sharedEngine->getCache()->getTexture(font.getTexture(), false, mipmaps);

updateText();
}

void TextDrawable::setTextAnchor(const Vector2& newTextAnchor)
void TextRenderer::setTextAnchor(const Vector2& newTextAnchor)
{
textAnchor = newTextAnchor;

updateText();
}

void TextDrawable::setTextScale(const Vector2& newTextScale)
void TextRenderer::setTextScale(const Vector2& newTextScale)
{
textScale = newTextScale;

updateText();
}

void TextDrawable::draw(const Matrix4& transformMatrix,
void TextRenderer::draw(const Matrix4& transformMatrix,
const Color& drawColor,
const Matrix4& renderViewProjection,
const std::shared_ptr<graphics::Texture>& renderTarget,
Expand Down Expand Up @@ -120,21 +120,21 @@ namespace ouzel
scissorRectangle);
}

void TextDrawable::setText(const std::string& newText)
void TextRenderer::setText(const std::string& newText)
{
text = newText;

updateText();
}

void TextDrawable::setColor(const Color& newColor)
void TextRenderer::setColor(const Color& newColor)
{
color = newColor;

updateText();
}

void TextDrawable::updateText()
void TextRenderer::updateText()
{
font.getVertices(text, color, textAnchor, textScale, indices, vertices);
needsMeshUpdate = true;
Expand Down
4 changes: 2 additions & 2 deletions ouzel/scene/TextDrawable.h → ouzel/scene/TextRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace ouzel
{
namespace scene
{
class TextDrawable: public Component
class TextRenderer: public Component
{
public:
TextDrawable(const std::string& fontFile,
TextRenderer(const std::string& fontFile,
bool aMipmaps = true,
const std::string& aText = std::string(),
Color aColor = Color::WHITE,
Expand Down
2 changes: 1 addition & 1 deletion samples/AnimationsSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AnimationsSample::AnimationsSample(Samples& aSamples):
layer->addChild(camera.get());
addLayer(layer.get());

shapeDrawable.reset(new scene::ShapeDrawable());
shapeDrawable.reset(new scene::ShapeRenderer());
shapeDrawable->rectangle(ouzel::Rectangle(100.0f, 100.0f), Color(0, 128, 128, 255), true);
shapeDrawable->rectangle(ouzel::Rectangle(100.0f, 100.0f), Color::WHITE, false, 2.0f);
shapeDrawable->line(Vector2(0.0f, 0.0f), Vector2(50.0f, 50.0f), Color::CYAN, 2.0f);
Expand Down
2 changes: 1 addition & 1 deletion samples/AnimationsSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnimationsSample: public ouzel::scene::Scene
std::unique_ptr<ouzel::scene::Layer> layer;
std::unique_ptr<ouzel::scene::Camera> camera;

std::unique_ptr<ouzel::scene::ShapeDrawable> shapeDrawable;
std::unique_ptr<ouzel::scene::ShapeRenderer> shapeDrawable;
std::unique_ptr<ouzel::scene::Node> drawNode;

std::unique_ptr<ouzel::scene::Shake> shake;
Expand Down

0 comments on commit 38a1b20

Please sign in to comment.