Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f14e2b85be | ||
|
a883244505 | ||
|
6cbbd5b049 | ||
|
28c53e740d | ||
|
7e02edcc85 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Defold Foundation
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -29,7 +29,7 @@ Scans an image buffer for any qrcode.
|
|||||||
|
|
||||||
`height` The height of the image, in texels
|
`height` The height of the image, in texels
|
||||||
|
|
||||||
`flip_x` A boolean flag that tells the decoder to flip the image in X first.
|
`flip_x` A boolean flag (1 or 0) that tells the decoder to flip the image in X first.
|
||||||
|
|
||||||
-> `string` Returns a the text from the qrcode if successful. Returns nil otherwise
|
-> `string` Returns a the text from the qrcode if successful. Returns nil otherwise
|
||||||
|
|
||||||
|
@ -13,9 +13,17 @@ function init(self)
|
|||||||
gui.set_position(bg, vmath.vector3(screen_width/2, screen_height/2, 0))
|
gui.set_position(bg, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||||
gui.set_size(bg, vmath.vector3(screen_width, screen_height, 0))
|
gui.set_size(bg, vmath.vector3(screen_width, screen_height, 0))
|
||||||
|
|
||||||
local camera = gui.get_node("camera")
|
local cameranode = gui.get_node("camera")
|
||||||
gui.set_position(camera, vmath.vector3(screen_width/2, screen_height/2, 0))
|
gui.set_position(cameranode, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||||
gui.set_size(camera, vmath.vector3(screen_width/2, screen_height/2, 0))
|
gui.set_size(cameranode, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||||
|
|
||||||
|
self.camera_enabled = camera ~= nil
|
||||||
|
if not self.camera_enabled then
|
||||||
|
local labelnode = gui.get_node("scan_bn/larrylabel")
|
||||||
|
local iconnode = gui.get_node("camera_icon")
|
||||||
|
gui.set_color(labelnode, vmath.vector4(0.5,0.5,0.5,1))
|
||||||
|
gui.set_color(iconnode, vmath.vector4(0.5,0.5,0.5,1))
|
||||||
|
end
|
||||||
|
|
||||||
local qrcode = gui.get_node("qrcode")
|
local qrcode = gui.get_node("qrcode")
|
||||||
gui.set_position(qrcode, vmath.vector3(screen_width/2, screen_height/2, 0))
|
gui.set_position(qrcode, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||||
@ -54,9 +62,11 @@ local function isempty(s)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function on_input(self, action_id, action)
|
function on_input(self, action_id, action)
|
||||||
dirtylarry:button("scan_bn", action_id, action, function ()
|
if self.camera_enabled then
|
||||||
msg.post("controller", "click", {mode="SCAN"})
|
dirtylarry:button("scan_bn", action_id, action, function ()
|
||||||
end)
|
msg.post("controller", "click", {mode="SCAN"})
|
||||||
|
end)
|
||||||
|
end
|
||||||
dirtylarry:button("generate_bn", action_id, action, function ()
|
dirtylarry:button("generate_bn", action_id, action, function ()
|
||||||
local text = sys.get_sys_info().device_ident
|
local text = sys.get_sys_info().device_ident
|
||||||
if isempty(text) then
|
if isempty(text) then
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define EXTENSION_NAME QRCode
|
#define EXTENSION_NAME QRCode
|
||||||
#define LIB_NAME "QRCode"
|
#define LIB_NAME "QRCode"
|
||||||
#define MODULE_NAME "qrcode"
|
#define MODULE_NAME "qrcode"
|
||||||
|
|
||||||
// Defold SDK
|
// Defold SDK
|
||||||
#define DLIB_LOG_DOMAIN LIB_NAME
|
|
||||||
#include <dmsdk/sdk.h>
|
#include <dmsdk/sdk.h>
|
||||||
|
|
||||||
#include "quirc/quirc.h"
|
#include "quirc/quirc.h"
|
||||||
@ -167,7 +165,7 @@ static int Generate(lua_State* L)
|
|||||||
free(qr); // free the qr code
|
free(qr); // free the qr code
|
||||||
|
|
||||||
// Transfer ownership to Lua
|
// Transfer ownership to Lua
|
||||||
dmScript::LuaHBuffer luabuffer = {buffer, true};
|
dmScript::LuaHBuffer luabuffer(buffer, dmScript::OWNER_LUA);
|
||||||
dmScript::PushBuffer(L, luabuffer);
|
dmScript::PushBuffer(L, luabuffer);
|
||||||
lua_pushinteger(L, outsize);
|
lua_pushinteger(L, outsize);
|
||||||
return 2;
|
return 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user