From 066e5987c515dfc34537d73ca9d2a81ddd1f9e1b Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 21 Oct 2018 13:37:27 +0800 Subject: =?UTF-8?q?*=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/graphics/graphics.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/lua/modules/graphics/graphics.cpp') diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp index 573f319..4ff0dfc 100644 --- a/src/lua/modules/graphics/graphics.cpp +++ b/src/lua/modules/graphics/graphics.cpp @@ -10,6 +10,7 @@ namespace JinEngine { namespace Lua { + using namespace std; using namespace JinEngine; using namespace JinEngine::Graphics; @@ -125,12 +126,12 @@ namespace JinEngine goto fail; } Buffer b = {}; - if (!fs->read(f, &b)) + if (!fs->read(f, b)) { error(L, "Failed to read image %s", f); goto fail; } - bitmap = Bitmap::createBitmap(b.data, b.size); + bitmap = Bitmap::createBitmap(&b, b.size()); //const Color* col = bitmap->getPixels(); //ofstream o = ofstream("img.txt", ios_base::app); //for (int i = 0; i < bitmap->getWidth() * bitmap->getHeight(); ++i) @@ -195,8 +196,8 @@ namespace JinEngine return 1; } Buffer b; - fs->read(path, &b); - Shader* jsl = Shader::createShader((char*)b.data); + fs->read(path, b); + Shader* jsl = Shader::createShader((char*)&b); if (jsl == nullptr) { error(L, "Failed to compile shader"); @@ -618,8 +619,8 @@ namespace JinEngine return 1; } Buffer b; - fs->read(path, &b); - fd = TTFData::createTTFData((unsigned char*)b.data, b.size); + fs->read(path, b); + fd = TTFData::createTTFData(&b, b.size()); } proxy->bind(new Ref(fd, JIN_GRAPHICS_TTFDATA)); return 1; -- cgit v1.1-26-g67d0