aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-23 13:07:57 +0800
committerchai <chaifix@163.com>2018-10-23 13:07:57 +0800
commit50be5c9746854adcdb5b45b75955b57f18f98fe5 (patch)
treeca854633b3901f6f052e757ca2a98ad0c597a508 /src
parent233856869a699c0139291e4f43a61bc5a056c189 (diff)
*draw->render
Diffstat (limited to 'src')
-rw-r--r--src/libjin/Graphics/Font/je_font.h6
-rw-r--r--src/libjin/Graphics/Font/je_texture_font.cpp10
-rw-r--r--src/libjin/Graphics/Font/je_texture_font.h6
-rw-r--r--src/libjin/Graphics/Font/je_ttf.cpp10
-rw-r--r--src/libjin/Graphics/Font/je_ttf.h6
-rw-r--r--src/libjin/Graphics/je_graphic.cpp4
-rw-r--r--src/libjin/Graphics/je_graphic.h4
-rw-r--r--src/libjin/Graphics/je_sprite.h4
-rw-r--r--src/lua/modules/graphics/graphics.cpp14
9 files changed, 33 insertions, 31 deletions
diff --git a/src/libjin/Graphics/Font/je_font.h b/src/libjin/Graphics/Font/je_font.h
index 2e9206b..42f83b6 100644
--- a/src/libjin/Graphics/Font/je_font.h
+++ b/src/libjin/Graphics/Font/je_font.h
@@ -63,7 +63,7 @@ namespace JinEngine
/// @param x X value of the position.
/// @param y Y value of the position.
///
- virtual void print(const Page* page, int x, int y) = 0;
+ virtual void render(const Page* page, int x, int y) = 0;
///
/// Render unicode codepoints to given position.
@@ -74,7 +74,7 @@ namespace JinEngine
/// @param lineheight Line height of the content.
/// @param spacing Spacing between characters.
///
- virtual void print(const Content& content, int x, int y, int lineheight, int spacing = 0) = 0;
+ virtual void render(const Content& content, int x, int y, int lineheight, int spacing = 0) = 0;
///
/// Render text to given position.
@@ -85,7 +85,7 @@ namespace JinEngine
/// @param lineheight Line height of the text.
/// @param spacing Spacing between characters.
///
- virtual void print(const Text& text, int x, int y, int lineheight, int spacing = 0) = 0;
+ virtual void render(const Text& text, int x, int y, int lineheight, int spacing = 0) = 0;
///
/// Get font size.
diff --git a/src/libjin/Graphics/Font/je_texture_font.cpp b/src/libjin/Graphics/Font/je_texture_font.cpp
index 9651c1a..30a927c 100644
--- a/src/libjin/Graphics/Font/je_texture_font.cpp
+++ b/src/libjin/Graphics/Font/je_texture_font.cpp
@@ -212,7 +212,7 @@ namespace JinEngine
return typeset(*text, lineheight, spacing);
}
- void TextureFont::print(const Page* page, int x, int y)
+ void TextureFont::render(const Page* page, int x, int y)
{
Shader* shader = Shader::getCurrentShader();
const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
@@ -231,17 +231,17 @@ namespace JinEngine
}
}
- void TextureFont::print(const Content& text, int x, int y, int lineheight, int spacing)
+ void TextureFont::render(const Content& text, int x, int y, int lineheight, int spacing)
{
Page* page = typeset(text, lineheight, spacing);
- print(page, x, y);
+ render(page, x, y);
delete page;
}
- void TextureFont::print(const Text& text, int x, int y, int lineheight, int spacing)
+ void TextureFont::render(const Text& text, int x, int y, int lineheight, int spacing)
{
Page* page = typeset(text, lineheight, spacing);
- print(page, x, y);
+ render(page, x, y);
delete page;
}
diff --git a/src/libjin/Graphics/Font/je_texture_font.h b/src/libjin/Graphics/Font/je_texture_font.h
index 6276350..0cafff1 100644
--- a/src/libjin/Graphics/Font/je_texture_font.h
+++ b/src/libjin/Graphics/Font/je_texture_font.h
@@ -64,17 +64,17 @@ namespace JinEngine
///
///
///
- void print(const Page* page, int x, int y) override;
+ void render(const Page* page, int x, int y) override;
///
///
///
- void print(const Content& text, int x, int y, int linehgiht, int spacing = 0) override;
+ void render(const Content& text, int x, int y, int linehgiht, int spacing = 0) override;
///
///
///
- void print(const Text& text, int x, int y, int lineheight, int spacing = 0)override;
+ void render(const Text& text, int x, int y, int lineheight, int spacing = 0)override;
private:
diff --git a/src/libjin/Graphics/Font/je_ttf.cpp b/src/libjin/Graphics/Font/je_ttf.cpp
index a11efb0..72e5da9 100644
--- a/src/libjin/Graphics/Font/je_ttf.cpp
+++ b/src/libjin/Graphics/Font/je_ttf.cpp
@@ -224,10 +224,10 @@ namespace JinEngine
return t;
}
- void TTF::print(const Content& t, int x, int y, int lineheight, int spacing)
+ void TTF::render(const Content& t, int x, int y, int lineheight, int spacing)
{
Page* page = typeset(t, lineheight, spacing);
- print(page, x, y);
+ render(page, x, y);
delete page;
}
@@ -299,7 +299,7 @@ namespace JinEngine
return typeset(*text, lineheight, spacing);
}
- void TTF::print(const Page* page, int x, int y)
+ void TTF::render(const Page* page, int x, int y)
{
Shader* shader = Shader::getCurrentShader();
const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
@@ -318,9 +318,9 @@ namespace JinEngine
}
}
- void TTF::print(const Text& text, int x, int y, int lineheight, int spacing /* = 0 */)
+ void TTF::render(const Text& text, int x, int y, int lineheight, int spacing /* = 0 */)
{
- print(*text, x, y, lineheight, spacing);
+ render(*text, x, y, lineheight, spacing);
}
int TTF::getCharWidth(int c)
diff --git a/src/libjin/Graphics/Font/je_ttf.h b/src/libjin/Graphics/Font/je_ttf.h
index e3d63b2..42e7e62 100644
--- a/src/libjin/Graphics/Font/je_ttf.h
+++ b/src/libjin/Graphics/Font/je_ttf.h
@@ -131,17 +131,17 @@ namespace JinEngine
///
///
///
- void print(const Text& text, int x, int y, int lineheight, int spacing = 0) override;
+ void render(const Text& text, int x, int y, int lineheight, int spacing = 0) override;
///
///
///
- void print(const Content& text, int x, int y, int lineheight, int spacing = 0) override;
+ void render(const Content& text, int x, int y, int lineheight, int spacing = 0) override;
///
///
///
- void print(const Page* page, int x, int y) override;
+ void render(const Page* page, int x, int y) override;
///
///
diff --git a/src/libjin/Graphics/je_graphic.cpp b/src/libjin/Graphics/je_graphic.cpp
index 831e409..cce0c74 100644
--- a/src/libjin/Graphics/je_graphic.cpp
+++ b/src/libjin/Graphics/je_graphic.cpp
@@ -59,7 +59,7 @@ namespace JinEngine
glDeleteTextures(1, &mTexture);
}
- void Graphic::draw(int x, int y, float sx, float sy, float r, float ox, float oy)
+ void Graphic::render(int x, int y, float sx, float sy, float r, float ox, float oy)
{
gl.ModelMatrix.setTransformation(x, y, r, sx, sy, ox, oy);
@@ -74,7 +74,7 @@ namespace JinEngine
gl.bindTexture(0);
}
- void Graphic::draw(const Math::Quad& slice, int x, int y, float sx, float sy, float r, float ax, float ay)
+ void Graphic::render(const Math::Quad& slice, int x, int y, float sx, float sy, float r, float ax, float ay)
{
float vertCoords[8] = {
0, 0,
diff --git a/src/libjin/Graphics/je_graphic.h b/src/libjin/Graphics/je_graphic.h
index 48684b8..5d5b2a5 100644
--- a/src/libjin/Graphics/je_graphic.h
+++ b/src/libjin/Graphics/je_graphic.h
@@ -44,12 +44,12 @@ namespace JinEngine
///
///
///
- void draw(int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0);
+ void render(int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0);
///
///
///
- void draw(const Math::Quad& slice, int x, int y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0);
+ void render(const Math::Quad& slice, int x, int y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0);
///
///
diff --git a/src/libjin/Graphics/je_sprite.h b/src/libjin/Graphics/je_sprite.h
index 3b96162..1d3c950 100644
--- a/src/libjin/Graphics/je_sprite.h
+++ b/src/libjin/Graphics/je_sprite.h
@@ -11,8 +11,9 @@ namespace JinEngine
{
namespace Graphics
{
+
///
- /// A sprite is unit of rendering, logic and events.
+ /// A sprite is unit of rendering
///
class Sprite
{
@@ -29,6 +30,7 @@ namespace JinEngine
Math::Vector2<float> mScale;
Color mColor;
const Shader* mShader;
+ const Graphic* mGraphic;
};
diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp
index 8b2d7cd..f98d640 100644
--- a/src/lua/modules/graphics/graphics.cpp
+++ b/src/lua/modules/graphics/graphics.cpp
@@ -276,7 +276,7 @@ namespace JinEngine
float oy = luax_optnumber(L, 8, 0);
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
Ref<Texture>& tex = proxy->getRef<Texture>();
- tex->draw(x, y, sx, sy, r, ox, oy);
+ tex->render(x, y, sx, sy, r, ox, oy);
}
static void l_draw_canvas(lua_State* L)
@@ -292,7 +292,7 @@ namespace JinEngine
float oy = luax_optnumber(L, 8, 0);
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
Ref<Canvas>& p = proxy->getRef<Canvas>();
- p->draw(x, y, sx, sy, r, ox, oy);
+ p->render(x, y, sx, sy, r, ox, oy);
}
/* jin.graphics.draw(text, font, x, y) */
@@ -322,7 +322,7 @@ namespace JinEngine
font = context.defaultFont;
}
int lineheight = luax_optnumber(L, 5, font->getFontSize());
- font->print(*text, x, y, lineheight, spacing);
+ font->render(*text, x, y, lineheight, spacing);
}
/* jin.graphics.draw(page, x, y) */
@@ -335,7 +335,7 @@ namespace JinEngine
Proxy* p = (Proxy*)luax_toudata(L, 1);
Page* page = p->getObject<Page>();
Font* font = page->font;
- font->print(page, x, y);
+ font->render(page, x, y);
}
static int l_draw(lua_State* L)
@@ -382,13 +382,13 @@ namespace JinEngine
{
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
Ref<Texture>& tex = proxy->getRef<Texture>();
- tex->draw(q, x, y, sx, sy, r, ox, oy);
+ tex->render(q, x, y, sx, sy, r, ox, oy);
}
else if (luax_istype(L, 1, JIN_GRAPHICS_CANVAS))
{
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
Ref<Canvas>& p = proxy->getRef<Canvas>();
- p->draw(q, x, y, sx, sy, r, ox, oy);
+ p->render(q, x, y, sx, sy, r, ox, oy);
}
else
{
@@ -410,7 +410,7 @@ namespace JinEngine
int y = luax_optnumber(L, 3, 0);
int lineheight = luax_optnumber(L, 4, font->getFontSize());
int spacing = luax_optnumber(L, 5, 0);
- font->print(text, x, y, lineheight, spacing);
+ font->render(text, x, y, lineheight, spacing);
return 0;
}