diff options
-rw-r--r-- | bin/jin.exe | bin | 510464 -> 510464 bytes | |||
-rw-r--r-- | src/libjin/Graphics/Font/je_font.h | 6 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_texture_font.cpp | 10 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_texture_font.h | 6 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_ttf.cpp | 10 | ||||
-rw-r--r-- | src/libjin/Graphics/Font/je_ttf.h | 6 | ||||
-rw-r--r-- | src/libjin/Graphics/je_graphic.cpp | 4 | ||||
-rw-r--r-- | src/libjin/Graphics/je_graphic.h | 4 | ||||
-rw-r--r-- | src/libjin/Graphics/je_sprite.h | 4 | ||||
-rw-r--r-- | src/lua/modules/graphics/graphics.cpp | 14 |
10 files changed, 33 insertions, 31 deletions
diff --git a/bin/jin.exe b/bin/jin.exe Binary files differindex a7d4a70..4d13637 100644 --- a/bin/jin.exe +++ b/bin/jin.exe 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; } |