diff options
author | chai <chaifix@163.com> | 2018-12-19 17:36:48 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-19 17:36:48 +0800 |
commit | cad5193dfb6c79874f7d0c8c39bcfac8489ba9b3 (patch) | |
tree | 74345a48f33d8d6b7bd8e553f09c5566ee59a519 /src | |
parent | 4957f1c346509b30940371f093139067287b6867 (diff) |
*shader
Diffstat (limited to 'src')
-rw-r--r-- | src/libjin/common/je_common.h | 1 | ||||
-rw-r--r-- | src/libjin/common/je_string.h | 15 | ||||
-rw-r--r-- | src/libjin/graphics/je_graphic.cpp | 8 | ||||
-rw-r--r-- | src/lua/embed/embed.h | 7 |
4 files changed, 20 insertions, 11 deletions
diff --git a/src/libjin/common/je_common.h b/src/libjin/common/je_common.h index 31b67c6..a34268a 100644 --- a/src/libjin/common/je_common.h +++ b/src/libjin/common/je_common.h @@ -3,5 +3,6 @@ #include "je_exception.h" #include "je_array.hpp" +#include "je_string.h" #endif
\ No newline at end of file diff --git a/src/libjin/common/je_string.h b/src/libjin/common/je_string.h index db0cffb..4e46f17 100644 --- a/src/libjin/common/je_string.h +++ b/src/libjin/common/je_string.h @@ -24,6 +24,11 @@ namespace JinEngine { } + inline String(const char* str) + : std::string(str) + { + } + inline String& operator = (const String& str) { std::string::operator=(str); @@ -45,11 +50,6 @@ namespace JinEngine { } - inline String(const char* nts) - : std::string(nts) - { - } - inline String(const char* buf, size_type bufsize) : std::string(buf, bufsize) { @@ -60,6 +60,11 @@ namespace JinEngine { } + inline int length() const + { + return size(); + } + }; } diff --git a/src/libjin/graphics/je_graphic.cpp b/src/libjin/graphics/je_graphic.cpp index ef56ef0..ae15afe 100644 --- a/src/libjin/graphics/je_graphic.cpp +++ b/src/libjin/graphics/je_graphic.cpp @@ -55,7 +55,7 @@ namespace JinEngine void Graphic::render(float x, float y, float sx, float sy, float r, float ox, float oy) const { - Math::Matrix modelMatrix = gl.getModelViewMatrix(x, y, sx, sy, r, ox, oy); + Math::Matrix modelViewMatrix = gl.getModelViewMatrix(x, y, sx, sy, r, ox, oy); int w = getWidth(), h = getHeight(); static float vertexCoords[8]; static float textureCoords[8]; @@ -71,7 +71,7 @@ namespace JinEngine textureCoords[6] = 1; textureCoords[7] = 0; // Set shader. Shader* shader = gl.getShader(); - shader->sendMatrix4(SHADER_MODELVIEW_MATRIX, &modelMatrix); + shader->sendMatrix4(SHADER_MODELVIEW_MATRIX, &modelViewMatrix); shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.getProjectionMatrix()); shader->setVertexPointer(2, GL_FLOAT, 0, vertexCoords); shader->setUVPointer(2, GL_FLOAT, 0, textureCoords); @@ -101,10 +101,10 @@ namespace JinEngine textureCoords[4] = slx + slw; textureCoords[5] = sly + slh; textureCoords[6] = slx + slw; textureCoords[7] = sly; - Math::Matrix modelMatrix = gl.getModelViewMatrix(x, y, sx, sy, r, ax, ay); + Math::Matrix modelViewMatrix = gl.getModelViewMatrix(x, y, sx, sy, r, ax, ay); Shader* shader = gl.getShader(); - shader->sendMatrix4(SHADER_MODELVIEW_MATRIX, &modelMatrix); + shader->sendMatrix4(SHADER_MODELVIEW_MATRIX, &modelViewMatrix); shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.getProjectionMatrix()); shader->setVertexPointer(2, GL_FLOAT, 0, vertexCoords); shader->setUVPointer(2, GL_FLOAT, 0, textureCoords); diff --git a/src/lua/embed/embed.h b/src/lua/embed/embed.h index b5e1334..1928dd5 100644 --- a/src/lua/embed/embed.h +++ b/src/lua/embed/embed.h @@ -24,18 +24,21 @@ namespace JinEngine { "graphics.lua", graphics_lua }, { "keyboard.lua", keyboard_lua }, { "mouse.lua", mouse_lua }, - { "boot.lua", boot_lua }, { 0, 0 } }; + static const jin_Embed bootscript = { "boot.lua", boot_lua }; + static void run(lua_State* L) { for (int i = 0; modules[i].file; ++i) { const char* file = modules[i].file, *source = modules[i].source; if (luax_loadbuffer(L, source, strlen(source), file) == 0) - lua_call(L, 0, 0); + luax_call(L, 0, 0); } + if (luax_loadbuffer(L, bootscript.source, strlen(bootscript.source), bootscript.file) == 0) + luax_call(L, 0, 0); } } // namespace Embed |